From: Uwe Hermann Date: Sat, 21 Nov 2015 19:27:25 +0000 (+0100) Subject: sr_usb_find(): Increase the 'bus' limit to 255. X-Git-Tag: libsigrok-0.4.0~112 X-Git-Url: https://sigrok.org/gitweb/?a=commitdiff_plain;h=e4ce146fefe7cfd475b9d8fdec1101b188b746db;p=libsigrok.git sr_usb_find(): Increase the 'bus' limit to 255. On some systems it can happen that the USB 'bus' number is a lot larger than 64, but sr_usb_find() currently errors out if it is > 64. Example: Bus 250 Device 006: ID 1ab1:04ce 1ab1 DS1000Z Series[...] Increase that limit so that the code will work everywhere. This bus number is queried via libusb_get_bus_number() which returns an uint8_t, so we're limiting to 255 here. Thanks to 'ssi' on IRC for reporting the issue. --- diff --git a/src/usb.c b/src/usb.c index ba56e864..02510cae 100644 --- a/src/usb.c +++ b/src/usb.c @@ -359,7 +359,7 @@ SR_PRIV GSList *sr_usb_find(libusb_context *usb_ctx, const char *conn) return NULL; } - if (bus > 64) { + if (bus > 255) { sr_err("Invalid bus specified: %d.", bus); return NULL; }