struct libusb_device_descriptor des;
struct sr_dev_inst *sdi;
struct context *ctx;
- int err, skip, i;
+ int ret, skip, i;
if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
return SR_ERR;
skip = 0;
libusb_get_device_list(usb_context, &devlist);
for (i = 0; devlist[i]; i++) {
- if ((err = libusb_get_device_descriptor(devlist[i], &des))) {
- sr_err("logic: failed to get device descriptor: %d", err);
+ if ((ret = libusb_get_device_descriptor(devlist[i], &des))) {
+ sr_err("logic: failed to get device descriptor: %d", ret);
continue;
}
continue;
}
- if (!(err = libusb_open(devlist[i], &ctx->usb->devhdl))) {
+ if (!(ret = libusb_open(devlist[i], &ctx->usb->devhdl))) {
if (ctx->usb->address == 0xff)
/*
* first time we touch this device after firmware upload,
sdi->index, ctx->usb->bus,
ctx->usb->address, USB_INTERFACE);
} else {
- sr_err("logic: failed to open device: %d", err);
+ sr_err("logic: failed to open device: %d", ret);
}
/* if we made it here, we handled the device one way or another */
struct fx2_profile *fx2_prof;
struct context *ctx;
libusb_device **devlist;
- int err, devcnt, i, j;
+ int ret, devcnt, i, j;
/* Avoid compiler warnings. */
(void)devinfo;
libusb_get_device_list(usb_context, &devlist);
for (i = 0; devlist[i]; i++) {
fx2_prof = NULL;
- err = libusb_get_device_descriptor(devlist[i], &des);
- if (err != 0) {
+ ret = libusb_get_device_descriptor(devlist[i], &des);
+ if (ret != 0) {
sr_err("logic: failed to get device descriptor: %d",
- err);
+ ret);
continue;
}
GTimeVal cur_time;
struct sr_dev_inst *sdi;
struct context *ctx;
- int timediff, err;
+ int timediff, ret;
if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
return SR_ERR;
* if the firmware was recently uploaded, wait up to MAX_RENUM_DELAY ms
* for the FX2 to renumerate
*/
- err = 0;
+ ret = 0;
if (GTV_TO_MSEC(ctx->fw_updated) > 0) {
sr_info("logic: waiting for device to reset");
/* takes at least 300ms for the FX2 to be gone from the USB bus */
g_usleep(300 * 1000);
timediff = 0;
while (timediff < MAX_RENUM_DELAY) {
- if ((err = sl_open_dev(dev_index)) == SR_OK)
+ if ((ret = sl_open_dev(dev_index)) == SR_OK)
break;
g_usleep(100 * 1000);
g_get_current_time(&cur_time);
}
sr_info("logic: device came back after %d ms", timediff);
} else {
- err = sl_open_dev(dev_index);
+ ret = sl_open_dev(dev_index);
}
- if (err != SR_OK) {
+ if (ret != SR_OK) {
sr_err("logic: unable to open device");
return SR_ERR;
}
ctx = sdi->priv;
- err = libusb_claim_interface(ctx->usb->devhdl, USB_INTERFACE);
- if (err != 0) {
- sr_err("logic: Unable to claim interface: %d", err);
+ ret = libusb_claim_interface(ctx->usb->devhdl, USB_INTERFACE);
+ if (ret != 0) {
+ sr_err("logic: Unable to claim interface: %d", ret);
return SR_ERR;
}