]> sigrok.org Git - libsigrok.git/commitdiff
saleae and other FX2: show firmware name when loading fails
authorGerhard Sittig <redacted>
Sat, 18 Aug 2018 13:31:09 +0000 (15:31 +0200)
committerUwe Hermann <redacted>
Thu, 30 Aug 2018 20:05:56 +0000 (22:05 +0200)
The "firmware load failed" message would be even more helpful if users
could learn which firmware file failed to load. Add those filenames to
various FX2-based drivers.

This addresses bug #1262.

src/hardware/dreamsourcelab-dslogic/api.c
src/hardware/fx2lafw/api.c
src/hardware/hantek-6xxx/api.c
src/hardware/hantek-dso/api.c
src/hardware/saleae-logic-pro/api.c
src/hardware/saleae-logic16/api.c

index 66c4dc73e0b98c51a4952ee1f9914c14e9edbf3c..98f4acdb159269efed773f517a18d96f9e119503 100644 (file)
@@ -268,14 +268,16 @@ 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, prof->firmware) == SR_OK)
+                                       USB_CONFIGURATION, prof->firmware) == SR_OK) {
                                /* Store when this device's FW was updated. */
                                devc->fw_updated = g_get_monotonic_time();
-                       else
+                       } else {
                                sr_err("Firmware upload failed for "
-                                      "device %d.%d (logical).",
+                                      "device %d.%d (logical), name %s.",
                                       libusb_get_bus_number(devlist[i]),
-                                      libusb_get_device_address(devlist[i]));
+                                      libusb_get_device_address(devlist[i]),
+                                      prof->firmware);
+                       }
                        sdi->inst_type = SR_INST_USB;
                        sdi->conn = sr_usb_dev_inst_new(libusb_get_bus_number(devlist[i]),
                                        0xff, NULL);
index 647aeec04d35522c11ba2cf80bec6899629b0a82..e0a11a5be5aef8be0dce379d650ec57c9703ce7a 100644 (file)
@@ -338,14 +338,16 @@ 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, prof->firmware) == SR_OK)
+                                       USB_CONFIGURATION, prof->firmware) == SR_OK) {
                                /* Store when this device's FW was updated. */
                                devc->fw_updated = g_get_monotonic_time();
-                       else
+                       } else {
                                sr_err("Firmware upload failed for "
-                                      "device %d.%d (logical).",
+                                      "device %d.%d (logical), name %s.",
                                       libusb_get_bus_number(devlist[i]),
-                                      libusb_get_device_address(devlist[i]));
+                                      libusb_get_device_address(devlist[i]),
+                                      prof->firmware);
+                       }
                        sdi->inst_type = SR_INST_USB;
                        sdi->conn = sr_usb_dev_inst_new(libusb_get_bus_number(devlist[i]),
                                        0xff, NULL);
index d94ee45d3fecdf196a494ea1aa569dc243f2328b..59b27c2c666163e397e3eb97c0e8cc4dc01e779f 100644 (file)
@@ -228,11 +228,12 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
                                devices = g_slist_append(devices, sdi);
                                devc = sdi->priv;
                                if (ezusb_upload_firmware(drvc->sr_ctx, devlist[i],
-                                               USB_CONFIGURATION, prof->firmware) == SR_OK)
+                                               USB_CONFIGURATION, prof->firmware) == SR_OK) {
                                        /* Remember when the firmware on this device was updated. */
                                        devc->fw_updated = g_get_monotonic_time();
-                               else
-                                       sr_err("Firmware upload failed.");
+                               } else {
+                                       sr_err("Firmware upload failed, name %s.", prof->firmware);
+                               }
                                /* Dummy USB address of 0xff will get overwritten later. */
                                sdi->conn = sr_usb_dev_inst_new(
                                                libusb_get_bus_number(devlist[i]), 0xff, NULL);
index abbeb21b207aef72c3795c0a5d162bfd069b4100..c1b18ea9ca660a52ec8b2e4113d637b3b8a1e88c 100644 (file)
@@ -330,11 +330,12 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
                                devices = g_slist_append(devices, sdi);
                                devc = sdi->priv;
                                if (ezusb_upload_firmware(drvc->sr_ctx, devlist[i],
-                                               USB_CONFIGURATION, prof->firmware) == SR_OK)
+                                               USB_CONFIGURATION, prof->firmware) == SR_OK) {
                                        /* Remember when the firmware on this device was updated */
                                        devc->fw_updated = g_get_monotonic_time();
-                               else
-                                       sr_err("Firmware upload failed");
+                               } else {
+                                       sr_err("Firmware upload failed, name %s", prof->firmware);
+                               }
                                /* Dummy USB address of 0xff will get overwritten later. */
                                sdi->conn = sr_usb_dev_inst_new(
                                                libusb_get_bus_number(devlist[i]), 0xff, NULL);
index ae444dd832125bea1ff16880936f3ee5cf9b04f0..7b8582d2bc614588587ffd1d805d56c80b4a9532 100644 (file)
@@ -200,10 +200,12 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
                        continue;
 
                if (!scan_firmware(devlist[i])) {
+                       const char *fwname;
                        sr_info("Found a Logic Pro 16 device (no firmware loaded).");
+                       fwname = "saleae-logicpro16-fx3.fw";
                        if (upload_firmware(drvc->sr_ctx, devlist[i],
-                                           "saleae-logicpro16-fx3.fw") != SR_OK) {
-                               sr_err("Firmware upload failed.");
+                                           fwname) != SR_OK) {
+                               sr_err("Firmware upload failed, name %s.", fwname);
                                continue;
                        };
                        fw_loaded = TRUE;
index ed9e1ecde9013a51d89e99c22af67f2b23c76d25..99916e44e1343cbfedaffc961dba3250178b80bc 100644 (file)
@@ -219,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);