summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/usbhost/usbhost.h3
-rw-r--r--libusbhost/usbhost.c5
2 files changed, 8 insertions, 0 deletions
diff --git a/include/usbhost/usbhost.h b/include/usbhost/usbhost.h
index 29b6ea356..c2387e592 100644
--- a/include/usbhost/usbhost.h
+++ b/include/usbhost/usbhost.h
@@ -126,6 +126,9 @@ int usb_endpoint_wait(struct usb_device *device, int *out_ep_num);
/* Cancels a pending usb_endpoint_queue() operation on an endpoint. */
int usb_endpoint_cancel(struct usb_endpoint *ep);
+/* Returns the usb_device for the given endpoint */
+struct usb_device *usb_endpoint_get_device(struct usb_endpoint *ep);
+
/* Returns the endpoint address for the given endpoint */
int usb_endpoint_number(struct usb_endpoint *ep);
diff --git a/libusbhost/usbhost.c b/libusbhost/usbhost.c
index d2eaf0c4e..3604a42ad 100644
--- a/libusbhost/usbhost.c
+++ b/libusbhost/usbhost.c
@@ -444,6 +444,11 @@ int usb_endpoint_cancel(struct usb_endpoint *ep)
return ioctl(ep->dev->fd, USBDEVFS_DISCARDURB, &ep->urb);
}
+struct usb_device *usb_endpoint_get_device(struct usb_endpoint *ep)
+{
+ return ep->dev;
+}
+
int usb_endpoint_number(struct usb_endpoint *ep)
{
return ep->desc.bEndpointAddress;