fx2lafw: Print device failed to renumerate error

commit 378abfeac6 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 <mr.nuke.me@gmail.com>
This commit is contained in:
Alexandru Gagniuc 2012-12-06 15:55:14 -06:00 committed by Uwe Hermann
parent f427daefb0
commit 443a14d81f
1 changed files with 7 additions and 3 deletions

View File

@ -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;