From aa45036037c3a120ebfdd6d253b47f07c8ccd936 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sun, 3 Aug 2025 13:22:04 +0100 Subject: [PATCH] Add extra debug message and don't release XHCI slots for non-keyboard devices. --- system/usbhcd.c | 2 ++ system/xhci.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/system/usbhcd.c b/system/usbhcd.c index 6a2bfe8..e1849cb 100644 --- a/system/usbhcd.c +++ b/system/usbhcd.c @@ -370,6 +370,7 @@ static bool scan_hub_ports(const usb_hcd_t *hcd, const usb_hub_t *hub, int *num_ continue; } +#if 0 // If we didn't find any keyboards, we can disable the port and release the slot. build_setup_packet(&setup_pkt, USB_REQ_TO_HUB_PORT | USB_REQ_CLASS, HUB_CLR_FEATURE, HUB_PORT_ENABLE, port_num, 0); (void)hcd->methods->setup_request(hcd, hub->ep0, &setup_pkt); @@ -377,6 +378,7 @@ static bool scan_hub_ports(const usb_hcd_t *hcd, const usb_hub_t *hub, int *num_ if (hcd->methods->release_slot) { (void)hcd->methods->release_slot(hcd, device_id); } +#endif } return keyboard_found; diff --git a/system/xhci.c b/system/xhci.c index efce9d0..ecd7337 100644 --- a/system/xhci.c +++ b/system/xhci.c @@ -782,6 +782,10 @@ static bool assign_address(const usb_hcd_t *hcd, const usb_hub_t *hub, int port_ print_usb_info("invalid device descriptor port=%i type=%i length=%i", port_num, desc->type, desc->length); return false; } + { + usb_device_desc_t *device = (usb_device_desc_t *)data_buffer; + print_usb_info("fetched length=%i max_packet_size=%i", fetch_length, device->max_packet_size); + } if (command_flags != 0) { usb_device_desc_t *device = (usb_device_desc_t *)data_buffer;