[Pcsclite-muscle] [PATCH ccid]: Improve the recent fix for getting the number of supported data rates

Guido Trentalancia guido at trentalancia.com
Thu Apr 8 21:36:28 BST 2021


Improve the following two recent fixes to get the number of supported data rates:

commit b00292f718e9f13626147af63bfb9164ec74d2cb
Author: Ludovic Rousseau <ludovic.rousseau at free.fr>
Date:   Sat Mar 27 18:46:15 2021 +0100

    ccid_usb: ask for bNumDataRatesSupported data rates
    
    Some devices set bNumDataRatesSupported to a value different from 0 but
    libusb_control_transfer() fails if another value (like 256) is used.
    
    The Alcor Micro 9540 is such a reader.

commit 19b9e9256781b55513e22e8ecd9c85ad409e9069 (HEAD -> master, origin/master, origin/HEAD)
Author: Ludovic Rousseau <ludovic.rousseau at free.fr>
Date:   Sun Apr 4 19:04:10 2021 +0200

    get_data_rates(): fix bug if bNumDataRatesSupported > 0
    
    The bug was introduced in b00292f718e9f13626147af63bfb9164ec74d2cb (not
    released in a stable version)
    
    Thanks to Godfrey Chung got the bug report
    https://github.com/LudovicRousseau/CCID/commit/b00292f718e9f13626147af63bfb9164ec74d2cb#r49087277

-------

These fixes seem also needed on the following reader: Bit4Id miniLector AIR NFC v3 (25DD:3403).

Signed-off-by: Guido Trentalancia <guido at trentalancia.com>

diff -pru ccid-1.4.34-to-git-08042021-0700/src/parse.c ccid-git-08042021-0700/src/parse.c
--- ccid-1.4.34-to-git-08042021-0700/src/parse.c	2021-04-08 21:51:23.354942352 +0200
+++ ccid-git-08042021-0700/src/parse.c	2021-04-08 06:55:26.700371266 +0200
@@ -501,15 +496,15 @@ static int ccid_parse_interface_descript
 				int i;
 
 				/* we do not get the expected number of data rates */
-				if ((n != bNumDataRatesSupported*4) && bNumDataRatesSupported)
+				if ((n != device_descriptor[27]*4) && device_descriptor[27])
 				{
 					(void)printf("   Got %d data rates but was expecting %d\n", n/4,
-						bNumDataRatesSupported);
+						device_descriptor[27]);
 
 					/* we got more data than expected */
 #ifndef DISPLAY_EXTRA_VALUES
-					if (n > bNumDataRatesSupported*4)
-						n = bNumDataRatesSupported*4;
+					if (n > device_descriptor[27]*4)
+						n = device_descriptor[27]*4;
 #endif
 				}
 



More information about the pcsclite-muscle mailing list