]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/saleae-logic16/api.c
Remove always-false condition
[libsigrok.git] / src / hardware / saleae-logic16 / api.c
index dedb9a244a2c637e59766125d2bfd801662314f2..99916e44e1343cbfedaffc961dba3250178b80bc 100644 (file)
@@ -188,7 +188,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
 
                libusb_get_device_descriptor(devlist[i], &des);
 
-               usb_get_port_path(devlist[i], connection_id, sizeof(connection_id));
+               if (usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)) < 0)
+                       continue;
 
                if (des.idVendor != LOGIC16_VID || des.idProduct != LOGIC16_PID)
                        continue;
@@ -218,11 +219,12 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
                                libusb_get_device_address(devlist[i]), NULL);
                } else {
                        if (ezusb_upload_firmware(drvc->sr_ctx, devlist[i],
-                                       USB_CONFIGURATION, FX2_FIRMWARE) == SR_OK)
+                                       USB_CONFIGURATION, FX2_FIRMWARE) == SR_OK) {
                                /* Store when this device's FW was updated. */
                                devc->fw_updated = g_get_monotonic_time();
-                       else
-                               sr_err("Firmware upload failed.");
+                       } else {
+                               sr_err("Firmware upload failed, name %s.", FX2_FIRMWARE);
+                       }
                        sdi->inst_type = SR_INST_USB;
                        sdi->conn = sr_usb_dev_inst_new(
                                libusb_get_bus_number(devlist[i]), 0xff, NULL);
@@ -266,7 +268,9 @@ static int logic16_dev_open(struct sr_dev_inst *sdi)
                        /*
                         * Check device by its physical USB bus/port address.
                         */
-                       usb_get_port_path(devlist[i], connection_id, sizeof(connection_id));
+                       if (usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)) < 0)
+                               continue;
+
                        if (strcmp(sdi->connection_id, connection_id))
                                /* This is not the one. */
                                continue;