From 50302c3eb9933d1ba122be58cdf65001dd3bf028 Mon Sep 17 00:00:00 2001 From: Nikunj A Dadhania Date: Tue, 24 Sep 2013 15:09:29 +0530 Subject: usb-core: Add CLEAR FEATURE api Signed-off-by: Nikunj A Dadhania --- lib/libusb/usb-core.c | 19 +++++++++++++++++++ lib/libusb/usb-core.h | 3 +++ 2 files changed, 22 insertions(+) (limited to 'lib') diff --git a/lib/libusb/usb-core.c b/lib/libusb/usb-core.c index 308ddaa..6fad631 100644 --- a/lib/libusb/usb-core.c +++ b/lib/libusb/usb-core.c @@ -308,6 +308,25 @@ static int usb_set_config(struct usb_dev *dev, uint8_t cfg_value) return usb_send_ctrl(dev->control, &req, NULL); } +static int usb_clear_halt(struct usb_pipe *pipe) +{ + struct usb_dev_req req; + struct usb_dev *dev; + + if (pipe && pipe->dev) { + dev = pipe->dev; + dprintf("Clearing port %d dir %d type %d\n", + pipe->epno, pipe->dir, pipe->type); + req.bmRequestType = REQT_DIR_OUT | REQT_REC_EP; + req.bRequest = REQ_CLEAR_FEATURE; + req.wValue = FEATURE_ENDPOINT_HALT; + req.wIndex = cpu_to_le16(pipe->epno | pipe->dir); + req.wLength = 0; + return usb_send_ctrl(dev->control, &req, NULL); + } + return false; +} + int usb_dev_populate_pipe(struct usb_dev *dev, struct usb_ep_descr *ep, void *buf, size_t len) { diff --git a/lib/libusb/usb-core.h b/lib/libusb/usb-core.h index 5914a64..75aa0f9 100644 --- a/lib/libusb/usb-core.h +++ b/lib/libusb/usb-core.h @@ -136,6 +136,9 @@ struct usb_pipe { #define REQ_SET_INTERFACE 11 #define REQ_SYNCH_FRAME 12 +#define FEATURE_DEVICE_REMOTE_WAKEUP 1 +#define FEATURE_ENDPOINT_HALT 0 + #define REQT_REC_DEVICE 0 #define REQT_REC_INTERFACE 1 #define REQT_REC_EP 2 -- cgit v1.1