1
0
mirror of git://projects.qi-hardware.com/f32xbase.git synced 2024-11-17 20:54:04 +02:00

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.
This commit is contained in:
Werner Almesberger 2010-08-25 17:26:43 -03:00
parent 5ce904b20f
commit 79396b1777

View File

@ -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 (bus = usb_get_busses(); bus; bus = bus->next)
for (dev = bus->devices; dev; dev = dev->next) { for (dev = bus->devices; dev; dev = dev->next) {
if (dev->descriptor.idVendor != if (dev->descriptor.idVendor !=
vendor ? vendor : default_vendor) (vendor ? vendor : default_vendor))
continue; continue;
if (dev->descriptor.idProduct != if (dev->descriptor.idProduct !=
product ? product : default_product) (product ? product : default_product))
continue; continue;
handle = usb_open(dev); handle = usb_open(dev);
#ifdef DO_FULL_USB_BUREAUCRACY #ifdef DO_FULL_USB_BUREAUCRACY