summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCharlie Birks <[email protected]>2021-10-04 11:43:12 +0100
committerGitHub <[email protected]>2021-10-04 11:43:12 +0100
commitaa97b419b22f466c7034d42a0298fad3eafc5311 (patch)
tree805ae08cfc71e00661946392b484f80c7cd5cd53 /src
parentd9bda631d4ce7e82322a5a71339c2556d410c1e0 (diff)
Handle HID devices with OUT endpoint listed first
This happens on my PowerA wired Switch pro controller
Diffstat (limited to 'src')
-rw-r--r--src/class/hid/hid_host.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/class/hid/hid_host.c b/src/class/hid/hid_host.c
index 8c66477b3..ac260d39b 100644
--- a/src/class/hid/hid_host.c
+++ b/src/class/hid/hid_host.c
@@ -291,7 +291,15 @@ bool hidh_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_interface_t const *de
tusb_desc_endpoint_t const * desc_ep = (tusb_desc_endpoint_t const *) p_desc;
TU_ASSERT(TUSB_DESC_ENDPOINT == desc_ep->bDescriptorType);
+ // first endpoint may be OUT, skip to IN endpoint
// TODO also open endpoint OUT
+ if(tu_edpt_dir(desc_ep->bEndpointAddress) == TUSB_DIR_OUT)
+ {
+ p_desc = tu_desc_next(p_desc);
+ desc_ep = (tusb_desc_endpoint_t const *) p_desc;
+ TU_ASSERT(TUSB_DESC_ENDPOINT == desc_ep->bDescriptorType);
+ }
+
TU_ASSERT( usbh_edpt_open(rhport, dev_addr, desc_ep) );
hidh_interface_t* hid_itf = get_instance(dev_addr, hid_dev->inst_count);