-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-pick PC/SC-Lite bugfix for unsupported commands (#361)
Cherry-pick the following commit from the upstream PC/SC-Lite repository, which fixes a 1.9.1 regression: 7730f6c54d7fb6a910d291e2d48c92d2a5abf688 SetProtocol: Handle IFD_NOT_SUPPORTED from the driver 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 5d58577093f56dbcfbf754940f885ed8fcdba206. Thanks to Godfrey Chung for the bug report "pcsc-lite 1.9.1: memory card connection failed #103"
- Loading branch information
1 parent
4bcac7c
commit 0bbc29e
Showing
3 changed files
with
69 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
third_party/pcsc-lite/patches/0001-Fix-IFD_NOT_SUPPORTED.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
From 7730f6c54d7fb6a910d291e2d48c92d2a5abf688 Mon Sep 17 00:00:00 2001 | ||
From: Ludovic Rousseau <[email protected]> | ||
Date: Thu, 17 Jun 2021 10:48:40 +0200 | ||
Subject: [PATCH] SetProtocol: Handle IFD_NOT_SUPPORTED from the driver | ||
|
||
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 | ||
5d58577093f56dbcfbf754940f885ed8fcdba206. | ||
|
||
Thanks to Godfrey Chung for the bug report | ||
"pcsc-lite 1.9.1: memory card connection failed #103" | ||
https://github.com/LudovicRousseau/PCSC/issues/103 | ||
--- | ||
src/prothandler.c | 8 +++++++- | ||
1 file changed, 7 insertions(+), 1 deletion(-) | ||
|
||
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); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters