From: Romain Tartière Date: Tue, 28 Nov 2017 18:43:50 +0000 (+0100) Subject: Ensure device is closed before usb_get_port_path() X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=7bbe5a2b6a3cea7bc5b59ca3c34ed4f6fcf8c3b1 Ensure device is closed before usb_get_port_path() The usb_get_port_path() function opens the passed device on FreeBSD, which fails if the device has already been open. This fixes bug #1109. --- diff --git a/src/hardware/chronovu-la/api.c b/src/hardware/chronovu-la/api.c index 8ca68edb..fb35879f 100644 --- a/src/hardware/chronovu-la/api.c +++ b/src/hardware/chronovu-la/api.c @@ -192,10 +192,10 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) continue; } - usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)); - libusb_close(hdl); + usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)); + if (!strcmp(product, "ChronoVu LA8")) model = 0; else if (!strcmp(product, "ChronoVu LA16")) diff --git a/src/hardware/dreamsourcelab-dslogic/api.c b/src/hardware/dreamsourcelab-dslogic/api.c index 021d7023..a7eb1948 100644 --- a/src/hardware/dreamsourcelab-dslogic/api.c +++ b/src/hardware/dreamsourcelab-dslogic/api.c @@ -214,10 +214,10 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) continue; } - usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)); - libusb_close(hdl); + usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)); + prof = NULL; for (j = 0; supported_device[j].vid; j++) { if (des.idVendor == supported_device[j].vid && diff --git a/src/hardware/fx2lafw/api.c b/src/hardware/fx2lafw/api.c index adae8045..abb86788 100644 --- a/src/hardware/fx2lafw/api.c +++ b/src/hardware/fx2lafw/api.c @@ -263,10 +263,10 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) continue; } - usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)); - libusb_close(hdl); + usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)); + prof = NULL; for (j = 0; supported_fx2[j].vid; j++) { if (des.idVendor == supported_fx2[j].vid &&