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.
This commit is contained in:
Romain Tartière 2017-11-28 19:43:50 +01:00 committed by Uwe Hermann
parent 90cc52260c
commit 7bbe5a2b6a
3 changed files with 6 additions and 6 deletions

View File

@ -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"))

View File

@ -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 &&

View File

@ -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 &&