]> sigrok.org Git - libsigrok.git/commitdiff
Ensure device is closed before usb_get_port_path()
authorRomain Tartière <redacted>
Tue, 28 Nov 2017 18:43:50 +0000 (19:43 +0100)
committerUwe Hermann <redacted>
Wed, 21 Feb 2018 10:36:58 +0000 (11:36 +0100)
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.

src/hardware/chronovu-la/api.c
src/hardware/dreamsourcelab-dslogic/api.c
src/hardware/fx2lafw/api.c

index 8ca68edbb66645b84946809bc7b407730a7da36b..fb35879fb3e000f690ce27cbfe2fc0d35e2b01ed 100644 (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"))
index 021d702344ebee079720716867b550e9812cb4c9..a7eb1948d46ae951c03d76a2a46e4db33c048586 100644 (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 &&
index adae8045ae8233ab4f8c8d766c6c14cf0ba0d7b4..abb867884ed0ba9ae8e10acf242487f829f45c41 100644 (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 &&