Read first
docs/architecture/usb: how controllers, enumeration, the three drivers and removal workdocs/architecture/drivers: binding, the keyboard state, the cursor, layouts, the pointer overlaydocs/development/adding-a-driver: the handles and steps for a new USB driver
Rules a change must keep
- Formats and state machines go in
usb-coreandhid-core, which allocate
nothing and own no hardware; a parser of device input bounds every read and
joins the mutation loops.
- The event ring is the only completion path. A
ReportSinkor
TransferSink runs where it is drained: it may not block, allocate or log.
- Nothing slow runs under a spinlock, and the
usbthread never waits for a
device. Waiting belongs to probes and removals on usb-bind.
- Removal is ordered: gone, endpoints stopped, transfers failed, claims
released and removals run, slot disabled, pages freed. Code that outlives
the binding touches no ring or page of a device that is gone.
- Clear a halt on both sides (controller toggle and device toggle). QEMU's
sticks keep no toggles, so prove recovery against the simulated controller.
- A keyboard or pointer driver reports
(source, usage, pressed)or motion
and keeps no modifier, lock, layout or cursor state. It releases its slot
when the device leaves.
- Nothing masks the i8042's interrupt line or polls its data port after
boot; the light exchange is carried by the interrupt.
EPERMfromcursor_set_imagesays the caller lacks the screen, not that
the display has no overlay. The compositor paints a pointer only after the
display refused an image.
- The kernel takes layouts only as the checked binary table. Init loads the
wanted layout; keymap asks init and never loads one itself.
- No code or prose from Linux or QEMU; comments cite spec sections.
- A new
just test-usbcheck adds itsUSB-TEST:line to both
drivers/src/tests/usb_tests.rs and scripts/test_usb.py.
Checks
just test-host:usb-core,hid-coreandkeymap-coreon the host, with the simulated controllerjust test-usb: both QEMU controllers, plug and pull, keys, cursor, stick, NIC, shutdownjust test 'slopos_drivers::tests::keyboard_tests::*': the keyboard state (likewiseinput_event_tests,i8042_tests)
Not yet in the docs
Read pending.md beside this file when it exists. A change that adds or alters an invariant the docs do not state appends it there in the same commit.