[Pcsclite-muscle] Registering virtual readers

Ludovic Rousseau ludovic.rousseau
Thu Sep 18 02:55:23 PDT 2014


2014-09-18 11:16 GMT+02:00 Alexander May <alexander.may at hjp-consulting.com>:
> Hi,

Hello,

> I implemented an IFDHandler for my virtual terminal that connects to a
> card simulation. Currently I configured it as serial reader, open a
> server socket during IFDHCreateChannel, let the virutal terminal connect
> to it and afterwards forward every function call to the client. This
> works quite well for testing. Unfortunately it has the downside that
> IFDHCreateChannel blocks until the client is available and currently
> allows only for one virtual terminal.
>
> So I could handle the server socket within a thread, eliminating the
> issue that IFDHCreateChannel blocks. Then I would be able to handle
> multiple connections from my virtual terminals. But this leads to two
> questions:
> - 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.

Bye,

-- 
 Dr. Ludovic Rousseau




More information about the pcsclite-muscle mailing list