diff --git a/aports/main/charging-sdl/APKBUILD b/aports/main/charging-sdl/APKBUILD new file mode 100644 index 00000000..66267bff --- /dev/null +++ b/aports/main/charging-sdl/APKBUILD @@ -0,0 +1,24 @@ +pkgname=charging-sdl +pkgver=0.1 +pkgrel=0 +pkgdesc="SDL2 charging application for the initramfs" +url="https://github.com/postmarketOS/charging-sdl" +arch="all" +license="GPL3" +depends="sdl2 sdl2_ttf mesa-gl directfb" +makedepends="linux-headers sdl2-dev sdl2_ttf-dev" +subpackages="" +source="${pkgname}-${pkgver}.tar.gz::https://github.com/postmarketOS/charging-sdl/archive/${pkgver}.tar.gz" +options="!strip" +builddir="${srcdir}/${pkgname}-${pkgver}" + +build() { + make +} + +package() { + install -D -m755 "${builddir}"/charging_sdl \ + "$pkgdir"/usr/bin/charging-sdl +} + +sha512sums="61cb132da5780f230280eb9cd24971cc2ea038890b098ccd04f842eb80c2ebfa3a27d619e28d8a37fe64c5a3863fbab68e2842d830f7f4658e52888436647858 charging-sdl-0.1.tar.gz" diff --git a/aports/main/postmarketos-mkinitfs/APKBUILD b/aports/main/postmarketos-mkinitfs/APKBUILD index 51708d47..405852a6 100644 --- a/aports/main/postmarketos-mkinitfs/APKBUILD +++ b/aports/main/postmarketos-mkinitfs/APKBUILD @@ -1,10 +1,11 @@ pkgname=postmarketos-mkinitfs -pkgver=0.5.11 +pkgver=0.6.1 pkgrel=0 pkgdesc="Tool to generate initramfs images for postmarketOS" url="https://github.com/postmarketOS" # multipath-tools: kpartx -depends="busybox-extras lddtree cryptsetup kmod multipath-tools postmarketos-splash device-mapper parted e2fsprogs e2fsprogs-extra osk-sdl" +depends="busybox-extras lddtree cryptsetup kmod multipath-tools postmarketos-splash + device-mapper parted e2fsprogs e2fsprogs-extra osk-sdl charging-sdl triggerhappy" triggers="$pkgname.trigger=/etc/postmarketos-mkinitfs/hooks:/usr/share/kernel/*" source="init.sh.in init_functions.sh mkinitfs.sh" arch="noarch" @@ -22,6 +23,6 @@ package() { "$pkgdir/sbin/mkinitfs" mkdir -p "$pkgdir/etc/postmarketos-mkinitfs/hooks/" } -sha512sums="500c1e903ca9cf5dfe0102414b086643379d51d848e15eeed89da8ba9f3a286dfba139a29b8312a0df005e159a54ad08c84e078b7d70e6873cabb7d0abda4807 init.sh.in -eca1e4647494556be52b3eecffe2db75735006a6c53e8778630949808aabc464281ffa75a8744e22a5512c2de1eb5f92f9eb377a55ca4a7402ba8cc0705df83d init_functions.sh -c9b6dd04413509185f74b3d97bc01c97f8b9392e2f0dbccbd9c968efb7d375236b30337bd1637c467816c44d1c40feb354fe7206ac99faed0e1b207a30758cd0 mkinitfs.sh" +sha512sums="a09a48026a5cac308fa54e37c72e89fd7901e749f73720f3e8d3ec11a4d1527dbc1e5011aff53b1beffb6ff444c8df11a56e43d27ac0180ce8ddc79332be1d0d init.sh.in +f45548b295393cb078e4c456acef0eaac11705c4b5bc33981c320580c843231589fdfc78b25e182cd202435381d1be37085df01b6e272eee0af2ca0f89b3b4f5 init_functions.sh +5075df824ae86cc73590513a2212411a5aa2a840268c3850ea22e541717ce254e15b812f98c22e708fb0a21d87b8c6eb0059cf667ca3350412e39dad2d81879e mkinitfs.sh" diff --git a/aports/main/postmarketos-mkinitfs/init.sh.in b/aports/main/postmarketos-mkinitfs/init.sh.in index 165bda00..26fde66a 100644 --- a/aports/main/postmarketos-mkinitfs/init.sh.in +++ b/aports/main/postmarketos-mkinitfs/init.sh.in @@ -37,6 +37,7 @@ start_udhcpd mount_boot_partition extract_initramfs_extra @INITRAMFS_EXTRA@ +start_charging_mode wait_root_partition resize_root_partition unlock_root_partition diff --git a/aports/main/postmarketos-mkinitfs/init_functions.sh b/aports/main/postmarketos-mkinitfs/init_functions.sh index d0aac1bd..e9cf27e1 100644 --- a/aports/main/postmarketos-mkinitfs/init_functions.sh +++ b/aports/main/postmarketos-mkinitfs/init_functions.sh @@ -267,8 +267,8 @@ start_udhcpd() { udhcpd } -start_onscreen_keyboard(){ - # Set up directfb and tslib for osk-sdl +setup_directfb_tslib(){ + # Set up directfb and tslib # Note: linux_input module is disabled since it will try to take over # the touchscreen device from tslib (e.g. on the N900) export DFBARGS="system=fbdev,no-cursor,disable-module=linux_input" @@ -276,11 +276,37 @@ start_onscreen_keyboard(){ if [ ! -z "$deviceinfo_dev_touchscreen" ]; then export TSLIB_TSDEVICE="$deviceinfo_dev_touchscreen" fi +} + +start_onscreen_keyboard(){ + setup_directfb_tslib osk-sdl -n root -d "$partition" -c /etc/osk.conf -v > /osk-sdl.log 2>&1 unset DFBARGS unset TSLIB_TSDEVICE } +start_charging_mode(){ + # Check cmdline for charging mode + chargingmodes=" + androidboot.mode=charger + lpm_boot=1 + androidboot.huawei_type=oem_rtc + startup=0x00010004 + " + # shellcheck disable=SC2086 + grep -Eq "$(echo $chargingmodes | tr ' ' '|')" /proc/cmdline || return + setup_directfb_tslib + # Get the font from osk-sdl config + fontpath=$(awk '/^keyboard-font/{print $3}' /etc/osk.conf) + # Set up triggerhappy config + { + echo "KEY_POWER 1 pgrep -x charging-sdl || charging-sdl -pcf $fontpath" + } >/etc/triggerhappy.conf + # Start it once and then start triggerhappy + charging-sdl -pcf "$fontpath" & + thd --deviceglob /dev/input/event* --triggers /etc/triggerhappy.conf +} + # $1: path to ppm.gz file show_splash() { gzip -c -d "$1" >/tmp/splash.ppm diff --git a/aports/main/postmarketos-mkinitfs/mkinitfs.sh b/aports/main/postmarketos-mkinitfs/mkinitfs.sh index 54ebd286..3b7a8251 100644 --- a/aports/main/postmarketos-mkinitfs/mkinitfs.sh +++ b/aports/main/postmarketos-mkinitfs/mkinitfs.sh @@ -92,17 +92,19 @@ get_modules() # Get the paths to all binaries and their dependencies BINARIES="/bin/busybox /bin/busybox-extras /usr/sbin/telnetd /sbin/kpartx" BINARIES_EXTRA=" - /sbin/cryptsetup - /sbin/dmsetup - /usr/sbin/parted - /sbin/e2fsck - /usr/sbin/resize2fs - /usr/bin/osk-sdl - /usr/lib/libGL.so.1 - /usr/lib/ts/* - /usr/lib/libts* $(find /usr/lib/directfb-* -name '*.so') /lib/libz.so.1 + /sbin/cryptsetup + /sbin/dmsetup + /sbin/e2fsck + /usr/bin/charging-sdl + /usr/bin/osk-sdl + /usr/lib/libGL.so.1 + /usr/lib/libts* + /usr/lib/ts/* + /usr/sbin/parted + /usr/sbin/resize2fs + /usr/sbin/thd " get_binaries() {