[Pcsclite-muscle] libpcsclite API file descriptor for polling?

Arnaud Loonstra arnaud
Mon Dec 21 03:06:09 PST 2015


On 2015-12-20 22:37, Ludovic Rousseau wrote:
> 2015-12-20 14:57 GMT+01:00 Arnaud Loonstra <arnaud at sphaero.org [1]>:
>
>> Hi all,
>
> Hello,
> ?
>
>> I was going through the internals of libpcsclite and as I noticed it
>> uses
>> IPC to communicate with the daemon I was wondering if it is
>> possible to
>> retrieve the sockets fd to add it to a poller?
>>
>> I noticed MessageReceive() in wincard_msg.c:449 is already using
>> select
>> (469)
>>
>> Is this possible through the current API?
>
> No, it is not possible through the current API.
> The API is a "standard" defined by the PCSC workgroup [1] and cant be
> changed like that.
>
> I would propose to use an intermediate thread that calls
> SCardGetStatusChange() [2] (or whatever PC/SC function you want to
> poll) that would write to a file descriptor you created for that.
>
> What do you want to do exactly?

My use case seems a simple one, I guess. I want to capture the events 
when a tag is detected by an NFC reader. As I'm integrating this into a 
ZeroMQ based application my first target was finding out how I can get 
the socket into a polling based application loop.

I'm using simple ACR122U based readers on Linux. The API search brought 
me to PCSC. As I found it uses 'select' I wondered if it is possible to 
add the IPC socket's FD to a poller and just use MessageSend as it is 
but trigger MessageReceive on the poll events.

So it seems the API won't let me but from the API internals it seems it 
could be possible. What I don't get is if the client library needs to 
request whether there is a tag detected (request-reply) or whether the 
daemon pushes its events through the IPC channel and the client just 
triggers when it receives something (publish-subscrive basically).

Rg,

Arnaud






More information about the pcsclite-muscle mailing list