usb: [diagnostic] dump the xECP USB2/USB3 port map + all PORTSC

The USB2 companion hub carrying the user's full-speed keyboard never
appears — only the SuperSpeed hub (port 19) and SS storage (port 21)
connect. To find where the USB2 root ports are and whether the companion
is presenting on one, walk the xECP Supported Protocol capabilities
(logging each USB 2.0 / 3.0 root-port range) and dump every port's raw
PORTSC unconditionally (ccs/ped/pls/pp/speed). QEMU confirms the dump
(USB2 ports 5-8, USB3 ports 1-4). Branch-only diagnostic.
This commit is contained in:
Daniel Samson
2026-07-21 22:56:25 +01:00
parent 18408b0666
commit 10956c6660
2 changed files with 36 additions and 11 deletions
+3 -11
View File
@@ -196,17 +196,9 @@ fn scanPorts(manager: runtime.ipc.Handle) void {
};
std.log.info("{d} root-hub ports", .{engine.max_ports});
// Diagnostic: dump every root port's raw PORTSC (CCS = connect, PED =
// enabled, PLS = link state, speed) so a USB2 companion hub that isn't
// enumerating is visible — is it connected on a port we misread, or absent?
{
var p: u32 = 1;
while (p <= engine.max_ports) : (p += 1) {
const portsc = engine.portStatus(p);
if (portsc & 1 != 0 or (portsc >> 5) & 0xF != 5) // connected, or not in the disabled/disconnected link state
std.log.info("PORTSC[{d}] = 0x{x:0>8} ccs={d} ped={d} pls={d} speed={d}", .{ p, portsc, portsc & 1, (portsc >> 1) & 1, (portsc >> 5) & 0xF, (portsc >> 10) & 0xF });
}
}
// 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;