pcsc-lite-ccid/SOURCES/0001-Alcor-Micro-AU9560-Remove-high-speeds.patch

225 lines
14 KiB
Diff
Raw Permalink Normal View History

From c81c512ba7159ad35a41deaf4d294ee4cc399920 Mon Sep 17 00:00:00 2001
From: Ludovic Rousseau <ludovic.rousseau@free.fr>
Date: Tue, 22 Nov 2022 17:56:47 +0100
Subject: [PATCH] Alcor Micro AU9560: Remove high speeds
The reader does NOT support high speeds even if it declares so.
We remove all baud rates higher than 200000.
00000026 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 1807 bps
00000005 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 1989 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 2409 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 2487 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 3315 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 3613 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 3978 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 4818 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 4973 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 6631 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 7227 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 7957 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 9635 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 9946 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 13262 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 14453 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 15914 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 19271 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 19892 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 21680 bps
00000007 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 23871 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 26523 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 28906 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 29839 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 31828 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 36133 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 38542 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 39785 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 43359 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 48177 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 49731 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 53047 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 57813 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 59677 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 63656 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 66308 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 72266 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 77083 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 79570 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 86719 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 96354 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 99462 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 106093 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 115625 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 119355 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 132616 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 144531 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 154167 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 159140 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 198925 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 212186 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 231250 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 318280 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 2344 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 2581 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 3125 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 3226 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 4301 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 4688 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 5161 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 5859 bps
00000007 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 6250 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 6452 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 7813 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 8065 bps
00000009 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 8602 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 9375 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 10323 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 10753 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 11719 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 12500 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 12903 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 15625 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 16129 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 17204 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 18750 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 20645 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 21505 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 23438 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 25000 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 25806 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 28125 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 30968 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 31250 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 32258 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 34409 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 37500 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 38710 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 41290 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 43011 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 46875 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 50000 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 51613 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 56250 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 62500 bps
00000005 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 64516 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 68817 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 70313 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 75000 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 77419 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 82581 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 86022 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 93750 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 96774 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 100000 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 103226 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 112500 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 117188 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 125000 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 127312 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 129032 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 137634 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 150000 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 156250 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 161290 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 165161 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 172043 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 187500 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 200000 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 206452 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 215054 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 250000 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 258065 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 275269 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 300000 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 308333 bps
00000005 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 344086 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 375000 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 400000 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 412903 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 424373 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 462500 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 500000 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 516129 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 550538 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 600000 bps
00000003 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 636559 bps
00000002 [140214768158720] ccid_usb.c:1412:get_data_rates() declared: 688172 bps
00001534 [140214768158720] ccid.c:117:ccid_open_hack_pre() Remove baudrate: 212186
00000015 [140214768158720] ccid.c:117:ccid_open_hack_pre() Remove baudrate: 231250
00000004 [140214768158720] ccid.c:117:ccid_open_hack_pre() Remove baudrate: 318280
00000003 [140214768158720] ccid.c:117:ccid_open_hack_pre() Remove baudrate: 206452
00000002 [140214768158720] ccid.c:117:ccid_open_hack_pre() Remove baudrate: 215054
00000003 [140214768158720] ccid.c:117:ccid_open_hack_pre() Remove baudrate: 250000
00000002 [140214768158720] ccid.c:117:ccid_open_hack_pre() Remove baudrate: 258065
00000002 [140214768158720] ccid.c:117:ccid_open_hack_pre() Remove baudrate: 275269
00000003 [140214768158720] ccid.c:117:ccid_open_hack_pre() Remove baudrate: 300000
00000002 [140214768158720] ccid.c:117:ccid_open_hack_pre() Remove baudrate: 308333
00000002 [140214768158720] ccid.c:117:ccid_open_hack_pre() Remove baudrate: 344086
00000002 [140214768158720] ccid.c:117:ccid_open_hack_pre() Remove baudrate: 375000
00000003 [140214768158720] ccid.c:117:ccid_open_hack_pre() Remove baudrate: 400000
00000002 [140214768158720] ccid.c:117:ccid_open_hack_pre() Remove baudrate: 412903
00000003 [140214768158720] ccid.c:117:ccid_open_hack_pre() Remove baudrate: 424373
00000002 [140214768158720] ccid.c:117:ccid_open_hack_pre() Remove baudrate: 462500
00000003 [140214768158720] ccid.c:117:ccid_open_hack_pre() Remove baudrate: 500000
00000002 [140214768158720] ccid.c:117:ccid_open_hack_pre() Remove baudrate: 516129
00000002 [140214768158720] ccid.c:117:ccid_open_hack_pre() Remove baudrate: 550538
00000005 [140214768158720] ccid.c:117:ccid_open_hack_pre() Remove baudrate: 600000
00000003 [140214768158720] ccid.c:117:ccid_open_hack_pre() Remove baudrate: 636559
00000002 [140214768158720] ccid.c:117:ccid_open_hack_pre() Remove baudrate: 688172
Cards with TA1=0x96 or 0x97 are now working with this reader after
negotiating a lower speed.
---
src/ccid.c | 24 ++++++++++++++++++++++++
src/ccid.h | 1 +
2 files changed, 25 insertions(+)
diff --git a/src/ccid.c b/src/ccid.c
index 8cc5832..e1711db 100644
--- a/src/ccid.c
+++ b/src/ccid.c
@@ -110,6 +110,30 @@ int ccid_open_hack_pre(unsigned int reader_index)
/* The SCM SCL011 reader needs 350 ms to answer */
ccid_descriptor->readTimeout = DEFAULT_COM_READ_TIMEOUT * 4;
break;
+
+ case ALCORMICRO_AU9540:
+ unsigned int *uint_array = ccid_descriptor->arrayOfSupportedDataRates;
+ unsigned int max_speed = 200000;
+ unsigned int *after, current_speed;
+
+ /* keep in the list only the baud rates lower than max_speed */
+ after = uint_array;
+ while ((current_speed = *uint_array++) != 0)
+ {
+ if (current_speed > max_speed)
+ {
+ DEBUG_INFO2("Remove baudrate: %d", current_speed);
+ continue;
+ }
+
+ *after++ = current_speed;
+ }
+ /* terminate the (new) list */
+ *after = 0;
+
+ /* update the max data rate with the new value */
+ ccid_descriptor->dwMaxDataRate = max_speed;
+ break;
}
/* CCID */
diff --git a/src/ccid.h b/src/ccid.h
index 0b2bb09..aadc0a8 100644
--- a/src/ccid.h
+++ b/src/ccid.h
@@ -244,6 +244,7 @@ typedef struct
#define IDENTIV_uTrust4701F 0x04E65724
#define BIT4ID_MINILECTOR 0x25DD3111
#define SAFENET_ETOKEN_5100 0x05290620
+#define ALCORMICRO_AU9540 0x058f9540
#define VENDOR_GEMALTO 0x08E6
#define GET_VENDOR(readerID) ((readerID >> 16) & 0xFFFF)