From 375095645e19462e0656bfc1238224b91d9417b4 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Tue, 1 Oct 2013 17:34:32 +1000 Subject: [PATCH] Fake the libusb transfer timed out message if we force cancel it with our own async functions. --- usbutils.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/usbutils.c b/usbutils.c index aed1ad72..dd2f6f49 100644 --- a/usbutils.c +++ b/usbutils.c @@ -2242,9 +2242,11 @@ static int callback_wait(struct usb_transfer *ut, int *transferred, unsigned int if (ret) { libusb_cancel_transfer(ut->transfer); pthread_cond_wait(&ut->cond, &ut->mutex); - } + /* Fake the timed out message since it's effectively that */ + ret = LIBUSB_TRANSFER_TIMED_OUT; + } else + ret = ut->transfer->status; /* No need to sort out mutexes here since they won't be reused */ - ret = ut->transfer->status; *transferred = ut->transfer->actual_length; libusb_free_transfer(ut->transfer);