* If the firmware was recently uploaded, wait up to MAX_RENUM_DELAY_MS
* milliseconds for the FX2 to renumerate.
*/
- ret = 0;
-
+ ret = SR_ERR;
if (ctx->fw_updated > 0) {
sr_info("fx2lafw: Waiting for device to reset.");
/* takes at least 300ms for the FX2 to be gone from the USB bus */
g_usleep(100 * 1000);
timediff_us = g_get_monotonic_time() - ctx->fw_updated;
- timediff_ms = timediff_us / G_USEC_PER_SEC;
- sr_spew("fx2lafw: timediff: %" PRIi64 " us.",
- timediff_us);
+ timediff_ms = timediff_us / 1000;
+ sr_spew("fx2lafw: waited %" PRIi64 " ms", timediff_ms);
}
sr_info("fx2lafw: Device came back after %d ms.", timediff_ms);
} else {
ret = libusb_claim_interface(ctx->usb->devhdl, USB_INTERFACE);
if (ret != 0) {
- sr_err("fx2lafw: Unable to claim interface: %d.", ret);
+ switch(ret) {
+ case LIBUSB_ERROR_BUSY:
+ sr_err("fx2lafw: Unable to claim USB interface. Another "
+ "program or driver has already claimed it.");
+ break;
+
+ case LIBUSB_ERROR_NO_DEVICE:
+ sr_err("fx2lafw: Device has been disconnected.");
+ break;
+
+ default:
+ sr_err("fx2lafw: Unable to claim interface: %d.", ret);
+ break;
+ }
+
return SR_ERR;
}
*/
packet.type = SR_DF_LOGIC;
packet.payload = &logic;
- logic.length = ctx->trigger_stage;
- logic.unitsize = 1;
+ logic.unitsize = sizeof(*ctx->trigger_buffer);
+ logic.length = ctx->trigger_stage * logic.unitsize;
logic.data = ctx->trigger_buffer;
sr_session_send(ctx->session_dev_id, &packet);