From: Alexandru Gagniuc Date: Thu, 6 Dec 2012 21:55:14 +0000 (-0600) Subject: fx2lafw: Print device failed to renumerate error X-Git-Tag: dsupstream~437 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=443a14d81f44772076aefdb2b252657d6abc0d29;p=libsigrok.git fx2lafw: Print device failed to renumerate error commit 378abfeac6cc94d88dc82b8481dec9c9f691f3da tried to solve a bug where the fx2lafw driver would print "Device came back" even if a timeout had occured. It solved that issue, but inadvertently introduced a new bug: "Device came back" would be printed even if no firmware upload was performed. This is counterintuitive, as the device is only reset when a firmware upload is performed. There are three cases: i) Firmware upload was successful ii) Firmware upload failed iii) Firmware upload was NOT needed Each case warrants a separate message from the driver. Print the following messages depending on the outcome: i) "Device came back" ii) "Device failed to renumerate" iii) "Firmware upload was not needed." Signed-off-by: Alexandru Gagniuc --- diff --git a/hardware/fx2lafw/fx2lafw.c b/hardware/fx2lafw/fx2lafw.c index 8e5a10b2..22fff927 100644 --- a/hardware/fx2lafw/fx2lafw.c +++ b/hardware/fx2lafw/fx2lafw.c @@ -542,16 +542,20 @@ static int hw_dev_open(struct sr_dev_inst *sdi) timediff_ms = timediff_us / 1000; sr_spew("Waited %" PRIi64 " ms", timediff_ms); } + if (ret != SR_OK) { + sr_err("Device failed to renumerate."); + return SR_ERR; + } + sr_info("Device came back after %d ms.", + timediff_ms); } else { + sr_info("Firmware upload was not needed."); ret = fx2lafw_dev_open(sdi); } if (ret != SR_OK) { sr_err("Unable to open device."); return SR_ERR; - } else { - sr_info("Device came back after %d ms.", - timediff_ms); } devc = sdi->priv;