Skip to content

Commit

Permalink
Hack for AlcorMicro AU9560 and Acos-ID card
Browse files Browse the repository at this point in the history
Perform a double reset cold + hot so that the Acos-ID card uses a lower
communication speed.

The cold ATR of this card is:
3B DF 96 FF 91 01 31 FE 46 80 31 90 52 41 02 64 05 02 00 AC 73 D6 22 C0 17
While the hot ATR is:
3B DF 18 FF 91 01 31 FE 46 80 31 90 52 41 02 64 05 02 00 AC 73 D6 22 C0 99

Note how TA1 changed from 0x96 (250000 bits/s at 4 MHz) to 0x18
(129032 bits/s at 4.00 MHz).

The pcscd trace is:
00000002 [] ifdhandler.c:926:IFDHSetProtocolParameters() Set adapted speed to 115625 bauds
00000003 [] ifdhandler.c:1039:IFDHSetProtocolParameters() BWI/CWI (TB3) present: 0x46
00000002 [] ifdhandler.c:1074:IFDHSetProtocolParameters() IFSC (TA3) present: 254
00000002 [] ifdhandler.c:1078:IFDHSetProtocolParameters() Timeout: 2928 ms
00000003 [] commands.c:2324:SetParameters() length: 7 bytes
00000006 [] -> 000000 61 07 00 00 00 00 0D 01 00 00 95 10 FF 46 00 FE 00
02267701 [] <- 000000 82 00 00 00 00 00 0D 41 FE 00
00000021 [] commands.c:2351:SetParameters Card absent or mute
00000011 [] ifdhandler.c:1246:IFDHPowerICC() action: Reset, usb:058f/9540:libudev:0:/dev/bus/usb/003/003 (lun: 0)
00000006 [] -> 000000 62 00 00 00 00 00 0E 00 00 00
00194208 [] <- 000000 80 19 00 00 00 00 0E 00 00 00 3B DF 96 FF 91 01 31 FE 46 80 31 90 52 41 02 64 05 02 00 AC 73 D6 22 C0 17
00000025 [] ifdhandler.c:1246:IFDHPowerICC() action: Reset, usb:058f/9540:libudev:0:/dev/bus/usb/003/003 (lun: 0)
00000007 [] -> 000000 62 00 00 00 00 00 0F 00 00 00
00056894 [] <- 000000 80 19 00 00 00 00 0F 00 00 00 3B DF 18 FF 91 01 31 FE 46 80 31 90 52 41 02 64 05 02 00 AC 73 D6 22 C0 99
00000022 [] winscard.c:430:SCardConnect() Active Protocol: T=1
  • Loading branch information
LudovicRousseau committed Jan 25, 2023
1 parent 02f953b commit ae7e716
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/ifdhandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -1093,6 +1093,12 @@ EXTERNAL RESPONSECODE IFDHSetProtocolParameters(DWORD Lun, DWORD Protocol,
DWORD atr2length;
RESPONSECODE ret2;

/* 1st (cold?) reset */
ret2 = IFDHPowerICC(Lun, IFD_RESET, atr2, &atr2length);
if (IFD_SUCCESS != ret2)
return ret;

/* hot reset */
ret2 = IFDHPowerICC(Lun, IFD_RESET, atr2, &atr2length);
if (IFD_SUCCESS != ret2)
return ret;
Expand Down

0 comments on commit ae7e716

Please sign in to comment.