From 56c325ebc9edb8c828fc45284caa4b100b07a3ac Mon Sep 17 00:00:00 2001 From: fewtarius Date: Tue, 18 Jun 2024 10:20:31 +0000 Subject: [PATCH] Fix up wakeup lid checking. --- PKGBUILD/steamfork-device-support/PKGBUILD | 2 +- .../AYANEO-FLIP-DS/sleep.d/post/003-lid-check | 25 +++++++++++-------- .../AYANEO-FLIP-KB/sleep.d/post/003-lid-check | 25 +++++++++++-------- 3 files changed, 31 insertions(+), 21 deletions(-) diff --git a/PKGBUILD/steamfork-device-support/PKGBUILD b/PKGBUILD/steamfork-device-support/PKGBUILD index 04e1eeb9..fa941229 100644 --- a/PKGBUILD/steamfork-device-support/PKGBUILD +++ b/PKGBUILD/steamfork-device-support/PKGBUILD @@ -1,7 +1,7 @@ # Maintainer: Fewtarius pkgname=steamfork-device-support -pkgver=2024.06.17 +pkgver=2024.06.18 pkgrel=1 pkgdesc='Hardware support provider for PC handhelds.' arch=('any') diff --git a/PKGBUILD/steamfork-device-support/src/etc/lib/steamfork_hwsupport/devicequirks/AYANEO-FLIP-DS/sleep.d/post/003-lid-check b/PKGBUILD/steamfork-device-support/src/etc/lib/steamfork_hwsupport/devicequirks/AYANEO-FLIP-DS/sleep.d/post/003-lid-check index 8e398e37..4b975a84 100755 --- a/PKGBUILD/steamfork-device-support/src/etc/lib/steamfork_hwsupport/devicequirks/AYANEO-FLIP-DS/sleep.d/post/003-lid-check +++ b/PKGBUILD/steamfork-device-support/src/etc/lib/steamfork_hwsupport/devicequirks/AYANEO-FLIP-DS/sleep.d/post/003-lid-check @@ -5,13 +5,18 @@ # The Flip wakes when the lid is closed and the device is suspended # so, go back into the sleep state. -LID_STATE=$(awk '{printf $2}' /proc/acpi/button/lid/LID0/state) -for count in $(seq 1 1 5) -do - if [ "${LID_STATE}" = "open" ] - then - exit 0 - fi - sleep .1 -done -echo mem >/sys/power/state +if [ -f '/proc/acpi/button/lid/LID0/state' ] +then + ( + for count in $(seq 1 1 5) + do + LID_STATE=$(awk '{printf $2}' /proc/acpi/button/lid/LID0/state) + if [ "${LID_STATE}" = "open" ] + then + exit 0 + fi + sleep .2 + done + echo mem >/sys/power/state + ) & +fi diff --git a/PKGBUILD/steamfork-device-support/src/etc/lib/steamfork_hwsupport/devicequirks/AYANEO-FLIP-KB/sleep.d/post/003-lid-check b/PKGBUILD/steamfork-device-support/src/etc/lib/steamfork_hwsupport/devicequirks/AYANEO-FLIP-KB/sleep.d/post/003-lid-check index 8e398e37..4b975a84 100755 --- a/PKGBUILD/steamfork-device-support/src/etc/lib/steamfork_hwsupport/devicequirks/AYANEO-FLIP-KB/sleep.d/post/003-lid-check +++ b/PKGBUILD/steamfork-device-support/src/etc/lib/steamfork_hwsupport/devicequirks/AYANEO-FLIP-KB/sleep.d/post/003-lid-check @@ -5,13 +5,18 @@ # The Flip wakes when the lid is closed and the device is suspended # so, go back into the sleep state. -LID_STATE=$(awk '{printf $2}' /proc/acpi/button/lid/LID0/state) -for count in $(seq 1 1 5) -do - if [ "${LID_STATE}" = "open" ] - then - exit 0 - fi - sleep .1 -done -echo mem >/sys/power/state +if [ -f '/proc/acpi/button/lid/LID0/state' ] +then + ( + for count in $(seq 1 1 5) + do + LID_STATE=$(awk '{printf $2}' /proc/acpi/button/lid/LID0/state) + if [ "${LID_STATE}" = "open" ] + then + exit 0 + fi + sleep .2 + done + echo mem >/sys/power/state + ) & +fi