Re: SCardConnect() returns unresponsive card
Ludovic Rousseau <[email protected]> Thu, 18 May 2017 14:36:14 +0200
| Newsgroups | gmane.comp.lib.muscle |
|---|---|
| Message-ID | <CAGstE8Dknb_c01cQgn9ULnFJ-U1SVrNTddNFQvpad-yhTdRrTg@mail.gmail.com> |
2017-05-18 13:29 GMT+02:00 Gökçenur CANLI <[email protected]>: > Sorry for wrong one, generated updated log is attached. > 00000002 ifdhandler.c:1081:IFDHSetProtocolParameters() Negotiate IFSD at 254 00000003 sending: 00 C1 01 FE 3E 00000003 -> 000000 6F 05 00 00 00 00 0D 00 00 00 00 C1 01 FE 3E 00000966 <- 000000 80 04 00 00 00 00 0D 00 00 00 92 82 00 10 00000005 received: 92 82 00 10 00000002 sending: 00 C1 01 FE 3E 00000003 -> 000000 6F 05 00 00 00 00 0E 00 00 00 00 C1 01 FE 3E 00000769 <- 000000 80 04 00 00 00 00 0E 00 00 00 92 82 00 10 00000005 received: 92 82 00 10 00000002 sending: 00 C1 01 FE 3E 00000003 -> 000000 6F 05 00 00 00 00 0F 00 00 00 00 C1 01 FE 3E 00000767 <- 000000 80 04 00 00 00 00 0F 00 00 00 92 82 00 10 00000005 received: 92 82 00 10 00000002 prothandler.c:124:PHSetProtocol() PTS failed (612), using T=1 The reader fails to negociate the IFSD (Information Field Size for CCID for protocol T = 1) The value returned by the reader "92 82 00 10" is very strange (bogus?). The CCID driver tries 3 times the same command and then gives up. As Francois Grieu wrote in another email (thanks for that) this card can use a very fast communication. Your reader [1] defines: dwDefaultClock: 4.800 MHz [3] and dwMaxDataRate: 826000 bps [4] So the card could communicate at 300 kbits/s. Your card is not yet in my list. Could you add it using [2]? Or tell us what this smart card is? Francois proposed different solutions to solve the problem. There is no easy way to force a TA1 in the driver. Maybe the simplest fix would be to change the value of dwMaxDataRate for this reader and use a (much) lower value instead. Proposed patch: --- /var/folders/5h/3d1x67_x5g30t36wypgxpmpc0000gn/T//sbZS7a_ccid.c 2017-05-18 14:33:20.000000000 +0200 +++ src/ccid.c 2017-05-18 14:33:18.000000000 +0200 @@ -87,6 +87,10 @@ int ccid_open_hack_pre(unsigned int read ccid_descriptor->dwMaxDataRate = 9600; break; + case MICROCHIP_SEC1100: + ccid_descriptor->dwMaxDataRate = 12903; + break; + case ElatecTWN4: /* use a timeout of 400 ms instead of 100 ms in CmdGetSlotStatus() * used by CreateChannelByNameOrChannel() 12903 is a very low value. This is the lowest/default data rate of the reader (dwDataRate [5]) You can increase it up to 826000 and see when the reader fails. Bye [1] http://pcsclite.alioth.debian.org/ccid/readers/Microchip_SEC1110.txt [2] http://smartcard-atr.appspot.com/parse?ATR=3B9F968131FE458065544312210831C073F6218081059A [3] https://ludovicrousseau.blogspot.fr/2014/07/ccid-descriptor-statistics.html [4] https://ludovicrousseau.blogspot.fr/2014/07/ccid-descriptor-statistics-dwmaxdatarate.html [5] https://ludovicrousseau.blogspot.fr/2014/02/ccid-descriptor-statistics-dwdatarate.html -- Dr. Ludovic Rousseau _______________________________________________ Pcsclite-muscle mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pcsclite-muscle