Repository navigation
feat(input): raw keyboard event API for userland (#466) - #701
Merged
Merged
Conversation
- input/kbd/ring.rs: KeyEvent (16-byte ABI), bounded lock-free SPSC KeyEventRing (overwrite-oldest + dropped), and vk_from_scancode with the E0 split (#391: E0 arrows no longer collide with the numpad). - input/manager: per-VT KeyEventRing + raw flag; push on scancode; clear the ring when raw is enabled; clear raw when the foreground process exits. - kbd::process_scancode: emit every make/break with vk + modifiers; suppress cooked byte delivery while raw. - kwait: WaitReason::Keyboard { vt }; keyboard IRQ wakes a blocked reader. - ObInfoClass::KeyboardRead (44) / KeyboardPoll (45), ObSetInfoClass:: KeyboardSetRawMode (55). - libneodos: KeyEvent + VK table + kbd_set_raw/kbd_poll_event/kbd_read_event. - userbin/keyread: enables raw, prints make/break events, restores cooked. - tests: kbd_ring_push_pop_fifo, kbd_ring_overflow_drops_oldest, kbd_key_event_is_16_bytes, kbd_vk_extended_split. Verified: QEMU 960/960; VirtualBox guest keyread -> 'a'/'b' make/break, Up arrow (sc=72 vk=38 UP ext) and Ctrl+Space (mod=34 vk=32).
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
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.
Fixes #466.
What
A raw keyboard event API for Ring 3, per the design doc
docs/design/raw-keyboard-api-design.md.input/kbd/ring.rs—KeyEvent(16-byte ABI), bounded lock-free SPSCKeyEventRing(overwrite oldest +dropped), andvk_from_scancodewith the E0 split (KBD-EXTKEYS: Restaurar teclas extendidas (flechas/Home/End/Del) #391: E0 arrows no longer collide with the numpad). One ring + raw flag per VT (input/manager.rs); the ring is cleared when raw mode is enabled; raw is cleared when the foreground process exits.kbd::process_scancodeemits every make/break withvk+ modifiers and suppresses cooked byte delivery while raw.kwait::WaitReason::Keyboard { vt }; the keyboard IRQ wakes a blocked reader.ObInfoClass::KeyboardRead(44) /KeyboardPoll(45);ObSetInfoClass::KeyboardSetRawMode(55).KeyEvent+VK_*table +kbd_set_raw/kbd_poll_event/kbd_read_event.VirtualBox evidence (NAT, e1000)
keyreadin the guest:a/bmake/break, E0 Up arrow (vk=UP,ext), and Ctrl+Space (mod=34,vk=SPACE).Tests
neodev test: 960/960 (kbd_ring_push_pop_fifo,kbd_ring_overflow_drops_oldest,kbd_key_event_is_16_bytes,kbd_vk_extended_split).check-depsclean;check-irq-locksOK.Deferred (documented)
sys_pollkeyboard readiness and a distinct timeout status for the blocking read (the caller re-issues, likeob_wait). Rawcodepointis left 0 (clients usevk/scancode); text entry still goes through cooked stdin.Note
Full packaging requires the one-line NeoDev image-allowlist addition (
keyread), same as the other network/time userbins.