From 029cf83cf152acd1c3a3f2fd99eafe9344403faa Mon Sep 17 00:00:00 2001 From: Caleb Connolly Date: Sat, 27 Nov 2021 21:21:16 +0000 Subject: [PATCH] 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 --- main/ttyescape/APKBUILD | 19 ++++++++++--------- main/ttyescape/etc-conf-d-ttyescape.conf | 1 + main/ttyescape/togglevt.sh | 11 ++++++----- main/ttyescape/ttyescape-hkdm.toml | 20 ++++++++++++++++++++ main/ttyescape/ttyescape-triggerhappy.conf | 5 ----- main/ttyescape/ttyescape.post-install | 4 ++-- 6 files changed, 39 insertions(+), 21 deletions(-) create mode 100644 main/ttyescape/ttyescape-hkdm.toml delete mode 100644 main/ttyescape/ttyescape-triggerhappy.conf diff --git a/main/ttyescape/APKBUILD b/main/ttyescape/APKBUILD index 7d510ec72..9f4210381 100644 --- a/main/ttyescape/APKBUILD +++ b/main/ttyescape/APKBUILD @@ -1,16 +1,17 @@ # Maintainer: Caleb Connolly pkgname=ttyescape -pkgver=0.1 +pkgver=0.2 pkgrel=0 pkgdesc="Daemon to allow users to escape to a tty" url="https://postmarketos.org" -arch="all" +arch="noarch" license="GPL-3.0-or-later" -depends="triggerhappy fbkeyboard terminus-font kbd" +depends="hkdm buffyboard terminus-font kbd" install="$pkgname.post-install" +subpackages="$pkgname-openrc" source=" togglevt.sh - ttyescape-triggerhappy.conf + ttyescape-hkdm.toml etc-conf-d-ttyescape.conf " options="!check" @@ -19,15 +20,15 @@ package() { install -Dm755 "$srcdir"/togglevt.sh \ "$pkgdir"/usr/bin/togglevt.sh - install -Dm755 "$srcdir"/ttyescape-triggerhappy.conf \ - "$pkgdir"/etc/triggerhappy/triggers.d/ttyescape.conf + install -Dm755 "$srcdir"/ttyescape-hkdm.toml \ + "$pkgdir"/etc/hkdm/config.d/ttyescape.toml install -Dm755 "$srcdir"/etc-conf-d-ttyescape.conf \ "$pkgdir"/etc/conf.d/ttyescape.conf } sha512sums=" -5a56740678073c72c1952e36742fb0786f932e718835c39502ab51f9731426e2b8479de38d4c44c35bc84a895b74ea0dc7bd39fd9eb89b603973ed6e43abb377 togglevt.sh -f8bf3273cf87392ab2092a005417bc58cb3ae6ad25b9118b76c68481d9d8fc7d964a9d16fc7645f6f9ff0676dccd381be3b846464b2e60a6452b8c883bffb6f1 ttyescape-triggerhappy.conf -5429c7029e6db292cccbd4d5fdb4eb07cbbe050fe886784ebb1f88d790de35c06714c2ad38d366d88ed78a09d4d20e0826541f8f578885384ff6b033ac606af8 etc-conf-d-ttyescape.conf +d7447788044b76862688f4fbd722725a787f8fe07ef1d8fde34f01591e680dd782fd4085fd80166a695e0016162d4a8701e749ae4a56a9cf8ae388ab43ef72e1 togglevt.sh +88034b54b06a962ff353a7a5a272352b56fdb564231a13be85b73d9dfc991d1ec8085014ebfcd5c6eaee67e62341dd2c9c7ace91a2c839702ae3b7f6007433f4 ttyescape-hkdm.toml +ac06c2ae2b3b8404d6ed79a046b175abbeb2360033edcaa22c21e1a61c68913e58013e9200ee5b786eee9020a2c78d1bda09c72d87ea0998bf6eeb71da015a2f etc-conf-d-ttyescape.conf " diff --git a/main/ttyescape/etc-conf-d-ttyescape.conf b/main/ttyescape/etc-conf-d-ttyescape.conf index e60292b7e..6a4a19158 100644 --- a/main/ttyescape/etc-conf-d-ttyescape.conf +++ b/main/ttyescape/etc-conf-d-ttyescape.conf @@ -6,3 +6,4 @@ FONT="/usr/share/consolefonts/ter-128n.psf.gz" PRESSCOUNT=3 # tmpfile to use for counting state TMPFILE="/tmp/ttyescape.tmp" +KEYBOARD="buffyboard" diff --git a/main/ttyescape/togglevt.sh b/main/ttyescape/togglevt.sh index 33229a7be..2cef55d59 100644 --- a/main/ttyescape/togglevt.sh +++ b/main/ttyescape/togglevt.sh @@ -1,6 +1,6 @@ #!/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 # usage: # togglevt.sh @@ -19,6 +19,7 @@ FONT="${FONT:-/usr/share/consolefonts/ter-128n.psf.gz}" # amount of times power must be pressed to trigger PRESSCOUNT="${PRESSCOUNT:-3}" TMPFILE="${TMPFILE:-/tmp/ttyescape.tmp}" +KEYBOARD="${KEYBOARD:-buffyboard}" if [ ! -e /dev/uinput ]; then if ! modprobe -q uinput; then @@ -31,12 +32,12 @@ switchtty() { if [ "$currentvt" = "tty2" ]; then # switch to tty1 with normal UI chvt 1 - killall fbkeyboard - else # Switch to tty2 with fbkeyboard + killall "$KEYBOARD" + else # Switch to tty2 with $KEYBOARD setfont "$FONT" -C /dev/tty2 chvt 2 - # sometimes fbkeyboard can be running already, we shouldn't start it in that case - [ "$(pgrep fbkeyboard)" ] || nohup fbkeyboard -r "$(cat /sys/class/graphics/fbcon/rotate)" & + # sometimes they keyboard can be running already, we shouldn't start it in that case + [ "$(pgrep "$KEYBOARD")" ] || nohup "$KEYBOARD" -r "$(cat /sys/class/graphics/fbcon/rotate)" & fi } diff --git a/main/ttyescape/ttyescape-hkdm.toml b/main/ttyescape/ttyescape-hkdm.toml new file mode 100644 index 000000000..91dbc3b40 --- /dev/null +++ b/main/ttyescape/ttyescape-hkdm.toml @@ -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" \ No newline at end of file diff --git a/main/ttyescape/ttyescape-triggerhappy.conf b/main/ttyescape/ttyescape-triggerhappy.conf deleted file mode 100644 index ae37533f7..000000000 --- a/main/ttyescape/ttyescape-triggerhappy.conf +++ /dev/null @@ -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 diff --git a/main/ttyescape/ttyescape.post-install b/main/ttyescape/ttyescape.post-install index a304cd294..a994c7368 100644 --- a/main/ttyescape/ttyescape.post-install +++ b/main/ttyescape/ttyescape.post-install @@ -1,4 +1,4 @@ #!/bin/sh -# Enable triggerhappy -rc-update -q add triggerhappy default +# Enable hkdm +rc-update -q add hkdm default