[Pcsclite-git-commit] [CCID] 01/01: OpenUSBByName(): the device bus & addr must match

Ludovic Rousseau rousseau at moszumanska.debian.org
Thu Feb 16 16:18:01 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 8c57dcc5f73009359dcdaa0decba7f703172e9df
Author: Ludovic Rousseau <ludovic.rousseau at free.fr>
Date:   Thu Feb 16 17:14:14 2017 +0100

    OpenUSBByName(): the device bus & addr must match
    
    Patch similar to 8b9f6f33b16e808a5769dbc4193e5f107a09a693 but for
    libusb-1.0 instead of libudev.
    
    "In Linux, before this change, if there were multiple card readers of
    the same model connected, a new Reader could be initialized by opening
    the wrong USB device."
    
    Thanks to Maximilian Stein for the patch
    "[Pcsclite-muscle] Apply fix "OpenUSBByName(): the device bus & addr
    must match" (8b9f6f33) for libusb"
    https://lists.alioth.debian.org/pipermail/pcsclite-muscle/Week-of-Mon-20170213/000812.html
---
 src/ccid_usb.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/ccid_usb.c b/src/ccid_usb.c
index 1598f9e..d5c4a44 100644
--- a/src/ccid_usb.c
+++ b/src/ccid_usb.c
@@ -270,6 +270,21 @@ status_t OpenUSBByName(unsigned int reader_index, /*@null@*/ char *device)
 				DEBUG_COMM3("usb bus/device: %d/%d", device_bus, device_addr);
 			}
 		}
+		else
+		{
+			/* format usb:%04x/%04x:libusb-1.0:%d:%d:%d */
+			if ((dirname = strstr(device, "libusb-1.0:")) != NULL)
+			{
+				/* convert the interface number, bus and device ids */
+				if (sscanf(dirname + 11, "%d:%d:%d",
+					&device_bus, &device_addr, &interface_number) == 3)
+				{
+					DEBUG_COMM2("interface_number: %d", interface_number);
+					DEBUG_COMM3("usb bus/device: %d/%d", device_bus,
+						device_addr);
+				}
+			}
+		}
 	}
 #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