Stefan Reinauer has uploaded this change for review. ( https://review.coreboot.org/c/em100/+/47731 )
Change subject: Handle errors of libusb_bulk_transfer() ......................................................................
Handle errors of libusb_bulk_transfer()
Signed-off-by: Stefan Reinauer stefan.reinauer@coreboot.org Change-Id: Iad1308e3bc2656506b0f485aecff8328034dc319 --- M usb.c 1 file changed, 6 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/em100 refs/changes/31/47731/1
diff --git a/usb.c b/usb.c index c7d52d8..4fd3df5 100644 --- a/usb.c +++ b/usb.c @@ -20,16 +20,20 @@ { int actual; int length = 16; /* haven't seen any other length yet */ - libusb_bulk_transfer(dev, 1 | LIBUSB_ENDPOINT_OUT, + int ret = libusb_bulk_transfer(dev, 1 | LIBUSB_ENDPOINT_OUT, data, length, &actual, BULK_SEND_TIMEOUT); + if (LIBUSB_SUCCESS != ret) + printf("ERROR: USB: %s: %s\n", __func__, libusb_strerror(ret)); return (actual == length); }
int get_response(libusb_device_handle *dev, void *data, int length) { int actual; - libusb_bulk_transfer(dev, 2 | LIBUSB_ENDPOINT_IN, + int ret = libusb_bulk_transfer(dev, 2 | LIBUSB_ENDPOINT_IN, data, length, &actual, BULK_SEND_TIMEOUT); + if (LIBUSB_SUCCESS != ret) + printf("ERROR: USB: %s: %s\n", __func__, libusb_strerror(ret)); return actual; }