[Pcsclite-git-commit] [CCID] 01/03: OpenUSBByName(): simplify USE_COMPOSITE_AS_MULTISLOT code

Ludovic Rousseau rousseau at moszumanska.debian.org
Sun Mar 12 15:00:58 UTC 2017


This is an automated email from the git hooks/post-receive script.

rousseau pushed a commit to branch master
in repository CCID.

commit 4349e40dd8c2e37a19f2b85b59b98b4ec584695e
Author: Ludovic Rousseau <ludovic.rousseau at free.fr>
Date:   Fri Mar 10 17:58:55 2017 +0100

    OpenUSBByName(): simplify USE_COMPOSITE_AS_MULTISLOT code
    
    The code do not hardcode the interface number of the first CCID interface.
    The first CCID interface found will be used on the first call.
    
    The code to reset the interface number for the next reader is then much
    simpler: set to -1.
---
 src/ccid_usb.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/ccid_usb.c b/src/ccid_usb.c
index d5c4a44..9c50583 100644
--- a/src/ccid_usb.c
+++ b/src/ccid_usb.c
@@ -425,7 +425,8 @@ again_libusb:
 				int readerID = (vendorID << 16) + productID;
 
 #ifdef USE_COMPOSITE_AS_MULTISLOT
-				static int static_interface = 1;
+				/* use the first CCID interface on first call */
+				static int static_interface = -1;
 
 				/* simulate a composite device as when libudev is used */
 				if ((GEMALTOPROXDU == readerID)
@@ -660,11 +661,12 @@ again:
 					|| (FEITIANR502DUAL == readerID))
 				{
 					/* use the next interface for the next "slot" */
-					static_interface++;
+					static_interface = interface + 1;
 
 					/* reset for a next reader */
+					/* max interface number for all 3 readers is 2 */
 					if (static_interface > 2)
-						static_interface = (FEITIANR502DUAL == readerID) ? 0: 1;
+						static_interface = -1;
 				}
 #endif
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pcsclite/CCID.git



More information about the Pcsclite-cvs-commit mailing list