Skip to content

Add support for detecting a physical keyboard

clayton craft requested to merge phys_keyboard into master

This queries input device 'key' capabilities to try and determine if a physical keyboard is present.

If one is present, it hides the on-screen keyboard.

A button is added to the screen when the keyboard is hidden that, when tapped or clicked, will show the osk. This is there in case the physical keyboard detection stuff is wrong, so there's still a way to unlock devices using the touchscreen. This could be refactored later on to support other types of buttons (e.g. poweroff).

testing

The easiest way to test this out in initfs with postmarketOS is to build the package using pmbootstrap and sideload it:

$ pmbootstrap build osk-sdl --src /path/to/this/branch
$ pmbootstrap sideload osk-sdl

You might also want to enable the initfs debug shell so you can recover if things go sideways. If osk-sdl fails for some reason, you can manually unlock the rootfs with crytpsetup in the debug shell then run pmos_continue_boot.

I tested this on the pinebook pro, and the librem 5. On the librem 5, the on-screen keyboard always showed up until I plugged in a dock with a usb keyboard, then I got the minimal UI. On the PBP, I always got the minimal UI since it always has a keyboard connected.

Edited by clayton craft

Merge request reports