diff options
| author | sakumisu <[email protected]> | 2025-11-27 22:43:16 +0800 |
|---|---|---|
| committer | sakumisu <[email protected]> | 2025-11-27 22:43:56 +0800 |
| commit | e10b44f64e33ed5817caaf3a0779a5b55050dd12 (patch) | |
| tree | 5c5907d16335d75a8bd1cd8132ede436f9d40489 | |
| parent | b1bbc9d39d12dfb9e197e1d49820d2c52f9d6603 (diff) | |
feat(core/usbh_core): support custom config index
Signed-off-by: sakumisu <[email protected]>
| -rw-r--r-- | core/usbh_core.c | 7 | ||||
| -rw-r--r-- | core/usbh_core.h | 1 |
2 files changed, 7 insertions, 1 deletions
diff --git a/core/usbh_core.c b/core/usbh_core.c index 1d312375..dcede253 100644 --- a/core/usbh_core.c +++ b/core/usbh_core.c @@ -418,7 +418,7 @@ int usbh_enumerate(struct usbh_hubport *hport) USB_LOG_INFO("The device has %d bNumConfigurations\r\n", ((struct usb_device_descriptor *)ep0_request_buffer[hport->bus->busid])->bNumConfigurations); - config_index = 0; + config_index = usbh_get_hport_active_config_index(hport); USB_LOG_DBG("The device selects config %d\r\n", config_index); /* Read the first 9 bytes of the config descriptor */ @@ -1208,3 +1208,8 @@ int lsusb(int argc, char **argv) return 0; } + +__WEAK uint8_t usbh_get_hport_active_config_index(struct usbh_hubport *hport) +{ + return 0; // Default to configuration index 0 +}
\ No newline at end of file diff --git a/core/usbh_core.h b/core/usbh_core.h index 0fde3fcf..633fe44e 100644 --- a/core/usbh_core.h +++ b/core/usbh_core.h @@ -313,6 +313,7 @@ int usbh_initialize(uint8_t busid, uintptr_t reg_base, usbh_event_handler_t even int usbh_deinitialize(uint8_t busid); void *usbh_find_class_instance(const char *devname); struct usbh_hubport *usbh_find_hubport(uint8_t busid, uint8_t hub_index, uint8_t hub_port); +uint8_t usbh_get_hport_active_config_index(struct usbh_hubport *hport); int lsusb(int argc, char **argv); |
