summaryrefslogtreecommitdiffstats
path: root/firmware/usbstack
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2013-07-24 22:29:44 +0200
committerMarcin Bukat <marcin.bukat@gmail.com>2013-07-24 23:16:38 +0200
commit21c5ffe09a6ea1e9b1a4bd13a047b0ad2845ee1b (patch)
treea9d9fdc73573ef789f393103c394761113305dcb /firmware/usbstack
parentc4f2a46e0dfee336ce7016cd62608097f15367b8 (diff)
downloadrockbox-21c5ffe09a6ea1e9b1a4bd13a047b0ad2845ee1b.tar.gz
rockbox-21c5ffe09a6ea1e9b1a4bd13a047b0ad2845ee1b.tar.bz2
rockbox-21c5ffe09a6ea1e9b1a4bd13a047b0ad2845ee1b.zip
usb_core: rework handling of clear feature
Change-Id: Icb1e973aa5fd8520eff0796aa8164e0a988d9107
Diffstat (limited to 'firmware/usbstack')
-rw-r--r--firmware/usbstack/usb_core.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/firmware/usbstack/usb_core.c b/firmware/usbstack/usb_core.c
index 406f2a71e4..cc41e8b892 100644
--- a/firmware/usbstack/usb_core.c
+++ b/firmware/usbstack/usb_core.c
@@ -687,6 +687,16 @@ static void usb_core_do_set_config(uint8_t config)
#endif
}
+static void usb_core_do_clear_feature(int recip, int recip_nr, int feature)
+{
+ logf("usb_core: CLEAR FEATURE (%d,%d,%d)", recip, recip_nr, feature);
+ if(recip == USB_RECIP_ENDPOINT)
+ {
+ if(feature == USB_ENDPOINT_HALT)
+ usb_drv_stall(EP_NUM(recip_nr), false, EP_DIR(recip_nr));
+ }
+}
+
static void request_handler_device(struct usb_ctrlrequest* req)
{
switch(req->bRequest) {
@@ -809,9 +819,9 @@ static void request_handler_endpoint_standard(struct usb_ctrlrequest* req)
{
switch (req->bRequest) {
case USB_REQ_CLEAR_FEATURE:
- if(req->wValue == USB_ENDPOINT_HALT)
- usb_drv_stall(EP_NUM(req->wIndex), false, EP_DIR(req->wIndex));
-
+ usb_core_do_clear_feature(USB_RECIP_ENDPOINT,
+ req->wIndex,
+ req->wValue);
usb_drv_send(EP_CONTROL, NULL, 0);
break;
case USB_REQ_SET_FEATURE: