[Pcsclite-muscle] Registering virtual readers
Ludovic Rousseau
ludovic.rousseau
Sat Sep 20 02:40:37 PDT 2014
2014-09-19 15:27 GMT+02:00 Alexander May <alexander.may at hjp-consulting.com>:
>
> Am 18.09.2014 um 11:55 schrieb Ludovic Rousseau:
>>> - how can I register them as new readers during runtime?
>>> - Is there a better point where I could start my server socket thread?
>>> Doing this in IFDHCreateChannel requires a "server reder" that will
>>> never connect to any card, which is a little ugly in my opinion.
>> The serial configuration interface may the best you can use.
>>
>> pcsc-lite implements RFReCheckReaderConf() to recheck the serial
>> configuration. This code is used in hotplug_libusb.c but has been
>> removed from hotplug_libudev.c.
>>
>> The idea is to send a signal SIGUSR1 to pcscd to tell it to reload the
>> serial configuration.
>> You may have 10 virtual readers configured as 10 serial devices.
>> IFDHCreateChannel() would fail for non existent readers.
>> On the next SIGUSR1 signal each configured serial driver should be
>> called again and IFDHCreateChannel() would succeed if the reader is
>> now available.
>>
>> You can experiment on that idea.
>>
> That sounds very good. I changed my code accordingly, configured some
> readers that return IFD_NO_SUCH_DEVICE on IFDHCreateChannel as long as
> no connection is present and change their behavor when a client is
> connect to return IFD_SUCCESS.
> Unfortunately I semm to be unable to trigger the rescaning of the reader
> configuration. I even tried sending SIGUSR1 manually from another shell
> or calling pcscd -H. But neither worked. At least my IFDHCreateChannel
> isn't called again.
> Am I missing something? (In case it matters, I'm using Ubuntu 12.04 LTS
> with default pcsc-lite 1.7.4)
I was not clear enough in my previous answer.
The use of SIGUSR1 is available when hotplug_libusb.c is used.
Now the USB hotplug is done using hotplug_libudev.c and the use of
SIGUSR1 is no more available.
You can rebuild pcsc-lite using --enable-libusb so that
hotplug_libusb.c and try/debug your code.
If it works you can hack hotplug_libudev.c to add support of SIGUSR1
so that you can use the standard pcsc-lite compilation.
Bye
--
Dr. Ludovic Rousseau
More information about the pcsclite-muscle
mailing list