main/ttyescape: upgrade to hkdm/buffyboard (MR 2713)

This upgrades ttyescape to use buffyboard, a new fbkeyboard replacement
by @Cherrypicker. It adds a lot of missing keys and uses the same layout
as Phosh's Squeekboard, so should feel much more like home for Phosh
users.

This also switches to the new HKDM daemon for hotkey handling, replacing
triggerhappy.

[ci:skip-build] already passed
This commit is contained in:
Caleb Connolly 2021-11-27 21:21:16 +00:00
parent c47c62e31f
commit 029cf83cf1
No known key found for this signature in database
GPG key ID: 0583312B195F64B6
6 changed files with 39 additions and 21 deletions

View file

@ -1,16 +1,17 @@
# Maintainer: Caleb Connolly <caleb@connolly.tech> # Maintainer: Caleb Connolly <caleb@connolly.tech>
pkgname=ttyescape pkgname=ttyescape
pkgver=0.1 pkgver=0.2
pkgrel=0 pkgrel=0
pkgdesc="Daemon to allow users to escape to a tty" pkgdesc="Daemon to allow users to escape to a tty"
url="https://postmarketos.org" url="https://postmarketos.org"
arch="all" arch="noarch"
license="GPL-3.0-or-later" license="GPL-3.0-or-later"
depends="triggerhappy fbkeyboard terminus-font kbd" depends="hkdm buffyboard terminus-font kbd"
install="$pkgname.post-install" install="$pkgname.post-install"
subpackages="$pkgname-openrc"
source=" source="
togglevt.sh togglevt.sh
ttyescape-triggerhappy.conf ttyescape-hkdm.toml
etc-conf-d-ttyescape.conf etc-conf-d-ttyescape.conf
" "
options="!check" options="!check"
@ -19,15 +20,15 @@ package() {
install -Dm755 "$srcdir"/togglevt.sh \ install -Dm755 "$srcdir"/togglevt.sh \
"$pkgdir"/usr/bin/togglevt.sh "$pkgdir"/usr/bin/togglevt.sh
install -Dm755 "$srcdir"/ttyescape-triggerhappy.conf \ install -Dm755 "$srcdir"/ttyescape-hkdm.toml \
"$pkgdir"/etc/triggerhappy/triggers.d/ttyescape.conf "$pkgdir"/etc/hkdm/config.d/ttyescape.toml
install -Dm755 "$srcdir"/etc-conf-d-ttyescape.conf \ install -Dm755 "$srcdir"/etc-conf-d-ttyescape.conf \
"$pkgdir"/etc/conf.d/ttyescape.conf "$pkgdir"/etc/conf.d/ttyescape.conf
} }
sha512sums=" sha512sums="
5a56740678073c72c1952e36742fb0786f932e718835c39502ab51f9731426e2b8479de38d4c44c35bc84a895b74ea0dc7bd39fd9eb89b603973ed6e43abb377 togglevt.sh d7447788044b76862688f4fbd722725a787f8fe07ef1d8fde34f01591e680dd782fd4085fd80166a695e0016162d4a8701e749ae4a56a9cf8ae388ab43ef72e1 togglevt.sh
f8bf3273cf87392ab2092a005417bc58cb3ae6ad25b9118b76c68481d9d8fc7d964a9d16fc7645f6f9ff0676dccd381be3b846464b2e60a6452b8c883bffb6f1 ttyescape-triggerhappy.conf 88034b54b06a962ff353a7a5a272352b56fdb564231a13be85b73d9dfc991d1ec8085014ebfcd5c6eaee67e62341dd2c9c7ace91a2c839702ae3b7f6007433f4 ttyescape-hkdm.toml
5429c7029e6db292cccbd4d5fdb4eb07cbbe050fe886784ebb1f88d790de35c06714c2ad38d366d88ed78a09d4d20e0826541f8f578885384ff6b033ac606af8 etc-conf-d-ttyescape.conf ac06c2ae2b3b8404d6ed79a046b175abbeb2360033edcaa22c21e1a61c68913e58013e9200ee5b786eee9020a2c78d1bda09c72d87ea0998bf6eeb71da015a2f etc-conf-d-ttyescape.conf
" "

View file

@ -6,3 +6,4 @@ FONT="/usr/share/consolefonts/ter-128n.psf.gz"
PRESSCOUNT=3 PRESSCOUNT=3
# tmpfile to use for counting state # tmpfile to use for counting state
TMPFILE="/tmp/ttyescape.tmp" TMPFILE="/tmp/ttyescape.tmp"
KEYBOARD="buffyboard"

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# Toggle between tty1 and tty2, launching fbkeyboard when on tty2 # Toggle between tty1 and tty2, launching $KEYBOARD when on tty2
# THIS SCRIPT MUST BE RUN AS ROOT # THIS SCRIPT MUST BE RUN AS ROOT
# usage: # usage:
# togglevt.sh <state> # togglevt.sh <state>
@ -19,6 +19,7 @@ FONT="${FONT:-/usr/share/consolefonts/ter-128n.psf.gz}"
# amount of times power must be pressed to trigger # amount of times power must be pressed to trigger
PRESSCOUNT="${PRESSCOUNT:-3}" PRESSCOUNT="${PRESSCOUNT:-3}"
TMPFILE="${TMPFILE:-/tmp/ttyescape.tmp}" TMPFILE="${TMPFILE:-/tmp/ttyescape.tmp}"
KEYBOARD="${KEYBOARD:-buffyboard}"
if [ ! -e /dev/uinput ]; then if [ ! -e /dev/uinput ]; then
if ! modprobe -q uinput; then if ! modprobe -q uinput; then
@ -31,12 +32,12 @@ switchtty() {
if [ "$currentvt" = "tty2" ]; then # switch to tty1 with normal UI if [ "$currentvt" = "tty2" ]; then # switch to tty1 with normal UI
chvt 1 chvt 1
killall fbkeyboard killall "$KEYBOARD"
else # Switch to tty2 with fbkeyboard else # Switch to tty2 with $KEYBOARD
setfont "$FONT" -C /dev/tty2 setfont "$FONT" -C /dev/tty2
chvt 2 chvt 2
# sometimes fbkeyboard can be running already, we shouldn't start it in that case # sometimes they keyboard can be running already, we shouldn't start it in that case
[ "$(pgrep fbkeyboard)" ] || nohup fbkeyboard -r "$(cat /sys/class/graphics/fbcon/rotate)" & [ "$(pgrep "$KEYBOARD")" ] || nohup "$KEYBOARD" -r "$(cat /sys/class/graphics/fbcon/rotate)" &
fi fi
} }

View file

@ -0,0 +1,20 @@
[[events]]
name = "increment"
event_type = "EV_KEY"
key_state = "released"
keys = ["KEY_VOLUMEDOWN", "KEY_POWER"]
command = "/usr/bin/togglevt.sh inc"
[[events]]
name = "start"
event_type = "EV_KEY"
key_state = "pressed"
keys = ["KEY_VOLUMEDOWN"]
command = "/usr/bin/togglevt.sh start"
[[events]]
name = "reset"
event_type = "EV_KEY"
key_state = "released"
keys = ["KEY_VOLUMEDOWN"]
command = "/usr/bin/togglevt.sh reset"

View file

@ -1,5 +0,0 @@
KEY_POWER+KEY_VOLUMEDOWN 0 /usr/bin/togglevt.sh inc
KEY_VOLUMEDOWN 1 /usr/bin/togglevt.sh start
KEY_VOLUMEDOWN 0 /usr/bin/togglevt.sh reset
# noop to prevent garbage being typed in console
KEY_VOLUMEDOWN 2 /bin/true

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/sh
# Enable triggerhappy # Enable hkdm
rc-update -q add triggerhappy default rc-update -q add hkdm default