[Pcsclite-muscle] sample code
Allen Curtis
allen at criticalsoftwaresolutions.com
Sat Apr 8 09:49:06 PDT 2023
SCardEstablishContext() is the first call made to the driver. First Context is established, then all the readers are found and checked to find the PICC reader expected. (Our reader is ACS1252 which is a dual mode reader. Assume we do not want the SAM version).
Yes, there is 2 threads. The idea was that one thread would monitor for the presence of a tag in the reader. This would include determine if the tag inserted is authentic. The other thread would wait on a message queue for perform IO operations to the card based on whether it was present or not.
Are you saying that the SCardEstablishContext() is thread context sensitive and can not be shared across threads? Since the context was to a PCSC driver and there will only be 1 reader I assumed the context could be shared. Just make sure both threads did not use it at the same time.
Thanks for the help. Will make these changes and try again.
- Allen
> On Apr 8, 2023, at 6:54 AM, Ludovic Rousseau <ludovic.rousseau at gmail.com> wrote:
>
> Le ven. 7 avr. 2023 à 22:40, Ludovic Rousseau
> <ludovic.rousseau at gmail.com> a écrit :
>>
>> Le ven. 7 avr. 2023 à 17:36, Allen Curtis
>> <allen at criticalsoftwaresolutions.com> a écrit :
>>>
>>> Below is the attached code distilled down to the relevant logic. The
>>> actual source files are attached as well for your review.
>>
>> Please provide a MINIMAL sample code. And a program that can run with
>> any reader name.
>
> It looks like a bug on your code.
> From SCardEstablishContext() documentation
> https://pcsclite.apdu.fr/api/group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67
> " This must be the first WinSCard function called in a PC/SC
> application. Each thread of an application shall use its own
> SCARDCONTEXT, unless calling SCardCancel(), which MUST be called with
> the same context as the context used to call SCardGetStatusChange(). "
>
> From your source code I see you use 2 threads but only one
> SCardEstablishContext() call.
> Fix your code and try again.
>
> Bye
>
> --
> Dr. Ludovic Rousseau
>
> _______________________________________________
> pcsclite-muscle mailing list
> pcsclite-muscle at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/pcsclite-muscle
More information about the pcsclite-muscle
mailing list