Re: SCardConnect() returns unresponsive card
Gökçenur CANLI <[email protected]> Mon, 22 May 2017 11:06:07 +0300
| Newsgroups | gmane.comp.lib.muscle |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format. --===============6472037053307131933== Content-Type: multipart/alternative; boundary="------------5C644A1FBFDBC6B4B0C7881F" This is a multi-part message in MIME format. --------------5C644A1FBFDBC6B4B0C7881F Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Dear Ludovic and Francois, Changing dwMaxDataRatewas solved my all /(//SCardConnect() - SCardTransmit()//)/ problems. Thank you for all helps and valuable information. * My smart card is *test* Electronic Identity card of /The Scientific and Technological Research Council of Turkey/. Regards. Gokcenur. On 18-05-2017 15:36, Ludovic Rousseau wrote: > 2017-05-18 13:29 GMT+02:00 Gökçenur CANLI <[email protected] > <mailto:[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 dwMaxDataRatefor 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 -- *Gökçenur CANLI* /Ar-Ge Mühendisi /UDEA Elektronik A.Ş. ODTÜ Teknokent Gümüş Bloklar K1-3 Ofis Alanı Çankaya/ANKARA Tel : + 90 (312) 210 19 82 Fax: +90 (312) 210 19 97 // Signature <http://www.udea.com.tr>// --------------5C644A1FBFDBC6B4B0C7881F Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit <html> <head> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"> </head> <body bgcolor="#FFFFFF" text="#000000"> <p>Dear Ludovic and Francois,</p> <p>Changing dwMaxDataRate<span class="gmail-"> was solved my all <i>(</i><i>SCardConnect() - SCardTransmit()</i><i>)</i> problems. </span>Thank you for all helps and valuable information. <br> </p> <p><font size="-1">* My smart card is <b>test</b> Electronic Identity card of <i>The Scientific and Technological Research Council of Turkey</i>. </font><br> </p> <p>Regards.<br> </p> Gokcenur.<br> <br> <div class="moz-cite-prefix">On 18-05-2017 15:36, Ludovic Rousseau wrote:<br> </div> <blockquote cite="mid:CAGstE8Dknb_c01cQgn9ULnFJ-U1SVrNTddNFQvpad-yhTdRrTg@mail.gmail.com" type="cite"> <div dir="ltr"> <div class="gmail_extra"> <div class="gmail_quote">2017-05-18 13:29 GMT+02:00 Gökçenur CANLI <span dir="ltr"><<a moz-do-not-send="true" href="mailto:[email protected]" target="_blank">[email protected]</a>></span>:<br> <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <div bgcolor="#FFFFFF"> <p>Sorry for wrong one, generated updated log is attached.<br> </p> </div> </blockquote> <div><br> 00000002 ifdhandler.c:1081:<wbr>IFDHSetProtocolParameters() Negotiate IFSD at 254<br> 00000003 sending: 00 C1 01 FE 3E <br> 00000003 -> 000000 6F 05 00 00 00 00 0D 00 00 00 00 C1 01 FE 3E <br> 00000966 <- 000000 80 04 00 00 00 00 0D 00 00 00 92 82 00 10 <br> 00000005 received: 92 82 00 10 <br> 00000002 sending: 00 C1 01 FE 3E <br> 00000003 -> 000000 6F 05 00 00 00 00 0E 00 00 00 00 C1 01 FE 3E <br> 00000769 <- 000000 80 04 00 00 00 00 0E 00 00 00 92 82 00 10 <br> 00000005 received: 92 82 00 10 <br> 00000002 sending: 00 C1 01 FE 3E <br> 00000003 -> 000000 6F 05 00 00 00 00 0F 00 00 00 00 C1 01 FE 3E <br> 00000767 <- 000000 80 04 00 00 00 00 0F 00 00 00 92 82 00 10 <br> 00000005 received: 92 82 00 10 <br> 00000002 prothandler.c:124:<wbr>PHSetProtocol() PTS failed (612), using T=1<br> <br clear="all"> </div> </div> The reader fails to negociate the IFSD (Information Field Size for CCID for protocol T = 1)<br> <br> </div> <div class="gmail_extra">The value returned by the reader "92 82 00 10" is very strange (bogus?).<br> </div> <div class="gmail_extra">The CCID driver tries 3 times the same command and then gives up.<br> <br> </div> <div class="gmail_extra">As Francois Grieu wrote in another email (thanks for that) this card can use a very fast communication.<br> </div> <div class="gmail_extra">Your reader [1] defines:<br> dwDefaultClock: 4.800 MHz [3]<br> and<br> dwMaxDataRate: 826000 bps [4]<br> <br> So the card could communicate at 300 kbits/s.<br> </div> <div class="gmail_extra"><br> Your card is not yet in my list. Could you add it using [2]? Or tell us what this smart card is?<br> <br> <br> </div> <div class="gmail_extra">Francois proposed different solutions to solve the problem.<br> </div> <div class="gmail_extra">There is no easy way to force a TA1 in the driver. Maybe the simplest fix would be to change the value of dwMaxDataRate<span class="gmail-"> </span>for this reader and use a (much) lower value instead.<br> </div> <div class="gmail_extra"><br> </div> <div class="gmail_extra">Proposed patch:<br> <span style="font-family:monospace,monospace">--- /var/folders/5h/3d1x67_x5g30t36wypgxpmpc0000gn/T//sbZS7a_ccid.c 2017-05-18 14:33:20.000000000 +0200<br> +++ src/ccid.c 2017-05-18 14:33:18.000000000 +0200<br> @@ -87,6 +87,10 @@ int ccid_open_hack_pre(unsigned int read<br> ccid_descriptor->dwMaxDataRate = 9600;<br> break;<br> <br> + case MICROCHIP_SEC1100:<br> + ccid_descriptor->dwMaxDataRate = 12903;<br> + break;<br> +<br> case ElatecTWN4:<br> /* use a timeout of 400 ms instead of 100 ms in CmdGetSlotStatus()<br> * used by CreateChannelByNameOrChannel()<br> </span><br> <br> 12903 is a very low value. This is the lowest/default data rate of the reader (dwDataRate [5])<br> You can increase it up to 826000 and see when the reader fails.<br> <br> </div> <div class="gmail_extra">Bye<br> </div> <div class="gmail_extra"><br> [1] <a moz-do-not-send="true" href="http://pcsclite.alioth.debian.org/ccid/readers/Microchip_SEC1110.txt">http://pcsclite.alioth.debian.org/ccid/readers/Microchip_SEC1110.txt</a><br> </div> <div class="gmail_extra">[2] <a moz-do-not-send="true" href="http://smartcard-atr.appspot.com/parse?ATR=3B9F968131FE458065544312210831C073F6218081059A">http://smartcard-atr.appspot.com/parse?ATR=3B9F968131FE458065544312210831C073F6218081059A</a><br> [3] <a moz-do-not-send="true" href="https://ludovicrousseau.blogspot.fr/2014/07/ccid-descriptor-statistics.html">https://ludovicrousseau.blogspot.fr/2014/07/ccid-descriptor-statistics.html</a><br> [4] <a moz-do-not-send="true" href="https://ludovicrousseau.blogspot.fr/2014/07/ccid-descriptor-statistics-dwmaxdatarate.html">https://ludovicrousseau.blogspot.fr/2014/07/ccid-descriptor-statistics-dwmaxdatarate.html</a><br> [5] <a moz-do-not-send="true" href="https://ludovicrousseau.blogspot.fr/2014/02/ccid-descriptor-statistics-dwdatarate.html">https://ludovicrousseau.blogspot.fr/2014/02/ccid-descriptor-statistics-dwdatarate.html</a><br> <br> -- <br> <div class="gmail-m_-1930177603088813674gmail_signature"> Dr. Ludovic Rousseau</div> </div> </div> <br> <fieldset class="mimeAttachmentHeader"></fieldset> <br> <pre wrap="">_______________________________________________ Pcsclite-muscle mailing list <a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a> <a class="moz-txt-link-freetext" href="http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pcsclite-muscle">http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pcsclite-muscle</a></pre> </blockquote> <br> <div class="moz-signature">-- <br> <b>Gökçenur CANLI</b><br> <small><i>Ar-Ge Mühendisi<br> <font color="#4C787E"><em><small>UDEA Elektronik A.Ş. ODTÜ Teknokent <br> Gümüş Bloklar K1-3 Ofis Alanı<br> Çankaya/ANKARA<br> Tel : + 90 (312) 210 19 82<br> Fax: +90 (312) 210 19 97<br> </small></em></font><em><small> <br> <a href="http://www.udea.com.tr"><img moz-do-not-send="false" src="file:///home/gokcecan/Documents/udea_logo.bmp" alt="Signature"></a></small></em></i></small></div> </body> </html> --------------5C644A1FBFDBC6B4B0C7881F-- --===============6472037053307131933== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Pcsclite-muscle mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pcsclite-muscle --===============6472037053307131933==--