PCSC-LITE more than one Card Reader.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

PCSC-LITE more than one Card Reader.

Yusuf Bülbül

Hi.




I am using pcsclite for Ubuntu 16.04 TLS. I am developping a C++ application on QT.  I have a problem about pcsclite. Can you help me? I will be very glad, if you can.




When I use single card reader, everything is okey.  I can list readers and communicate them.  But, When I have plugged two smart card reader to usb hub,  I can't list all readers.  I can take only first smart card reader name. I can't take completed string  after '0/' for mszReaders.   I have tried the install last stable version of Pcsclite and ccid driver, but, it's same. I have stucked here.  pcsc-lite version:1.8.20, ccid driver version:1.4.99.




 




My code is;




 




    LONG rv;

    SCARDCONTEXT hContext;
    LPSTR mszReaders;
    DWORD dwReaders, dwActiveProtocol;

    DWORD dwState, dwProtocol, dwAtrLen, dwReaderLen;
    SCARD_IO_REQUEST pioSendPci;

    SCARDHANDLE hCard;



   if (SCardEstablishContext(SCARD_SCOPE_SYSTEM    , NULL, NULL, &hContext) == CARD_S_SUCCESS)
   {
       printf("SCardEstablishContext: Succesfull. rv: %ld \n", rv);

       LPSTR mszGroups;
       DWORD dwGroups;





       rv = SCardListReaderGroups(hContext, NULL, &dwGroups);
       mszGroups = (LPSTR)malloc(sizeof(char)*dwGroups);
       rv = SCardListReaderGroups(hContext, mszGroups, &dwGroups);
       printf("Group Readers: %s \n", mszGroups);

       dwReaders = SCARD_AUTOALLOCATE;

       if (SCardListReaders(hContext, NULL, (LPSTR)&mszReaders, &dwReaders) == SCARD_S_SUCCESS)
       {

           printf("reader name: %s\n", mszReaders);
           printf("dword: %ld\n", dwReaders);




      }




}




 




Output for one card reader plugged:




SCardEstablishContext: Succesfull. rv: 13672000 
Group Readers: SCard$DefaultReaders 
reader name: Microchip SEC1110 [CCID Interface] (D191B0BC) 01 00
dword: 53




 




Output for two Card Reader Plugged:




SCardEstablishContext: Succesfull. rv: 21179968 
Group Readers: SCard$DefaultReaders 
reader name: Microchip SEC1110 [CCID Interface] (71917A4C) 00 00
dword: 105




 




Thank You & Best Regards




Yusuf.




_______________________________________________
Pcsclite-muscle mailing list
[hidden email]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pcsclite-muscle
Reply | Threaded
Open this post in threaded view
|

Re: PCSC-LITE more than one Card Reader.

Ludovic Rousseau
2017-05-18 11:16 GMT+02:00 Yusuf Bülbül <[hidden email]>:

Hi.


Hello,

I am using pcsclite for Ubuntu 16.04 TLS. I am developping a C++ application on QT.  I have a problem about pcsclite. Can you help me? I will be very glad, if you can.


When I use single card reader, everything is okey.  I can list readers and communicate them.  But, When I have plugged two smart card reader to usb hub,  I can't list all readers.  I can take only first smart card reader name. I can't take completed string  after '0/' for mszReaders.   I have tried the install last stable version of Pcsclite and ccid driver, but, it's same. I have stucked here.  pcsc-lite version:1.8.20, ccid driver version:1.4.99.


SCardListReaders() API documentation is at [1].
mszReaders is a *Multi-string* with list of readers.

Have a look at this MSDN sample code [2].

I will also add a sample code showing how to use the multi-string returned by SCardListReaders() in pcsc-lite documentation.

Thanks for the notice.

Bye

[1] http://pcsclite.alioth.debian.org/api/group__API.html#ga93b07815789b3cf2629d439ecf20f0d9
[2] https://msdn.microsoft.com/fr-fr/library/windows/desktop/aa379793(v=vs.85).aspx


--
 Dr. Ludovic Rousseau

_______________________________________________
Pcsclite-muscle mailing list
[hidden email]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pcsclite-muscle