setos

拙OS
Log | Files | Refs | LICENSE

commit f1f3b60694fd69a957072dc161ded0fc1b993997
parent 66184e97d9c3649e57c666c23e34cbafa9068194
Author: Matsuda Kenji <info@mtkn.jp>
Date:   Mon,  6 May 2024 16:29:35 +0900

find enabled port

Diffstat:
Msys/src/kernel/main.c | 11++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/sys/src/kernel/main.c b/sys/src/kernel/main.c @@ -208,10 +208,15 @@ kernel_main(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop) cons_printf(&con0, "processed event ring\n"); // reset port. - for (;(xhc.op->PRS[0].PORTSC&(1<<17|1)) != (1<<17|1);) { // PORTSC.CSC&PORTSC.CCS + int max_ports = xhc.cap->HCSPARAMS1>>24; + cons_printf(&con0, "MaxPorts: %x\n", max_ports); + for (int i = 0; i < max_ports; i++) { + if ((xhc.op->PRS[i].PORTSC&(1<<17|1)) == (1<<17|1)) { // PORTSC.CSC&PORTSC.CCS + cons_printf(&con0, "%d:\tPORTSC: %x\n", + i, xhc.op->PRS[i].PORTSC); + + } } - cons_printf(&con0, "usb device connected: PORTSC: %x\n", - xhc.op->PRS[0].PORTSC); cons_printf(&con0, "offset of prs[0]: %x\n", (uintptr) xhc.op->PRS - (uintptr) xhc.op);