Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

domnudragota
Copy link
Contributor

Pull Request Overview

This adds a PS/2 keyboard driver for x86_q35, layered over the i8042 controller.

  • Set-2 decoder: handles E0 (extended), F0 (break), and swallows the E1 Pause sequence.

  • Minimal event model (KeyEvent): make/break + extended bit.

  • Optional ASCII path (US layout): press-only, non-extended, with Shift/Caps handling.

  • Small command engine (non-alloc FIFO) for device commands with ACK (0xFA) / RESEND (0xFE) retry logic.

  • Defensive indexing via bounds-checked access in the command queue (no panics).

Dependencies

Testing Strategy

Built and ran under QEMU; typed sequences to verify:

  • MAKE/BREAK decoding (including E0-extended keys).

  • ASCII emission path (letters, digits, common punctuation; Shift/Caps).

  • Non-keystroke device responses (0xFA/0xFE/0xAA) are ignored unless a command is in flight.

  • Command engine present and compiled; it will be exercised when we move device init from the controller to the keyboard/capsule.

TODO or Help Wanted

  • Move the keyboard init sequence (F5 -> FF -> F0 02 -> F4) from the controller into the keyboard using the command engine.

  • Hook a capsule (client) to consume KeyEvent / ASCII (e.g., process console over VGA).

Documentation Updated

  • Updated the relevant files in /docs, or no updates are required.

Formatting

  • Ran make prepush.

Copy link
Contributor

@alexandruradovici alexandruradovici left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, waiting for #4594 to get merged.

@alexandruradovici alexandruradovici added the blocked Waiting on something, like a different PR or a dependency. label Sep 16, 2025
step1: PS/2 controller self-test (clock & IRQ still disabled)

step2: enable keyboard clock (IRQ 1 still masked)

step3: full PS/2 driver – self-test, clock on, IRQ1 unmasked, single-byte buffering

step4: drain-loop IRQ handler; full ring-buffer active

step5: add send_with_ack() with RESEND retry; enable keyboard scanning (0xF4)

step7: implemented some unit tests to debug buffers

fix: readded comments from previous controller, moved ps2.init() to enable debug macro

feature: added IRQ1 self-test when init.
workflow: rebased with upstream
…for init, reworked ISR to handle drop parity/timeout => make/break logs + prefixes
@bradjc
Copy link
Contributor

bradjc commented Sep 26, 2025

Is there a PR that uses this in main.rs? It would be good to have an example of using the keyboard, particularly so we can try it out.

@domnudragota
Copy link
Contributor Author

domnudragota commented Sep 26, 2025

Yes! A PR is in the works, the TextScreen capsule PR includes a minimal main.rs wiring so you can type into the ProcessConsole via VGA.

Here's how it looks : left is the PC on VGA, right is Serial for debugging

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocked Waiting on something, like a different PR or a dependency.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants