This is an automated email from Gerrit.

Hsiangkai Wang ([email protected]) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/1091

-- gerrit

commit 276abf635b9cb8eafb0d764a8f5351d9f60579c5
Author: Hsiangkai Wang <[email protected]>
Date:   Wed Dec 26 17:32:10 2012 +0800

    topic: idProduct of USB device may be zero
    
    There is no constraint about idProduct in USB spec.  So, pids[i] may be 0 
for USB devices.
    
    Change-Id: I19d8974f4e7082e8b7e1f2d33c019ac4e61bc1e2
    Signed-off-by: Hsiangkai Wang <[email protected]>

diff --git a/src/jtag/drivers/libusb0_common.c 
b/src/jtag/drivers/libusb0_common.c
index c731ee5..84dd688 100644
--- a/src/jtag/drivers/libusb0_common.c
+++ b/src/jtag/drivers/libusb0_common.c
@@ -28,7 +28,7 @@
 static bool jtag_libusb_match(struct jtag_libusb_device *dev,
                const uint16_t vids[], const uint16_t pids[])
 {
-       for (unsigned i = 0; vids[i] && pids[i]; i++) {
+       for (unsigned i = 0; vids[i] || pids[i]; i++) {
                if (dev->descriptor.idVendor == vids[i] &&
                        dev->descriptor.idProduct == pids[i]) {
                        return true;
diff --git a/src/jtag/drivers/libusb1_common.c 
b/src/jtag/drivers/libusb1_common.c
index 194f737..9256267 100644
--- a/src/jtag/drivers/libusb1_common.c
+++ b/src/jtag/drivers/libusb1_common.c
@@ -33,7 +33,7 @@ static bool jtag_libusb_match(struct jtag_libusb_device *dev,
 {
        struct libusb_device_descriptor dev_desc;
 
-       for (unsigned i = 0; vids[i] && pids[i]; i++) {
+       for (unsigned i = 0; vids[i] || pids[i]; i++) {
                if (libusb_get_device_descriptor(dev, &dev_desc) == 0) {
                        if (dev_desc.idVendor == vids[i] &&
                                dev_desc.idProduct == pids[i])

-- 

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to