From f3346da032355e01bd746556cd15369ad2db6f9e Mon Sep 17 00:00:00 2001 From: eabdullin Date: Thu, 3 Aug 2023 12:03:50 +0300 Subject: [PATCH] - Apply 0001-Alcor-Micro-AU9560-Remove-high-speeds.patch --- ...lcor-Micro-AU9560-Remove-high-speeds.patch | 224 ++++++++++++++++++ SPECS/pcsc-lite-ccid.spec | 9 +- 2 files changed, 232 insertions(+), 1 deletion(-) create mode 100644 SOURCES/0001-Alcor-Micro-AU9560-Remove-high-speeds.patch diff --git a/SOURCES/0001-Alcor-Micro-AU9560-Remove-high-speeds.patch b/SOURCES/0001-Alcor-Micro-AU9560-Remove-high-speeds.patch new file mode 100644 index 0000000..09b5d19 --- /dev/null +++ b/SOURCES/0001-Alcor-Micro-AU9560-Remove-high-speeds.patch @@ -0,0 +1,224 @@ +From c81c512ba7159ad35a41deaf4d294ee4cc399920 Mon Sep 17 00:00:00 2001 +From: Ludovic Rousseau +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) diff --git a/SPECS/pcsc-lite-ccid.spec b/SPECS/pcsc-lite-ccid.spec index 89a026c..5ae6fb7 100644 --- a/SPECS/pcsc-lite-ccid.spec +++ b/SPECS/pcsc-lite-ccid.spec @@ -3,7 +3,7 @@ Name: pcsc-lite-ccid Version: 1.4.36 -Release: 1%{?dist} +Release: 2%{?dist}.alma Summary: Generic USB CCID smart card reader driver License: LGPLv2+ @@ -14,6 +14,9 @@ Source2: gpgkey-F5E11B9FFE911146F41D953D78A1B4DFE8F9C57E.gpg Patch0: ccid-1.4.26-omnikey-3121.patch Patch1: ccid-1.4.34-maxreaders.patch Patch2: ccid-1.4.36-etoken.patch +# Patch was taken from and modify for 1.4.36 +# https://salsa.debian.org/rousseau/CCID/-/commit/c81c512ba7159ad35a41deaf4d294ee4cc399920 +Patch1001: 0001-Alcor-Micro-AU9560-Remove-high-speeds.patch BuildRequires: make BuildRequires: perl-interpreter @@ -42,6 +45,7 @@ gpgv2 --keyring %{SOURCE2} %{SOURCE1} %{SOURCE0} %patch0 -p1 -b .omnikey %patch1 -p0 -b .maxreaders %patch2 -p1 -b .etoken +%patch1001 -p1 -b .alcor-micro %build %configure --enable-twinserial @@ -69,6 +73,9 @@ cp -p src/openct/LICENSE LICENSE.openct %changelog +* Thu Aug 03 2023 Eduard Abdullin - 1.4.36-2.alma +- Apply 0001-Alcor-Micro-AU9560-Remove-high-speeds.patch + * Thu Nov 18 2021 Jakub Jelen - 1.4.36-1 - Rebase to current version from Fedora (#2017830)