Wire real PS/2 mouse packets through to input events
Replace the mouse driver's synthetic stream with the real path, the way the keyboard was wired: - The auxiliary port's IRQ12 is enumerated on the mouse's own ACPI node (PNP0F13), and the kernel only lets a device's claimer bind or ack its IRQs — so ps2-bus now claims that node alongside the controller whenever port 2 carries a device, binds IRQ12 to its one endpoint, and re-arms whichever line the notification's badge names. The forwarding loop already routed auxiliary bytes by status bit 5. - mouse-packet.zig (new, pure, host-tested): three-byte stream-mode packet assembly — bit-3 sync with resynchronization, ACK/BAT bytes dropped at packet start, nine-bit two's-complement movement, overflow packets discarded, and PS/2 positive-Y-up converted to the screen convention (positive down). - mouse.zig mirrors the keyboard driver: no hardware claim, attaches to the bus as its mouse, and publishes button_down/button_up per changed button plus motion events with the pressed-button mask. Verified end to end in QEMU via monitor mouse_move/mouse_button: motion round-trips in screen coordinates, buttons transition with the right mask, and keyboard events keep flowing alongside. The follow-up is the IntelliMouse magic-knock for a scroll wheel (four-byte packets) and scroll events.
This commit is contained in:
+12
-5
@@ -126,11 +126,18 @@ the service delivers to its endpoint, which only the same thread could receive).
|
||||
control characters for Enter/Tab/Backspace/Escape, whose keysyms map to no Unicode. The
|
||||
layout defaults to `us`; the bus can pass another as the driver's argv[2] — the seam for
|
||||
a future settings source.
|
||||
- **The mouse is still synthetic.** [mouse.zig](../system/drivers/ps2-bus/mouse.zig)
|
||||
publishes a placeholder motion/click stream; the hardware-free `input-source` likewise
|
||||
rotates through all three classes (including a synthetic joystick, which has no driver
|
||||
yet) via the `input.synthetic*Event` helpers. **Follow-up:** the mouse driver attaches to
|
||||
the bus the way the keyboard does and decodes 3/4-byte packets into mouse events.
|
||||
- **The mouse is real too.** IRQ12 is enumerated on the auxiliary device's own ACPI node
|
||||
(PNP0F13), so the bus claims that node alongside the controller and routes both IRQs to
|
||||
its one endpoint, acking whichever line the notification's badge names.
|
||||
[mouse.zig](../system/drivers/ps2-bus/mouse.zig) attaches the way the keyboard does and
|
||||
assembles the forwarded bytes with
|
||||
[mouse-packet.zig](../system/drivers/ps2-bus/mouse-packet.zig) (three-byte stream-mode
|
||||
packets: sync/overflow handling, nine-bit movement, screen-convention `dy` — host-tested
|
||||
under `zig build test`) into `button_down`/`button_up` transitions and `motion` events.
|
||||
**Follow-up:** the IntelliMouse magic-knock for a scroll wheel (four-byte packets) and
|
||||
`scroll` events. The hardware-free `input-source` still rotates through all three classes
|
||||
synthetically (including a joystick, which has no driver yet) via the
|
||||
`input.synthetic*Event` helpers.
|
||||
- **Drop-oldest under overflow** is a defined loss; the 16-slot ring absorbs normal bursts.
|
||||
Real backpressure/flow-control is future work.
|
||||
- **`publish` is unauthenticated** — any process may publish, consistent with the current
|
||||
|
||||
Reference in New Issue
Block a user