[Pcsclite-muscle] Bug in CCID library

Abraham Macias Paredes amacias
Wed Oct 5 02:25:24 PDT 2016


Hi Ludovic,

I tested the patch that you attached and it works fine. And the ?adapted speed is 125000 bauds?.

 

Final code:

 

                else

                {

                     /* the card is too fast for the reader */

                     if ((card_baudrate > ccid_desc->dwMaxDataRate +2)

                          /* but TA1 <= 97 */

                          && (atr.ib[0][ATR_INTERFACE_BYTE_TA].value <= 0x97))

                     {

                          unsigned char old_TA1;

 

 

                          old_TA1 = atr.ib[0][ATR_INTERFACE_BYTE_TA].value;

                          while (atr.ib[0][ATR_INTERFACE_BYTE_TA].value > 0x94)

                          {

                               /* use a lower TA1 */

                               atr.ib[0][ATR_INTERFACE_BYTE_TA].value--;

 

 

                               (void)ATR_GetParameter(&atr, ATR_PARAMETER_D, &d);

                               (void)ATR_GetParameter(&atr, ATR_PARAMETER_F, &f);

 

 

                               /* Baudrate = f x D/F */

                               card_baudrate = (unsigned int) (1000 *

                                     ccid_desc->dwDefaultClock * d / f);

 

 

                               /* the reader has a baud rate table */

                               if ((ccid_desc->arrayOfSupportedDataRates

                                     /* and the baud rate is supported */

                                     && find_baud_rate(card_baudrate,

                                    ccid_desc->arrayOfSupportedDataRates))

                                     /* or the reader has NO baud rate table */

                                     || ((NULL == ccid_desc->arrayOfSupportedDataRates)

                                     /* and the baud rate is bellow the limit */

                                     && (card_baudrate <= ccid_desc->dwMaxDataRate)))

                               {

                                     pps[1] |= 0x10; /* PTS1 presence */

                                     pps[2] = atr.ib[0][ATR_INTERFACE_BYTE_TA].value;

 

 

                                     DEBUG_COMM2("Set adapted speed to %d bauds",

                                          card_baudrate);

 

 

                                     break;

                               }

                          }

 

 

                          /* restore original TA1 value */

                          atr.ib[0][ATR_INTERFACE_BYTE_TA].value = old_TA1;

                     }

                }

          }

 

 

Thank you very much

 

 

 

De: Pcsclite-muscle [mailto:pcsclite-muscle-bounces+amacias=solutia-it.es at lists.alioth.debian.org] En nombre de Ludovic Rousseau
Enviado el: mi?rcoles, 5 de octubre de 2016 10:52
Para: Talks about MUSCLE <pcsclite-muscle at lists.alioth.debian.org>
Asunto: Re: [Pcsclite-muscle] Bug in CCID library

 

Hello,
Thanks Godfrey for pointing to your version of the driver. I found the patch in:
https://github.com/acshk/acsccid/commit/4a7631d014781d36a2d21210b0b8768c07ef8c6d

I propose a simpler version.
Abraham can you test with the attached patch?

Bye

 

2016-10-05 9:53 GMT+02:00 Abraham Macias Paredes <amacias at solutia-it.es <mailto:amacias at solutia-it.es> >:

Hi, my reader is not an ACS one, is a C3PO LTC31 v2.

You can see more details in http://pcsclite.alioth.debian.org/ccid/supported.html

 

 

Thanks Godfrey.

 

De: Pcsclite-muscle [mailto:pcsclite-muscle-bounces+amacias <mailto:pcsclite-muscle-bounces%2Bamacias> =solutia-it.es at lists.alioth.debian.org <mailto:solutia-it.es at lists.alioth.debian.org> ] En nombre de Godfrey Chung
Enviado el: mi?rcoles, 5 de octubre de 2016 9:27
Para: Talks about MUSCLE <pcsclite-muscle at lists.alioth.debian.org <mailto:pcsclite-muscle at lists.alioth.debian.org> >
Asunto: Re: [Pcsclite-muscle] Bug in CCID library

 

Hi Abraham

If you are using ACS readers, you can try acsccid driver and it already contains a fix for this issue.

 

On Wed, Oct 5, 2016 at 2:44 PM, Abraham Macias Paredes <amacias at solutia-it.es <mailto:amacias at solutia-it.es> > wrote:

 

But this sets the speed to 125000 bauds. How can I set the speed to 230400 bps (the reader maximum data rate)?


It depends on F/D values from the card. It cannot be set 230400 bps directly.

 

Regards

Godfrey 


_______________________________________________
Pcsclite-muscle mailing list
Pcsclite-muscle at lists.alioth.debian.org <mailto:Pcsclite-muscle at lists.alioth.debian.org> 
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pcsclite-muscle




-- 

 Dr. Ludovic Rousseau

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pcsclite-muscle/attachments/20161005/23b77a7c/attachment-0001.html>



More information about the pcsclite-muscle mailing list