From: Gerhard Sittig Date: Sat, 18 Aug 2018 13:31:09 +0000 (+0200) Subject: saleae and other FX2: show firmware name when loading fails X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=1372bdcdb56704c5aed01603c14b7b051af5f65e;p=libsigrok.git saleae and other FX2: show firmware name when loading fails 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. --- diff --git a/src/hardware/dreamsourcelab-dslogic/api.c b/src/hardware/dreamsourcelab-dslogic/api.c index 66c4dc73..98f4acdb 100644 --- a/src/hardware/dreamsourcelab-dslogic/api.c +++ b/src/hardware/dreamsourcelab-dslogic/api.c @@ -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); diff --git a/src/hardware/fx2lafw/api.c b/src/hardware/fx2lafw/api.c index 647aeec0..e0a11a5b 100644 --- a/src/hardware/fx2lafw/api.c +++ b/src/hardware/fx2lafw/api.c @@ -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); diff --git a/src/hardware/hantek-6xxx/api.c b/src/hardware/hantek-6xxx/api.c index d94ee45d..59b27c2c 100644 --- a/src/hardware/hantek-6xxx/api.c +++ b/src/hardware/hantek-6xxx/api.c @@ -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); diff --git a/src/hardware/hantek-dso/api.c b/src/hardware/hantek-dso/api.c index abbeb21b..c1b18ea9 100644 --- a/src/hardware/hantek-dso/api.c +++ b/src/hardware/hantek-dso/api.c @@ -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); diff --git a/src/hardware/saleae-logic-pro/api.c b/src/hardware/saleae-logic-pro/api.c index ae444dd8..7b8582d2 100644 --- a/src/hardware/saleae-logic-pro/api.c +++ b/src/hardware/saleae-logic-pro/api.c @@ -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; diff --git a/src/hardware/saleae-logic16/api.c b/src/hardware/saleae-logic16/api.c index ed9e1ecd..99916e44 100644 --- a/src/hardware/saleae-logic16/api.c +++ b/src/hardware/saleae-logic16/api.c @@ -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);