From 32f4aa6d053b8fba9d5d87f9b53a101db5a5800d Mon Sep 17 00:00:00 2001 From: sakumisu <1203593632@qq.com> Date: Mon, 28 Oct 2024 14:52:59 +0800 Subject: [PATCH] update(core/usbd_core): implement USB_REQUEST_GET_INTERFACE request --- core/usbd_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/usbd_core.c b/core/usbd_core.c index ea471e54..8d502f4c 100644 --- a/core/usbd_core.c +++ b/core/usbd_core.c @@ -64,6 +64,7 @@ USB_NOCACHE_RAM_SECTION struct usbd_core_priv { bool test_req; #endif struct usbd_interface *intf[16]; + uint8_t intf_altsetting[16]; uint8_t intf_offset; struct usbd_tx_rx_msg tx_msg[CONFIG_USBDEV_EP_NUM]; @@ -703,11 +704,12 @@ static bool usbd_std_interface_req_handler(uint8_t busid, struct usb_setup_packe ret = false; break; case USB_REQUEST_GET_INTERFACE: - (*data)[0] = 0; + (*data)[0] = g_usbd_core[busid].intf_altsetting[intf_num]; *len = 1; break; case USB_REQUEST_SET_INTERFACE: + g_usbd_core[busid].intf_altsetting[intf_num] = LO_BYTE(setup->wValue); usbd_set_interface(busid, setup->wIndex, setup->wValue); *len = 0; break;