Skip to content

Forward the tablet's hardware keyboard and hide the Windows touch keyboard while it is attached - #8

Merged
FacuM merged 1 commit into
mainfrom
hardware-keyboard
Oct 26, 2026
Merged

FacuM merged 1 commit into
mainfrom
hardware-keyboard

Conversation

@FacuM

@FacuM FacuM commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The tablet's hardware keyboard (for example a keyboard cover) now reaches the PC. Previously the Android client never forwarded KeyEvents, so only gestures could send keys. While a keyboard is attached, the Windows host also stops taps on text fields from opening the touch keyboard.

Changes

  • Android: MainActivity forwards key events from physical alphabetic keyboards and keeps Android's volume, power, home and media keys. Key codes map to HID usages in ezd-android keys.rs. Held keys are released on focus loss, pause and session stop. The activity no longer restarts when a keyboard is attached.
  • Input: a key-down for a key that is already held is an autorepeat. The Windows host injects another key-down (SendInput has no typematic), and the Linux host emits EV_KEY value 2. Gesture combos no longer send the same usage twice.
  • Protocol 0.6: adds ClientKeyboard { attached } (Control, 17). Documented in docs/protocol.md.
  • Windows host: while a keyboard is attached, sets the TouchKeyboardTapInvoke value under the HKCU TabletTip key to 0. The original value is restored on detach and at session end. A crash marker under HKCU\Software\LibreStatic\ezdisplay restores the value at startup if the process died while the change was active.

Scope notes

  • The Windows touch keyboard registry change is only made while a keyboard is reported as attached.
  • Linux host changes are limited to autorepeat handling.

Verification

  • cargo test --workspace --exclude ezd-tray: passed. ezd-tray is excluded because the local rustc is older than it requires.
  • cargo clippy --workspace --exclude ezd-tray --all-targets -- -D warnings: clean.
  • cargo check and clippy for ezd-host-windows with x86_64-pc-windows-msvc --no-default-features: clean.
  • Android: ./gradlew assembleFullDebug lintFullDebug testFullDebugUnitTest: successful.

Not yet tested on real hardware. Manual checklist:

  • Keys typed on the tablet keyboard reach the PC, and a held key autorepeats.
  • Tapping a text field does not open the touch keyboard while the cover is attached.
  • TouchKeyboardTapInvoke returns to its previous value after detaching the keyboard and after ending the session.

…board while it is attached

The Android client never forwarded KeyEvents. Message::Key existed and both hosts
injected it, but only gestures produced it.

- MainActivity forwards keys from physical alphabetic keyboards and keeps Android's
  volume, power, home and media keys. Keys are mapped by key code to HID usages in
  ezd-android keys.rs. Held keys are released on focus loss, pause and session stop.
- A key-down for a key already held is an autorepeat. The Windows host injects another
  key-down because SendInput has no typematic, and the Linux host emits EV_KEY value 2.
  Gesture combos no longer send the same usage twice.
- Protocol 0.6 adds ClientKeyboard { attached } (Control/17). The Android app reports it
  from the configuration and no longer restarts MainActivity when a keyboard is attached.
- While attached, the Windows host sets HKCU TabletTip TouchKeyboardTapInvoke to 0 so taps
  on text fields do not open the touch keyboard. It restores the original value on detach
  and at session end, and keeps a crash marker under HKCU\Software\LibreStatic\ezdisplay
  that is restored at startup.
@FacuM
FacuM force-pushed the hardware-keyboard branch from adfcd93 to 867eba2 Compare October 26, 2026 00:00
@FacuM
FacuM merged commit d4b44bf into main Oct 26, 2026
10 checks passed
@FacuM
FacuM deleted the hardware-keyboard branch October 26, 2026 00:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant