From 04a13539dde355159f2ad72d67d3c28887f2130b Mon Sep 17 00:00:00 2001 From: Matheus Date: Thu, 14 May 2026 14:36:45 -0300 Subject: [PATCH] xhci: fix bad root_port_number when behind hubs --- kernel-src/io/usb/ctrl/xhci_ctrl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel-src/io/usb/ctrl/xhci_ctrl.c b/kernel-src/io/usb/ctrl/xhci_ctrl.c index 5121ed1e..b8e9e2a5 100644 --- a/kernel-src/io/usb/ctrl/xhci_ctrl.c +++ b/kernel-src/io/usb/ctrl/xhci_ctrl.c @@ -402,9 +402,10 @@ static int xhci_ctrl_address_device(usb_ctrl_t *ctrl, usb_hub_t *hub, uint8_t po xhci_device_t *xhci_hub_device = (xhci_device_t *)hub->device; xhci_dev->root_port_number = xhci_hub_device->root_port_number; } else { + xhci_root_hub_t *rh = container_of(hub, xhci_root_hub_t, hub); xhci_dev->device_tier = 0; xhci_dev->route_string = 0; - xhci_dev->root_port_number = port; + xhci_dev->root_port_number = rh->port_offset + port; } if (hub->device == NULL) {