Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pcsc-lite 1.9.1: memory card connection failed #103

Closed
godfreychung opened this issue Jun 11, 2021 · 9 comments
Closed

pcsc-lite 1.9.1: memory card connection failed #103

godfreychung opened this issue Jun 11, 2021 · 9 comments

Comments

@godfreychung
Copy link

I was using ACR38U CCID reader and found that the program cannot connect memory card on Debian 11.

Here is the log:

Debian 11
pcsc-lite 1.9.1
ccid 1.4.34

00000006 [139630460532480] winscard.c:258:SCardConnect() Attempting Connect to ACS ACR 38U-CCID 00 00 using protocol: 3
00000018 [139630460532480] readerfactory.c:825:RFReaderInfo() RefReader() count was: 1
00884720 [139630460532480] ifdhandler.c:1183:IFDHPowerICC() action: PowerUp, usb:072f/90cc:libudev:0:/dev/bus/usb/002/004 (lun: 0)
00000041 [139630460532480] -> 000000 62 00 00 00 00 00 18 01 00 00
00126781 [139630460532480] <- 000000 80 06 00 00 00 00 18 00 00 00 3B 04 17 04 FF FF
00000043 [139630460532480] winscard.c:332:SCardConnect() power up complete.
00000014 [139630460532480] Card ATR: 3B 04 17 04 FF FF
00000012 [139630460532480] winscard.c:352:SCardConnect() powerState: POWER_STATE_IN_USE
00000012 [139630460532480] prothandler.c:107:PHSetProtocol() Attempting PTS to T=0
00000013 [139630460532480] ifdhandler.c:715:IFDHSetProtocolParameters() protocol T=0, usb:072f/90cc:libudev:0:/dev/bus/usb/002/004 (lun: 0)
00000014 [139630460532480] towitoko/atr.c:357:ATR_GetDefaultProtocol() no default protocol found in ATR. Using T=0
00000012 [139630460532480] ifdhandler.c:1088:IFDHSetProtocolParameters() Communication timeout: 232133 ms
00000012 [139630460532480] commands.c:2286:SetParameters() length: 5 bytes
00000016 [139630460532480] -> 000000 61 05 00 00 00 00 19 00 00 00 11 00 00 0A 00
00006922 [139630460532480] <- 000000 82 00 00 00 00 00 19 40 00 00
00000028 [139630460532480] commands.c:2312:SetParameters Command not supported or not allowed
00000014 [139630460532480] prothandler.c:129:PHSetProtocol() PTS protocol failed (614)
00000012 [139630460532480] winscard.c:518:SCardConnect() UnrefReader() count was: 2
00000013 [139630460532480] winscard_svc.c:519:ContextThread() CONNECT rv=0x80100066 for client 12

Debian 10
pcsc-lite 1.8.24
ccid 1.4.30

00000092 winscard.c:259:SCardConnect() Attempting Connect to ACS ACR 38U-CCID 00 00 using protocol: 3
00000094 readerfactory.c:821:RFReaderInfo() RefReader() count was: 1
00098566 ifdhandler.c:1154:IFDHPowerICC() action: PowerUp, usb:072f/90cc:libudev:0:/dev/bus/usb/002/004 (lun: 0)
00000474 -> 000000 62 00 00 00 00 00 0C 01 00 00
00126824 <- 000000 80 06 00 00 00 00 0C 00 00 00 3B 04 17 04 FF FF
00000389 winscard.c:332:SCardConnect() power up complete.
00000163 Card ATR: 3B 04 17 04 FF FF
00000147 winscard.c:352:SCardConnect() powerState: POWER_STATE_IN_USE
00000149 prothandler.c:108:PHSetProtocol() Attempting PTS to T=0
00000429 ifdhandler.c:695:IFDHSetProtocolParameters() protocol T=0, usb:072f/90cc:libudev:0:/dev/bus/usb/002/004 (lun: 0)
00000161 towitoko/atr.c:357:ATR_GetDefaultProtocol() no default protocol found in ATR. Using T=0
00000150 ifdhandler.c:1058:IFDHSetProtocolParameters() Communication timeout: 232133 ms
00000491 commands.c:2254:SetParameters() length: 5 bytes
00000164 -> 000000 61 05 00 00 00 00 0D 00 00 00 11 00 00 0A 00
00007195 <- 000000 82 00 00 00 00 00 0D 40 00 00
00000322 commands.c:2280:SetParameters Command not supported or not allowed
00000162 prothandler.c:116:PHSetProtocol() PTS not supported by driver, using T=0
00000149 winscard.c:431:SCardConnect() Active Protocol: T=0
00000150 winscard.c:456:SCardConnect() hCard Identity: 2fe15700
00000147 winscard.c:518:SCardConnect() UnrefReader() count was: 2
00000149 winscard_svc.c:511:ContextThread() CONNECT rv=0x0 for client 14

You will see that pcsc-lite 1.9.1 prints different log message.

pcsc-lite 1.9.1

00000014 [139630460532480] prothandler.c:129:PHSetProtocol() PTS protocol failed (614)

pcsc-lite 1.8.24

00000162 prothandler.c:116:PHSetProtocol() PTS not supported by driver, using T=0

According to the log message, it seems that the commit 5d58577 changes the way to validate the result.

@LudovicRousseau
Copy link
Owner

Can you reconfigure pcsc-lite using --enable-debugatr, rebuild and generate a new trace on Debian 11?

@godfreychung
Copy link
Author

Here is the updated log:

00000009 [140676732811008] winscard.c:258:SCardConnect() Attempting Connect to ACS ACR 38U-CCID 00 00 using protocol: 3
00000013 [140676732811008] readerfactory.c:825:RFReaderInfo() RefReader() count was: 1
00649527 [140676732811008] ifdhandler.c:1183:IFDHPowerICC() action: PowerUp, usb:072f/90cc:libudev:0:/dev/bus/usb/002/004 (lun: 0)
00000028 [140676732811008] -> 000000 62 00 00 00 00 00 0C 01 00 00
00126755 [140676732811008] <- 000000 80 06 00 00 00 00 0C 00 00 00 3B 04 17 04 FF FF
00000024 [140676732811008] winscard.c:332:SCardConnect() power up complete.
00000005 [140676732811008] Card ATR: 3B 04 17 04 FF FF
00000004 [140676732811008] winscard.c:352:SCardConnect() powerState: POWER_STATE_IN_USE
00000004 [140676732811008] ATR: 3B 04 17 04 FF FF
00000005 [140676732811008] atrhandler.c:122:ATRDecodeAtr() TA1: FFFFFFFF, TB1: FFFFFFFF, TC1: FFFFFFFF, TD1: FFFFFFFF
00000004 [140676732811008] atrhandler.c:221:ATRDecodeAtr() CurrentProtocol: T=0, AvailableProtocols: 1
00000004 [140676732811008] prothandler.c:107:PHSetProtocol() Attempting PTS to T=0
00000006 [140676732811008] ifdhandler.c:715:IFDHSetProtocolParameters() protocol T=0, usb:072f/90cc:libudev:0:/dev/bus/usb/002/004 (lun: 0)
00000005 [140676732811008] towitoko/atr.c:357:ATR_GetDefaultProtocol() no default protocol found in ATR. Using T=0
00000004 [140676732811008] ifdhandler.c:1088:IFDHSetProtocolParameters() Communication timeout: 232133 ms
00000005 [140676732811008] commands.c:2286:SetParameters() length: 5 bytes
00000005 [140676732811008] -> 000000 61 05 00 00 00 00 0D 00 00 00 11 00 00 0A 00
00005125 [140676732811008] <- 000000 82 00 00 00 00 00 0D 40 00 00
00000016 [140676732811008] commands.c:2312:SetParameters Command not supported or not allowed
00000006 [140676732811008] prothandler.c:129:PHSetProtocol() PTS protocol failed (614)
00000005 [140676732811008] winscard.c:518:SCardConnect() UnrefReader() count was: 2
00000006 [140676732811008] winscard_svc.c:519:ContextThread() CONNECT rv=0x80100066 for client 12

@LudovicRousseau
Copy link
Owner

The card is T=0, the reader works with T=0, the application is requesting T=1 or T=0.
So T=0 is selected by pcsc-lite.
But the SetParameters call for T=0 fails: Command not supported or not allowed

I don't think that is a bug in pcsc-lite. Or I don't know what I could do.
The previous behaviour of pcsc-lite was incorrect as an error from the driver was ignored.

What I propose: in the ACS driver, you add a special case for memory cards and return IFD_SUCCESS instead of IFD_NOT_SUPPORTED for SetParameters() https://github.com/godfreychung/CCID/blob/master/src/commands.c#L2307

@godfreychung
Copy link
Author

I ran pcsctest on macOS with default ccid driver.

Here is the log:

macOS 11.4
ccid 1.4.32

info	10:23:34.515346+0800	com.apple.ifdreader	ACS ACR 38U-CCID: card inserted
debug	10:23:34.515435+0800	com.apple.ifdreader	ACS ACR 38U-CCID: card reset
debug	10:23:34.515552+0800	com.apple.ifdreader	ACS ACR 38U-CCID: broadcasting state change {    power = 0;    prevstate = 1;    share = 0;    state = 2;}
debug	10:23:34.516340+0800	com.apple.ifdbundle	-> IFDHPowerICC(00000000, action=502)
debug	10:23:34.640168+0800	com.apple.ifdbundle	<- IFDHPowerICC(atr={length = 6, bytes = 0x3b041704ffff}) = 0
debug	10:23:34.640434+0800	com.apple.ifdreader	ACS ACR 38U-CCID: card reset done -> <TKSmartCardATR: 0x7fc8d0a0fb40 3b ---;1704ffff>
debug	10:23:34.640554+0800	com.apple.ifdreader	ACS ACR 38U-CCID: broadcasting state change {    atr = {length = 6, bytes = 0x3b041704ffff};    power = 1;    prevstate = 2;    share = 0;    state = 4;}
debug	10:23:34.649321+0800	com.apple.ifdreader	ACS ACR 38U-CCID: connectCardSession:proto=0001, sensitive=0
debug	10:23:34.649349+0800	com.apple.ifdreader	ACS ACR 38U-CCID: connect:_state=4,_power=1,_proto=0
debug	10:23:34.649367+0800	com.apple.ifdreader	ACS ACR 38U-CCID: set protocol 0001
debug	10:23:34.649451+0800	com.apple.ifdbundle	-> IFDHSetProtocolParameters(00000000, proto=00000001)
debug	10:23:34.650065+0800	com.apple.ifdbundle	<- IFDHSetProtocolParameters() = 614
info	10:23:34.650122+0800	com.apple.ifdreader	PTS not supported, default protocol 1 selected
debug	10:23:34.650156+0800	com.apple.ifdreader	chosen proto 1 (mask: 1, protos (
    1
))
debug	10:23:34.650173+0800	com.apple.ifdreader	ACS ACR 38U-CCID: used protocol 0001
debug	10:23:34.650214+0800	com.apple.ifdreader	ACS ACR 38U-CCID: broadcasting state change {    atr = {length = 6, bytes = 0x3b041704ffff};    power = 2;    prevstate = 4;    share = 0;    state = 4;}
debug	10:23:34.650263+0800	com.apple.ifdreader	ACS ACR 38U-CCID: connectCardSession did only PPS
debug	10:23:34.650731+0800	com.apple.ifdbundle	-> IFDHTransmitICC(00000000, proto=0, in=<private>)
debug	10:23:35.723030+0800	com.apple.ifdbundle	<- IFDHTransmitICC(out=(null)) = 612
error	10:23:35.724355+0800	com.apple.ifdreader	<private>: failed to transmit APDU
debug	10:23:35.725040+0800	com.apple.ifdreader	ACS ACR 38U-CCID: leaving session, policyLeave
debug	10:23:40.762794+0800	com.apple.ifdreader	ACS ACR 38U-CCID: going to idle-unpower card
debug	10:23:40.762872+0800	com.apple.ifdreader	ACS ACR 38U-CCID: unpowerCard(eject=0)
debug	10:23:40.763073+0800	com.apple.ifdbundle	-> IFDHPowerICC(00000000, action=501)
debug	10:23:40.861124+0800	com.apple.ifdbundle	<- IFDHPowerICC(atr=(null)) = 0
debug	10:23:40.861332+0800	com.apple.ifdreader	ACS ACR 38U-CCID: unpower done (1)
debug	10:23:40.861449+0800	com.apple.ifdreader	ACS ACR 38U-CCID: broadcasting state change {    atr = {length = 6, bytes = 0x3b041704ffff};    power = 0;    prevstate = 4;    share = 0;    state = 4;}
debug	10:23:49.000482+0800	com.apple.ifdreader	ACS ACR 38U-CCID: new client connection established
debug	10:23:49.000595+0800	com.apple.ifdreader	ACS ACR 38U-CCID: slot was set up
debug	10:23:49.001804+0800	com.apple.ifdreader	ACS ACR 38U-CCID: new client connection established
debug	10:23:49.001895+0800	com.apple.ifdreader	ACS ACR 38U-CCID: slot was set up
debug	10:23:49.002536+0800	com.apple.ifdreader	ACS ACR 38U-CCID: broadcasting state change {    atr = {length = 6, bytes = 0x3b041704ffff};    power = 0;    prevstate = 4;    share = 1;    state = 4;}
debug	10:23:49.002723+0800	com.apple.ifdreader	ACS ACR 38U-CCID: connectCardSession:proto=0003, sensitive=0
debug	10:23:49.002753+0800	com.apple.ifdreader	ACS ACR 38U-CCID: connect:_state=4,_power=0,_proto=1
debug	10:23:49.002773+0800	com.apple.ifdreader	ACS ACR 38U-CCID: card reset
debug	10:23:49.002823+0800	com.apple.ifdreader	ACS ACR 38U-CCID: broadcasting state change {    atr = {length = 6, bytes = 0x3b041704ffff};    power = 0;    prevstate = 4;    share = 1;    state = 2;}
debug	10:23:49.002968+0800	com.apple.ifdbundle	-> IFDHPowerICC(00000000, action=502)
debug	10:23:49.126878+0800	com.apple.ifdbundle	<- IFDHPowerICC(atr={length = 6, bytes = 0x3b041704ffff}) = 0
debug	10:23:49.127099+0800	com.apple.ifdreader	ACS ACR 38U-CCID: card reset done -> <TKSmartCardATR: 0x7fc8cef05590 3b ---;1704ffff>
debug	10:23:49.127223+0800	com.apple.ifdreader	ACS ACR 38U-CCID: broadcasting state change {    atr = {length = 6, bytes = 0x3b041704ffff};    power = 1;    prevstate = 2;    share = 1;    state = 4;}
debug	10:23:49.127378+0800	com.apple.ifdreader	ACS ACR 38U-CCID: set protocol 0003
debug	10:23:49.127542+0800	com.apple.ifdbundle	-> IFDHSetProtocolParameters(00000000, proto=00000001)
debug	10:23:49.128295+0800	com.apple.ifdbundle	<- IFDHSetProtocolParameters() = 614
info	10:23:49.128482+0800	com.apple.ifdreader	PTS not supported, default protocol 1 selected
debug	10:23:49.128566+0800	com.apple.ifdreader	chosen proto 1 (mask: 3, protos (
    1
))
debug	10:23:49.128606+0800	com.apple.ifdreader	ACS ACR 38U-CCID: used protocol 0001
debug	10:23:49.128695+0800	com.apple.ifdreader	ACS ACR 38U-CCID: broadcasting state change {    atr = {length = 6, bytes = 0x3b041704ffff};    power = 2;    prevstate = 4;    share = 1;    state = 4;}
debug	10:23:49.128844+0800	com.apple.ifdreader	ACS ACR 38U-CCID: connectCardSession did RESET & PPS
debug	10:23:49.130327+0800	com.apple.ifdreader	ACS ACR 38U-CCID: leaving session, policyPowerDown/Eject
debug	10:23:49.130367+0800	com.apple.ifdreader	ACS ACR 38U-CCID: unpowerCard(eject=0)
debug	10:23:49.130466+0800	com.apple.ifdbundle	-> IFDHPowerICC(00000000, action=501)
debug	10:23:49.228538+0800	com.apple.ifdbundle	<- IFDHPowerICC(atr=(null)) = 0
debug	10:23:49.228754+0800	com.apple.ifdreader	ACS ACR 38U-CCID: unpower done (1)
debug	10:23:49.228890+0800	com.apple.ifdreader	ACS ACR 38U-CCID: broadcasting state change {    atr = {length = 6, bytes = 0x3b041704ffff};    power = 0;    prevstate = 4;    share = 1;    state = 4;}
debug	10:23:49.229655+0800	com.apple.ifdreader	ACS ACR 38U-CCID: broadcasting state change {    atr = {length = 6, bytes = 0x3b041704ffff};    power = 0;    prevstate = 4;    share = 0;    state = 4;}
debug	10:23:50.360348+0800	com.apple.ifdreader	ACS ACR 38U-CCID: new client connection established
debug	10:23:50.360450+0800	com.apple.ifdreader	ACS ACR 38U-CCID: slot was set up
debug	10:23:50.361294+0800	com.apple.ifdreader	ACS ACR 38U-CCID: new client connection established
debug	10:23:50.361390+0800	com.apple.ifdreader	ACS ACR 38U-CCID: slot was set up
debug	10:23:50.361870+0800	com.apple.ifdreader	ACS ACR 38U-CCID: broadcasting state change {    atr = {length = 6, bytes = 0x3b041704ffff};    power = 0;    prevstate = 4;    share = 1;    state = 4;}
debug	10:23:50.362051+0800	com.apple.ifdreader	ACS ACR 38U-CCID: connectCardSession:proto=0003, sensitive=0
debug	10:23:50.362087+0800	com.apple.ifdreader	ACS ACR 38U-CCID: connect:_state=4,_power=0,_proto=1
debug	10:23:50.362129+0800	com.apple.ifdreader	ACS ACR 38U-CCID: card reset
debug	10:23:50.362329+0800	com.apple.ifdbundle	-> IFDHPowerICC(00000000, action=502)
debug	10:23:50.362176+0800	com.apple.ifdreader	ACS ACR 38U-CCID: broadcasting state change {    atr = {length = 6, bytes = 0x3b041704ffff};    power = 0;    prevstate = 4;    share = 1;    state = 2;}
debug	10:23:50.486017+0800	com.apple.ifdbundle	<- IFDHPowerICC(atr={length = 6, bytes = 0x3b041704ffff}) = 0
debug	10:23:50.486269+0800	com.apple.ifdreader	ACS ACR 38U-CCID: card reset done -> <TKSmartCardATR: 0x7fc8d0a0d350 3b ---;1704ffff>
debug	10:23:50.486427+0800	com.apple.ifdreader	ACS ACR 38U-CCID: broadcasting state change {    atr = {length = 6, bytes = 0x3b041704ffff};    power = 1;    prevstate = 2;    share = 1;    state = 4;}
debug	10:23:50.486589+0800	com.apple.ifdreader	ACS ACR 38U-CCID: set protocol 0003
debug	10:23:50.486752+0800	com.apple.ifdbundle	-> IFDHSetProtocolParameters(00000000, proto=00000001)
debug	10:23:50.487498+0800	com.apple.ifdbundle	<- IFDHSetProtocolParameters() = 614
info	10:23:50.487668+0800	com.apple.ifdreader	PTS not supported, default protocol 1 selected
debug	10:23:50.487742+0800	com.apple.ifdreader	chosen proto 1 (mask: 3, protos (
    1
))
debug	10:23:50.487780+0800	com.apple.ifdreader	ACS ACR 38U-CCID: used protocol 0001
debug	10:23:50.487864+0800	com.apple.ifdreader	ACS ACR 38U-CCID: broadcasting state change {    atr = {length = 6, bytes = 0x3b041704ffff};    power = 2;    prevstate = 4;    share = 1;    state = 4;}
debug	10:23:50.487998+0800	com.apple.ifdreader	ACS ACR 38U-CCID: connectCardSession did RESET & PPS
debug	10:23:50.489456+0800	com.apple.ifdreader	ACS ACR 38U-CCID: leaving session, policyPowerDown/Eject
debug	10:23:50.489495+0800	com.apple.ifdreader	ACS ACR 38U-CCID: unpowerCard(eject=0)
debug	10:23:50.489595+0800	com.apple.ifdbundle	-> IFDHPowerICC(00000000, action=501)
debug	10:23:50.587642+0800	com.apple.ifdbundle	<- IFDHPowerICC(atr=(null)) = 0
debug	10:23:50.587857+0800	com.apple.ifdreader	ACS ACR 38U-CCID: unpower done (1)
debug	10:23:50.587989+0800	com.apple.ifdreader	ACS ACR 38U-CCID: broadcasting state change {    atr = {length = 6, bytes = 0x3b041704ffff};    power = 0;    prevstate = 4;    share = 1;    state = 4;}
debug	10:23:50.588733+0800	com.apple.ifdreader	ACS ACR 38U-CCID: broadcasting state change {    atr = {length = 6, bytes = 0x3b041704ffff};    power = 0;    prevstate = 4;    share = 0;    state = 4;}

I found that ifdreader accepts the card and selects the default protocol if the driver returns IFD_NOT_SUPPORTED.

debug	10:23:49.127378+0800	com.apple.ifdreader	ACS ACR 38U-CCID: set protocol 0003
debug	10:23:49.127542+0800	com.apple.ifdbundle	-> IFDHSetProtocolParameters(00000000, proto=00000001)
debug	10:23:49.128295+0800	com.apple.ifdbundle	<- IFDHSetProtocolParameters() = 614
info	10:23:49.128482+0800	com.apple.ifdreader	PTS not supported, default protocol 1 selected
debug	10:23:49.128566+0800	com.apple.ifdreader	chosen proto 1 (mask: 3, protos (
    1
))
debug	10:23:49.128606+0800	com.apple.ifdreader	ACS ACR 38U-CCID: used protocol 0001

Is it a good approach to fix this issue?

@LudovicRousseau
Copy link
Owner

macOS has the same behaviour than pcsc-lite before the patch you mentioned.

If your driver wants to accept memory cards then IFDHSetProtocolParameters() shall not return an error. pcsc-lite will then be happy to use the card.

@godfreychung
Copy link
Author

It seems that pcsc-lite reserves IFD_NOT_SUPPORTED for special processing originally and ifdreader may learn from it.

Is there any reason to modify the original design?

@LudovicRousseau
Copy link
Owner

Good point.

Try with this patch:

diff --git a/src/prothandler.c b/src/prothandler.c
index 1e21264..56c00ea 100644
--- a/src/prothandler.c
+++ b/src/prothandler.c
@@ -114,9 +114,9 @@ DWORD PHSetProtocol(struct ReaderContext * rContext,
 			protocol = ucChosen;
 			break;
 
-		case IFD_NOT_SUPPORTED:
 		case IFD_PROTOCOL_NOT_SUPPORTED:
 		case IFD_ERROR_NOT_SUPPORTED:
+			/* protocol not supported */
 			if (protocol != dwPreferred)
 			{
 				Log3(PCSC_LOG_INFO,
@@ -131,6 +131,12 @@ DWORD PHSetProtocol(struct ReaderContext * rContext,
 			}
 			break;
 
+		case IFD_NOT_SUPPORTED:
+			/* command not supported */
+			Log3(PCSC_LOG_INFO, "Set PTS failed (%ld). Using T=%d", rv,
+				(SCARD_PROTOCOL_T0 == protocol) ? 0 : 1);
+			break;
+
 		default:
 			Log2(PCSC_LOG_INFO, "Set PTS failed (%ld)", rv); 

And tell me if it solved the problem.

@godfreychung
Copy link
Author

The patch fixes the issue. Thanks!

Here is the log:

00000043 [140577202460416] winscard.c:258:SCardConnect() Attempting Connect to ACS ACR 38U-CCID 00 00 using protocol: 3
00000014 [140577202460416] readerfactory.c:825:RFReaderInfo() RefReader() count was: 1
00106147 [140577202460416] ifdhandler.c:1183:IFDHPowerICC() action: PowerUp, usb:072f/90cc:libudev:0:/dev/bus/usb/001/004 (lun: 0)
00000066 [140577202460416] -> 000000 62 00 00 00 00 00 0C 01 00 00
00127306 [140577202460416] <- 000000 80 06 00 00 00 00 0C 00 00 00 3B 04 17 04 FF FF
00000062 [140577202460416] winscard.c:332:SCardConnect() power up complete.
00000005 [140577202460416] Card ATR: 3B 04 17 04 FF FF
00000004 [140577202460416] winscard.c:352:SCardConnect() powerState: POWER_STATE_IN_USE
00000009 [140577202460416] prothandler.c:107:PHSetProtocol() Attempting PTS to T=0
00000006 [140577202460416] ifdhandler.c:715:IFDHSetProtocolParameters() protocol T=0, usb:072f/90cc:libudev:0:/dev/bus/usb/001/004 (lun: 0)
00000007 [140577202460416] towitoko/atr.c:357:ATR_GetDefaultProtocol() no default protocol found in ATR. Using T=0
00000020 [140577202460416] ifdhandler.c:1088:IFDHSetProtocolParameters() Communication timeout: 232133 ms
00000006 [140577202460416] commands.c:2286:SetParameters() length: 5 bytes
00000007 [140577202460416] -> 000000 61 05 00 00 00 00 0D 00 00 00 11 00 00 0A 00
00005114 [140577202460416] <- 000000 82 00 00 00 00 00 0D 40 00 00
00000055 [140577202460416] commands.c:2312:SetParameters Command not supported or not allowed
00000015 [140577202460416] prothandler.c:136:PHSetProtocol() Set PTS failed (614). Using T=0
00000012 [140577202460416] winscard.c:430:SCardConnect() Active Protocol: T=0
00000014 [140577202460416] winscard.c:456:SCardConnect() hCard Identity: 258e25d7
00000014 [140577202460416] winscard.c:518:SCardConnect() UnrefReader() count was: 2
00000043 [140577202460416] winscard_svc.c:519:ContextThread() CONNECT rv=0x0 for client 12

LudovicRousseau added a commit that referenced this issue Jun 17, 2021
If the driver returns IFD_NOT_SUPPORTED from the function
IFDHSetProtocolParameters() it indicates the "command" is not supported.
It is different from IFD_PROTOCOL_NOT_SUPPORTED that indicates the
"prorocol" is not supported.

The problem was with a ACR38U CCID and a memory card. The
SetParameters() fails but the card can still be used using the default
protocol.

The behaviour is identical to what we had before the commit
5d58577.

Thanks to Godfrey Chung for the bug report
"pcsc-lite 1.9.1: memory card connection failed #103"
#103
@LudovicRousseau
Copy link
Owner

Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants