-
-
Notifications
You must be signed in to change notification settings - Fork 779
x86_q35: add keyboard driver over i8042 controller #4595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
domnudragota
wants to merge
40
commits into
tock:master
Choose a base branch
from
WyliodrinEmbeddedIoT:ps2-keyboard-v2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 tasks
alexandruradovici
requested changes
Sep 11, 2025
88296c7
to
b91c7ad
Compare
There was a problem hiding this 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.
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
…lf to keep ISR tny, minor polish
…spin number, removed helper functions
…vide API for keyevent/keyboardClient
…, optional AsciiClient for future capsule
… keyboard works, removed debug messages
7194e7a
to
842c77b
Compare
bradjc
reviewed
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. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
/docs
, or no updates are required.Formatting
make prepush
.