From 79396b17772639cea615d1c87870d55f08c11850 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Wed, 25 Aug 2010 17:26:43 -0300 Subject: [PATCH] lib/usb.c (open_usb): Stupid beginner's mistake: wrong operator precedence due to missing parentheses in device selection caused it to just pick the first device it found. --- lib/usb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/usb.c b/lib/usb.c index 625c74f..c8e4790 100644 --- a/lib/usb.c +++ b/lib/usb.c @@ -38,10 +38,10 @@ usb_dev_handle *open_usb(uint16_t default_vendor, uint16_t default_product) for (bus = usb_get_busses(); bus; bus = bus->next) for (dev = bus->devices; dev; dev = dev->next) { if (dev->descriptor.idVendor != - vendor ? vendor : default_vendor) + (vendor ? vendor : default_vendor)) continue; if (dev->descriptor.idProduct != - product ? product : default_product) + (product ? product : default_product)) continue; handle = usb_open(dev); #ifdef DO_FULL_USB_BUREAUCRACY