From 570f6f545cc06a626ca2837985bc42271eea82f9 Mon Sep 17 00:00:00 2001 From: Daniel Samson <12231216+daniel-samson@users.noreply.github.com> Date: Tue, 21 Jul 2026 23:33:12 +0100 Subject: [PATCH] usb: quiet the investigation diagnostics now that hubs work on real HW The compound-hub investigation is resolved (Keychron keyboard + ROG mouse enumerate through the Genesys USB2 companion hub and type on real hardware). Turn the debugging spam back down for main: the full 22-port PORTSC dump runs only when a scan finds NOTHING (a 'why is this empty' aid), not every boot; a downstream hub port logs only when a device actually appears or leaves, not for every empty seed-sweep port. The readable device names, class names, and port-change events stay. --- system/drivers/usb-xhci-bus/usb-xhci-bus.zig | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/system/drivers/usb-xhci-bus/usb-xhci-bus.zig b/system/drivers/usb-xhci-bus/usb-xhci-bus.zig index 313a92c..fae9393 100644 --- a/system/drivers/usb-xhci-bus/usb-xhci-bus.zig +++ b/system/drivers/usb-xhci-bus/usb-xhci-bus.zig @@ -200,10 +200,6 @@ fn scanPorts(manager: runtime.ipc.Handle) void { }; std.log.info("{d} root-hub ports", .{engine.max_ports}); - // Diagnostic: the USB2/USB3 root-port map (xECP) + every port's raw PORTSC, - // to find a USB2 companion hub that isn't presenting a connection. - engine.dumpPortTopology(); - var port: u32 = 1; var connected: u32 = 0; while (port <= engine.max_ports) : (port += 1) { @@ -212,7 +208,10 @@ fn scanPorts(manager: runtime.ipc.Handle) void { connected += 1; bringUpPort(manager, engine, port); } - if (connected == 0) _ = runtime.system.write("/system/drivers/usb-xhci-bus: no devices connected\n"); + if (connected == 0) { + _ = runtime.system.write("/system/drivers/usb-xhci-bus: no devices connected\n"); + engine.dumpPortTopology(); // help diagnose an empty scan: the xECP map + raw PORTSC + } } /// Bring up whatever is on `port`: setup + enumerate + register/report one child @@ -272,8 +271,9 @@ fn hubPortKey(hub_slot: u8, port: u16) u32 { fn bringUpBehindHub(manager: runtime.ipc.Handle, engine: *library.Controller, hub: *library.Device, port: u16) void { const status = engine.hubPortStatusAck(hub, port) orelse return; const connected = library.Controller.hubPortConnected(status); - std.log.info("hub slot {d} port {d} status 0x{x:0>8} ({s})", .{ hub.slot_id, port, status, if (connected) "connected" else "empty" }); const existing = engine.deviceOnHubPort(hub, port); + if (connected != (existing != null)) // only when a device appears or leaves — not empty seed-sweep ports + std.log.info("hub slot {d} port {d}: {s} (status 0x{x:0>4})", .{ hub.slot_id, port, if (connected) "device connected" else "device removed", status & 0xFFFF }); if (!connected) { if (existing) |dev| tearDownHubDevice(manager, engine, dev);