diff options
author | Daniel Drake <dsd@gentoo.org> | 2008-05-04 14:10:19 +0100 |
---|---|---|
committer | Daniel Drake <dsd@gentoo.org> | 2008-05-04 14:10:19 +0100 |
commit | bfe74e9cd9c17a40fff042ea0647326f51cfecae (patch) | |
tree | b085291f3d0f1767cc3f8a58ec6f06739450d50b /libusb/os | |
parent | c01f744ce07bbeccbe353e956479f0cc5a811a6f (diff) | |
download | libusb-bfe74e9cd9c17a40fff042ea0647326f51cfecae.tar.gz |
implement libusb_reset_device()
Diffstat (limited to 'libusb/os')
-rw-r--r-- | libusb/os/linux_usbfs.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libusb/os/linux_usbfs.c b/libusb/os/linux_usbfs.c index 0066910..e67d7b6 100644 --- a/libusb/os/linux_usbfs.c +++ b/libusb/os/linux_usbfs.c @@ -501,6 +501,21 @@ static int op_clear_halt(struct libusb_device_handle *handle, return 0; } +static int op_reset_device(struct libusb_device_handle *handle) +{ + int fd = __device_handle_priv(handle)->fd; + int r = ioctl(fd, IOCTL_USBFS_RESET, NULL); + if (r) { + if (errno == ENODEV) + return LIBUSB_ERROR_NOT_FOUND; + + usbi_err("reset failed error %d errno %d", r, errno); + return LIBUSB_ERROR_OTHER; + } + + return 0; +} + static void op_destroy_device(struct libusb_device *dev) { unsigned char *nodepath = __device_priv(dev)->nodepath; @@ -1141,6 +1156,7 @@ const struct usbi_os_backend linux_usbfs_backend = { .set_interface_altsetting = op_set_interface, .clear_halt = op_clear_halt, + .reset_device = op_reset_device, .destroy_device = op_destroy_device, |