From 476a224dfa280416d74a7304fda8a14d0fa2fc5c Mon Sep 17 00:00:00 2001 From: Alexander Kaiser Date: Wed, 15 Nov 2023 10:05:24 -0700 Subject: [PATCH] usb: host: use uint16_t for Language ID usbh_req_desc() truncates the descriptor id. This problem is most visible with string descriptor requests, as only then can wIndex be greater than 0xFF. In particular, this affects commonly used language IDs such as English (United States), which is 0x0409. Signed-off-by: Alexander Kaiser --- subsys/usb/host/usbh_ch9.c | 2 +- subsys/usb/host/usbh_ch9.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/usb/host/usbh_ch9.c b/subsys/usb/host/usbh_ch9.c index f8f587a43c3..e3f55e95eb1 100644 --- a/subsys/usb/host/usbh_ch9.c +++ b/subsys/usb/host/usbh_ch9.c @@ -85,7 +85,7 @@ buf_alloc_err: int usbh_req_desc(struct usb_device *const udev, const uint8_t type, const uint8_t index, - const uint8_t id, + const uint16_t id, const uint16_t len, struct net_buf *const buf) { diff --git a/subsys/usb/host/usbh_ch9.h b/subsys/usb/host/usbh_ch9.h index 26c21c83715..a60dc86527b 100644 --- a/subsys/usb/host/usbh_ch9.h +++ b/subsys/usb/host/usbh_ch9.h @@ -22,7 +22,7 @@ int usbh_req_setup(struct usb_device *const udev, int usbh_req_desc(struct usb_device *const udev, const uint8_t type, const uint8_t index, - const uint8_t id, + const uint16_t id, const uint16_t len, struct net_buf *const data);