main/postmarketos-ui-fbkeyboard: support rotated fbcon, remove unneeded console resize (MR 1410)

This commit is contained in:
Ferenc Bakonyi 2020-07-01 23:07:55 +02:00 committed by Alexey Min
parent 2f1fb6c371
commit 39b6a7e19c
No known key found for this signature in database
GPG key ID: EBF5ECFFFEE34DED
2 changed files with 4 additions and 58 deletions

View file

@ -1,12 +1,12 @@
# Maintainer: Ferenc Bakonyi <bakonyi.ferenc@gmail.com>
pkgname=postmarketos-ui-fbkeyboard
pkgver=1
pkgrel=0
pkgrel=1
pkgdesc="Plain framebuffer console with touchscreen keyboard support"
url="https://github.com/bakonyiferenc/fbkeyboard"
arch="all"
license="GPL-3.0-or-later"
depends="fbkeyboard coreutils"
depends="fbkeyboard"
install="$pkgname.post-install $pkgname.pre-deinstall $pkgname.post-upgrade"
source="fbkeyboard.init"
options="!check" # No tests
@ -15,4 +15,4 @@ package() {
install -Dm755 "$srcdir"/fbkeyboard.init "$pkgdir"/etc/init.d/fbkeyboard
}
sha512sums="386ce9bb48a75a0cbe2dd3617eaa700368d8b3a55d502a15d16415fdebbb3234893a8e0247ff63b6222017c57c1103a0922581311b9d6bbe63b2f7699ea6f15c fbkeyboard.init"
sha512sums="1341e2a4ba9187f2538f210c3c4bcd8e2e79341552391b3ce57fb2f0d9a8c99a4d7c182d82d2d8f73caea22ace25530fe42e6b16040e8aa7dc62b4e96a5db81d fbkeyboard.init"

View file

@ -2,6 +2,7 @@
name="fbkeyboard"
command="/usr/bin/fbkeyboard"
command_args="-r $(cat /sys/class/graphics/fbcon/rotate)"
pidfile="/var/run/fbkeyboard.pid"
command_background=true
@ -20,59 +21,4 @@ start_pre()
"the fbkeyboard service or built in."
fi
fi
ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}}
if [ "$ttyn" = 0 ]; then
ebegin "Skipping console setup (rc_tty_number == 0)"
eend 0
return 0
fi
local x= rows= retval=0 ttydev=/dev/tty
# Set the console size to 2/3, fbkeyboard uses 1/3
ebegin "Setting console size"
[ -d /dev/vc ] && ttydev=/dev/vc/
x=1
while [ $x -le $ttyn ]; do
rows=$(stty -F $ttydev$x size | awk '{print $1}')
rows=$(($rows * 2 / 3))
if ! stty -F $ttydev$x rows $rows >/dev/null; then
retval=1
break
fi
: $(( x += 1 ))
done
eend $retval
return $retval
}
stop_post()
{
ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}}
if [ "$ttyn" = 0 ]; then
ebegin "Skipping console setup (rc_tty_number == 0)"
eend 0
return 0
fi
local x= rows= ttydev=/dev/tty
# Reset the console size by recalculating the maximum supported rows value
ebegin "Resetting console size"
[ -d /dev/vc ] && ttydev=/dev/vc/
x=1
while [ $x -le $ttyn ]; do
rows=$(($(stty -F $ttydev$x size | awk '{print $1}') * 2))
while stty -F $ttydev$x rows $rows >/dev/null 2>/dev/null ; do
rows=$(($rows * 2))
done
until stty -F $ttydev$x rows $rows >/dev/null 2>/dev/null ; do
: $((rows--))
done
: $(( x += 1 ))
done
}