[Pcsclite-git-commit] [CCID] 01/04: OpenUSBByName(): use device bus and address only when available

Ludovic Rousseau rousseau at moszumanska.debian.org
Fri Nov 13 15:35:19 UTC 2015


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

rousseau pushed a commit to branch master
in repository CCID.

commit e46fa30ead3f1eff72769d70be6adf031fafe606
Author: Ludovic Rousseau <ludovic.rousseau at free.fr>
Date:   Fri Nov 13 11:48:07 2015 +0100

    OpenUSBByName(): use device bus and address only when available
    
    Use the device_bus and device_addr only if they have a value i.e. when
    libudev is used by pcscd.
    
    If pcsc-lite uses libusb instead of libudev for the hotplug mechanism
    the driver is called with device="usb:08e6/3437:libusb-1.0:1:10:0" and
    then device_bus and device_addr are set to 0.  In this case the driver
    must not uses these values.
    The patch in 8b9f6f33b16e808a5769dbc4193e5f107a09a693 was not complete.
    
    Thanks to Luka Logar for the bug report and patch.
---
 src/ccid_usb.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/ccid_usb.c b/src/ccid_usb.c
index 92edf93..99fab3b 100644
--- a/src/ccid_usb.c
+++ b/src/ccid_usb.c
@@ -378,8 +378,9 @@ again_libusb:
 			uint8_t device_address = libusb_get_device_address(dev);
 
 #ifndef __APPLE__
-			if ((bus_number != device_bus)
-				|| (device_address != device_addr)) {
+			if ((device_bus || device_addr)
+				&& ((bus_number != device_bus)
+				|| (device_address != device_addr))) {
 				/* not USB the device we are looking for */
 				continue;
 			}

-- 
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