laforge has uploaded this change for review.
usb: Match device by VID/PID without path/addr if it is unique
If there's only a single device with matching VID/PID attached,
we don't need to insist that either the path or the address of the
device matches. Those are only needed to disambiguate multiple
devices with identical VID/PID.
Change-Id: I2ef245a56dfcf22758a0216b86d2a5c602ee5588
---
M src/usb/osmo_libusb.c
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/98/27398/1
diff --git a/src/usb/osmo_libusb.c b/src/usb/osmo_libusb.c
index c5ea507..c8b9348 100644
--- a/src/usb/osmo_libusb.c
+++ b/src/usb/osmo_libusb.c
@@ -536,7 +536,7 @@
addr = libusb_get_device_address(*dev);
path = osmo_libusb_dev_get_path_buf(pathbuf, sizeof(pathbuf), *dev);
- if ((ifm->addr && addr == ifm->addr) ||
+ if ((ifm->addr && addr == ifm->addr) || !list[1] /* only one device */ ||
(strlen(ifm->path) && !strcmp(path, ifm->path))) {
rc = libusb_open(*dev, &usb_devh);
if (rc < 0) {
To view, visit change 27398. To unsubscribe, or for help writing mail filters, visit settings.