Skip to content

Commit c0e1268

Browse files
vbrzeskicfriedt
authored andcommitted
usb: device_next: hid: Fix endpoint address getters
This commit resolves a bug where the USB Endpoint provided by the HID driver was incorrect when in High Speed mode. Signed-off-by: Victor Brzeski <[email protected]>
1 parent 0de4f8d commit c0e1268

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

subsys/usb/device_next/class/usbd_hid.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,19 +84,29 @@ struct hid_device_data {
8484

8585
static inline uint8_t hid_get_in_ep(struct usbd_class_data *const c_data)
8686
{
87+
struct usbd_context *uds_ctx = usbd_class_get_ctx(c_data);
8788
const struct device *dev = usbd_class_get_private(c_data);
8889
const struct hid_device_config *dcfg = dev->config;
8990
struct usbd_hid_descriptor *desc = dcfg->desc;
9091

92+
if (USBD_SUPPORTS_HIGH_SPEED && usbd_bus_speed(uds_ctx) == USBD_SPEED_HS) {
93+
return desc->hs_in_ep.bEndpointAddress;
94+
}
95+
9196
return desc->in_ep.bEndpointAddress;
9297
}
9398

9499
static inline uint8_t hid_get_out_ep(struct usbd_class_data *const c_data)
95100
{
101+
struct usbd_context *uds_ctx = usbd_class_get_ctx(c_data);
96102
const struct device *dev = usbd_class_get_private(c_data);
97103
const struct hid_device_config *dcfg = dev->config;
98104
struct usbd_hid_descriptor *desc = dcfg->desc;
99105

106+
if (USBD_SUPPORTS_HIGH_SPEED && usbd_bus_speed(uds_ctx) == USBD_SPEED_HS) {
107+
return desc->hs_out_ep.bEndpointAddress;
108+
}
109+
100110
return desc->out_ep.bEndpointAddress;
101111
}
102112

0 commit comments

Comments
 (0)