summaryrefslogtreecommitdiff
path: root/libusb/os/linux_usbfs.c
diff options
context:
space:
mode:
authorDaniel Drake <dsd@gentoo.org>2008-05-04 14:10:19 +0100
committerDaniel Drake <dsd@gentoo.org>2008-05-04 14:10:19 +0100
commitbfe74e9cd9c17a40fff042ea0647326f51cfecae (patch)
treeb085291f3d0f1767cc3f8a58ec6f06739450d50b /libusb/os/linux_usbfs.c
parentc01f744ce07bbeccbe353e956479f0cc5a811a6f (diff)
downloadlibusb-bfe74e9cd9c17a40fff042ea0647326f51cfecae.tar.gz
implement libusb_reset_device()
Diffstat (limited to 'libusb/os/linux_usbfs.c')
-rw-r--r--libusb/os/linux_usbfs.c16
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,