summaryrefslogtreecommitdiffstats
path: root/shell/src
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-08-04 03:06:06 +0200
committersalmonik <salmonik@tuta.io>2026-08-04 03:06:06 +0200
commit5e1bdc12bd298a9751da4285b7e93c68b1314332 (patch)
treecc4ae9f256dda100477784a47cbc53373fce79b1 /shell/src
parentv0.5.9: fix OptiPlex heap crash — EBS retry must not rebuild the free list (diff)
downloadrs-dos-5e1bdc12bd298a9751da4285b7e93c68b1314332.tar.gz
rs-dos-5e1bdc12bd298a9751da4285b7e93c68b1314332.zip
v0.5.10: USB HID mouse via polled xHCI (rsnix/src/usb.rs)
Polled xHCI driver (mouse-only): controller bring-up, port reset, enable-slot -> address-device -> config-descriptor walk -> HID boot mouse IN endpoint, one outstanding IN TRB drained on poll. Cursor task polls usb first, PS/2 second. New 'usb'/'usb rescan' shell cmds. Verified in QEMU (q35 + OVMF + qemu-xhci + usb-mouse): movement and all three buttons tracked exactly; heap stays clean. Fixes en route: MaxPorts=HCSPARAMS1[31:24]; operational regs CRCR=0x18 DCBAAP=0x30 CONFIG=0x38; pass input-context ptr in Address-Device; Input Control Context DW0=Drop DW1=Add; HID walker bInterfaceClass at +5; async discovery from cursor task.
Diffstat (limited to '')
-rw-r--r--shell/src/lib.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/shell/src/lib.rs b/shell/src/lib.rs
index 0f5ac4b..c9b7cdd 100644
--- a/shell/src/lib.rs
+++ b/shell/src/lib.rs
@@ -721,6 +721,7 @@ write `{} <path> TIL <marker>`",
721 "stress" => cmd_stress(&parsed), 721 "stress" => cmd_stress(&parsed),
722 "date" => cmd_date(&parsed), 722 "date" => cmd_date(&parsed),
723 "pci" => cmd_pci(&parsed), 723 "pci" => cmd_pci(&parsed),
724 "usb" => cmd_usb(&parsed),
724 "rescan" => cmd_rescan(&parsed), 725 "rescan" => cmd_rescan(&parsed),
725 "mouse" => cmd_mouse(&parsed), 726 "mouse" => cmd_mouse(&parsed),
726 "cursor" => cmd_cursor(&parsed), 727 "cursor" => cmd_cursor(&parsed),
@@ -2217,6 +2218,24 @@ fn cmd_pci(p: &Parsed) {
2217 pipe.end(); 2218 pipe.end();
2218} 2219}
2219 2220
2221fn cmd_usb(p: &Parsed) {
2222 // `usb rescan` clears the failed-port mask so discovery retries.
2223 if p.args.first().is_some_and(|w| w == "rescan") {
2224 rsnix::usb::rescan();
2225 let mut pipe = Pipeline::new(&p.filters, &p.output);
2226 let _ = pipe.line("usb: rescanning ports");
2227 pipe.end();
2228 return;
2229 }
2230 let mut pipe = Pipeline::new(&p.filters, &p.output);
2231 for l in rsnix::usb::diagnose().lines() {
2232 if !pipe.line(l) {
2233 break;
2234 }
2235 }
2236 pipe.end();
2237}
2238
2220fn cmd_poweroff() -> ! { 2239fn cmd_poweroff() -> ! {
2221 term_println("shutting down..."); 2240 term_println("shutting down...");
2222 rsnix::power::poweroff() 2241 rsnix::power::poweroff()