summaryrefslogtreecommitdiff
path: root/libusb/os/linux_usbfs.c
diff options
context:
space:
mode:
authorDaniel Drake <dsd@gentoo.org>2008-05-04 13:46:41 +0100
committerDaniel Drake <dsd@gentoo.org>2008-05-04 13:46:41 +0100
commitc01f744ce07bbeccbe353e956479f0cc5a811a6f (patch)
treeac277becb6c434756403419d89b4fbf5efd63d50 /libusb/os/linux_usbfs.c
parent5878daa85e3364bb3885190425d4f9deaa2d8c36 (diff)
downloadlibusb-c01f744ce07bbeccbe353e956479f0cc5a811a6f.tar.gz
Add functionality to clear endpoint halt conditions
Diffstat (limited to 'libusb/os/linux_usbfs.c')
-rw-r--r--libusb/os/linux_usbfs.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/libusb/os/linux_usbfs.c b/libusb/os/linux_usbfs.c
index d1c1100..0066910 100644
--- a/libusb/os/linux_usbfs.c
+++ b/libusb/os/linux_usbfs.c
@@ -485,6 +485,22 @@ static int op_set_interface(struct libusb_device_handle *handle, int iface,
return 0;
}
+static int op_clear_halt(struct libusb_device_handle *handle,
+ unsigned char endpoint)
+{
+ int fd = __device_handle_priv(handle)->fd;
+ int r = ioctl(fd, IOCTL_USBFS_CLEAR_HALT, &endpoint);
+ if (r) {
+ if (errno == ENOENT)
+ return LIBUSB_ERROR_NOT_FOUND;
+
+ usbi_err("clear_halt 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;
@@ -1124,6 +1140,7 @@ const struct usbi_os_backend linux_usbfs_backend = {
.release_interface = op_release_interface,
.set_interface_altsetting = op_set_interface,
+ .clear_halt = op_clear_halt,
.destroy_device = op_destroy_device,