[Pcsclite-muscle] Multiple command processing and card recognition
ertan at cronosmedikal.com
Sat Feb 9 12:45:44 PST 2019
>From: pcsclite-muscle [mailto:pcsclite-muscle-bounces at lists.infradead.org] On Behalf Of Ludovic Rousseau
>Sent: Saturday, February 9, 2019 2:00 PM
>To: pcsclite-muscle at lists.infradead.org
>Subject: Re: [Pcsclite-muscle] Multiple command processing and card recognition
>> B- I need to auto identify when card is in range. What function(s) I
>> should be using for that?
>Have a look at the pcsc_scan program for example.
I am checking example code and trying to understand it. Some questions comes up in my mind.
1- I see that when SCARD_STATE_CHANGED, even reader list is populated again. My use case, there will be a single reader and it will always be used. Do I still need to use SCardListReaders() like in "pcsc_scan"?
2- Sample code pulled SCardGetStatusChange() every second. I tried to use INFINITE and even I insert/remove card function did not exit and continued to block. Is it OK that I call that function 10 times in a second (keep timeout like 100 miliseconds)? It is not good for me if card state reading is not working 24/7. I can understand glitches from now and then, but application cannot make a problem like each minute or so.
>> C- Is it safe to call these functions constantly in a thread? More or
>> 24/7 non-stop? Do I need to wait between calls? For how long?
>It should work.
Well, I tested calling frequently SCardConnect() and after a while even there is an inserted card and I did not touch it application reported as card I removed. Moreover, it did not get fixed by removing and inserting card. Maybe some readers, it may not work.
I will try to implement SCardGetStatusChange() now.
>Note that SCardGetStatusChange() is a blocking function. If no change happens then no need to repeat the function.
>Active polling is bad.
Is it possible to make pcsclite library to log incoming requests? I suspect I am passing my reader name wrong or something to SCardGetStatusChange() because function do not exit when a card inserted or moved away.
Thanks & regards,
> Dr. Ludovic Rousseau
>pcsclite-muscle mailing list
>pcsclite-muscle at lists.infradead.org
More information about the pcsclite-muscle