X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fsaleae-logic%2Fsaleae-logic.c;h=50a6944223111659766aa82d51151f8cdd59e107;hb=ebc347388240e025181265f7d3d63a22f7bd5da9;hp=d33a5cc032cd90048312f6512fc2edf9e564a279;hpb=d6eb0c333c8424d151637c18e1a1aef849d5fb31;p=libsigrok.git diff --git a/hardware/saleae-logic/saleae-logic.c b/hardware/saleae-logic/saleae-logic.c index d33a5cc0..50a69442 100644 --- a/hardware/saleae-logic/saleae-logic.c +++ b/hardware/saleae-logic/saleae-logic.c @@ -177,7 +177,7 @@ static int sl_open_dev(int dev_index) 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; @@ -190,8 +190,8 @@ static int sl_open_dev(int dev_index) 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; } @@ -216,7 +216,7 @@ static int sl_open_dev(int dev_index) 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, @@ -229,7 +229,7 @@ static int sl_open_dev(int dev_index) 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 */ @@ -332,7 +332,7 @@ static int hw_init(const char *devinfo) 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; @@ -347,10 +347,10 @@ static int hw_init(const char *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; } @@ -404,7 +404,7 @@ static int hw_dev_open(int dev_index) 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; @@ -414,14 +414,14 @@ static int hw_dev_open(int dev_index) * 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); @@ -429,18 +429,18 @@ static int hw_dev_open(int dev_index) } 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; }