mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 12:28:40 +00:00
droiddeckctl input pen hover, tap, stroke and button register a virtual direct pen with `adb shell uinput -` and play the gesture through it, so Android's input reader makes the same stylus events a built-in pen does, with pressure, tilt, distance, the eraser and both side buttons. The app is not involved, which lets pen handling be tested without a pen. Positions are fractions of the screen as shown, placed inside the physical frame of the internal display viewport in dumpsys input: the frame is smaller than the panel when `wm size` sets another aspect ratio, and Android drops pen events outside it. The rotation and size come from the same viewport. The values are checked before anything runs on the device. The script waits 1 s after registering, since uinput reads it in one go and cannot wait for the device, and does not reset uinput's time base after that, which would drop the first samples. Contact sends a pressure of at least 1, because Android takes a pen at pressure 0 for a hovering one, and a lift first moves to where it lifts, because Android's UP repeats the last contact. A pen held still moves by one unit without leaving the physical frame so that it keeps reporting, since the kernel drops frames that change nothing. Co-authored-by: alien2003 <11610652+alien2003@users.noreply.github.com>