Skip to content

Commit

Permalink
Merge pull request #377 from analogdevicesinc/rgetz-be-more-verbose-o…
Browse files Browse the repository at this point in the history
…n-usb

usb: be more verbose on errors, by using iio_strerr
  • Loading branch information
rgetz authored Feb 17, 2020
2 parents 5f5af2e + 87f8f14 commit 076705d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -859,16 +859,21 @@ struct iio_context * usb_create_context(unsigned int bus,

ret = libusb_claim_interface(hdl, interface);
if (ret) {
char err_str[1024];
ret = -(int) libusb_to_errno(ret);
ERROR("Unable to claim interface %u:%u:%u: %i\n",
bus, address, interface, ret);
iio_strerror(-ret, err_str, sizeof(err_str));
ERROR("Unable to claim interface %u:%u:%u: %s (%i)\n",
bus, address, interface, err_str, ret);
goto err_libusb_close;
}

ret = libusb_get_active_config_descriptor(usb_dev, &conf_desc);
if (ret) {
char err_str[1024];
ret = -(int) libusb_to_errno(ret);
ERROR("Unable to get config descriptor: %i\n", ret);
iio_strerror(-ret, err_str, sizeof(err_str));
ERROR("Unable to get config descriptor: %s (%i)\n",
err_str, ret);
goto err_libusb_close;
}

Expand Down

0 comments on commit 076705d

Please sign in to comment.