Le mercredi 04 mai 2011 à 11:13 +0200, Jean-Michel Pouré - GOOZE a
écrit :
> Any comments on this patch?
Let us discuss this patch (and maybe find a better one):
1) What happens in current libccid
ifhandler.c, lines 807 and further
*************************
/* if the card does not try to lower the default speed */
if ((card_baudrate > default_baudrate)
/* and the reader is fast enough */
&& (card_baudrate <= ccid_desc->dwMaxDataRate))
{
/* the reader has no baud rates table */
if ((NULL == ccid_desc->arrayOfSupportedDataRates)
/* or explicitely support it */
|| find_baud_rate(card_baudrate,
ccid_desc->arrayOfSupportedDataRates)
*************************
When connecting to smartcard, libccid will compare:
* card_baudrate the speed of card.
* ccid_desc->dwMaxDataRate the maximum speed of smartcard.
If card_baudrate is inferior to ccid_desc->dwMaxDataRate, libccid will
look for a rate matrix and use the best speed. If there is no speed
matrix, it will assume that smartcard reader can connect at
card_baudrate.
Some readers announce to be able to set speed automatically:
dwFeatures: 20 Automatic baud rate change according to frequency and Fi,
Di
But ccid_desc->arrayOfSupportedDataRates is not null
Example:
http://pcsclite.alioth.debian.org/ccid/readers/Feitian_SCR310.txt
****
dwDataRate: 10752 bps
dwMaxDataRate: 600000 bps
bNumDataRatesSupported: 0 (will use whatever is returned)
Support 10752 bps
*****
Is this case, the reader speed is limited to 10752 bps.
2) A possible solution
We added a test on ccid_desc->dwFeatures & CCID_CLASS_AUTO_BAUD
/* sartcard reader supports auto baud */
|| (ccid_desc->dwFeatures & CCID_CLASS_AUTO_BAUD))
If a reader is able to set baud rate automatically,
we assume it can connect at card speed.
3) A better patch
My knowledge in libccid is small.
Please help if you know a better patch.
Kind regards,
--
Jean-Michel Pouré - Gooze - http://www.gooze.eu
_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle