summaryrefslogtreecommitdiff
path: root/libusb/sync.c
diff options
context:
space:
mode:
authorDaniel Drake <dsd@gentoo.org>2008-05-11 20:31:58 +0100
committerDaniel Drake <dsd@gentoo.org>2008-05-11 20:47:27 +0100
commitfec7c84163e25b8f811632828334d75da82bcb16 (patch)
tree9ccdab1835c2396bfe79ecc484328932ff186427 /libusb/sync.c
parentaeb905fa5d78cdbba80a680aa7a2bb7338f27f65 (diff)
downloadlibusb-fec7c84163e25b8f811632828334d75da82bcb16.tar.gz
Handle hot-unplugging
This involved moving from select() to poll() because there is no way to distinguish usbfs's POLLERR condition with select().
Diffstat (limited to 'libusb/sync.c')
-rw-r--r--libusb/sync.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libusb/sync.c b/libusb/sync.c
index 1d0f7c4..d158922 100644
--- a/libusb/sync.c
+++ b/libusb/sync.c
@@ -66,6 +66,7 @@ static void ctrl_transfer_cb(struct libusb_transfer *transfer)
* \returns LIBUSB_ERROR_TIMEOUT if the transfer timed out
* \returns LIBUSB_ERROR_PIPE if the control request was not supported by the
* device
+ * \returns LIBUSB_ERROR_NO_DEVICE if the device has been disconnected
* \returns another LIBUSB_ERROR code on other failures
*/
API_EXPORTED int libusb_control_transfer(libusb_device_handle *dev_handle,
@@ -125,6 +126,9 @@ API_EXPORTED int libusb_control_transfer(libusb_device_handle *dev_handle,
case LIBUSB_TRANSFER_STALL:
r = LIBUSB_ERROR_PIPE;
break;
+ case LIBUSB_TRANSFER_NO_DEVICE:
+ r = LIBUSB_ERROR_NO_DEVICE;
+ break;
default:
usbi_warn("unrecognised status code %d", transfer->status);
r = LIBUSB_ERROR_OTHER;
@@ -186,6 +190,9 @@ static int do_sync_bulk_transfer(struct libusb_device_handle *dev_handle,
case LIBUSB_TRANSFER_STALL:
r = LIBUSB_ERROR_PIPE;
break;
+ case LIBUSB_TRANSFER_NO_DEVICE:
+ r = LIBUSB_ERROR_NO_DEVICE;
+ break;
default:
usbi_warn("unrecognised status code %d", transfer->status);
r = LIBUSB_ERROR_OTHER;
@@ -230,6 +237,7 @@ static int do_sync_bulk_transfer(struct libusb_device_handle *dev_handle,
* \returns LIBUSB_ERROR_TIMEOUT if the transfer timed out (and populates
* <tt>transferred</tt>)
* \returns LIBUSB_ERROR_PIPE if the endpoint halted
+ * \returns LIBUSB_ERROR_NO_DEVICE if the device has been disconnected
* \returns another LIBUSB_ERROR code on other failures
*/
API_EXPORTED int libusb_bulk_transfer(struct libusb_device_handle *dev_handle,
@@ -276,6 +284,7 @@ API_EXPORTED int libusb_bulk_transfer(struct libusb_device_handle *dev_handle,
* \returns 0 on success (and populates <tt>transferred</tt>)
* \returns LIBUSB_ERROR_TIMEOUT if the transfer timed out
* \returns LIBUSB_ERROR_PIPE if the endpoint halted
+ * \returns LIBUSB_ERROR_NO_DEVICE if the device has been disconnected
* \returns another LIBUSB_ERROR code on other error
*/
API_EXPORTED int libusb_interrupt_transfer(