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.
This commit is contained in:
Daniel Samson
2026-07-21 23:33:12 +01:00
parent da5f404041
commit 570f6f545c
+6 -6
View File
@@ -200,10 +200,6 @@ fn scanPorts(manager: runtime.ipc.Handle) void {
}; };
std.log.info("{d} root-hub ports", .{engine.max_ports}); 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 port: u32 = 1;
var connected: u32 = 0; var connected: u32 = 0;
while (port <= engine.max_ports) : (port += 1) { while (port <= engine.max_ports) : (port += 1) {
@@ -212,7 +208,10 @@ fn scanPorts(manager: runtime.ipc.Handle) void {
connected += 1; connected += 1;
bringUpPort(manager, engine, port); 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 /// 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 { fn bringUpBehindHub(manager: runtime.ipc.Handle, engine: *library.Controller, hub: *library.Device, port: u16) void {
const status = engine.hubPortStatusAck(hub, port) orelse return; const status = engine.hubPortStatusAck(hub, port) orelse return;
const connected = library.Controller.hubPortConnected(status); 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); 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 (!connected) {
if (existing) |dev| tearDownHubDevice(manager, engine, dev); if (existing) |dev| tearDownHubDevice(manager, engine, dev);