Created
August 27, 2019 08:36
-
-
Save omgmog/994e186eab6ec356d13616740efd5fd6 to your computer and use it in GitHub Desktop.
/usr/sbin/pocketchip-load patched to disable/enable touch input while sleeping
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export POCKETCHIP=true | |
function setPocketchip { | |
DISPLAY=:0 XAUTHORITY=${HOME}/.Xauthority xmodmap ${HOME}/.Xmodmap 2> /dev/null | |
STATUS="$?" | |
if [ "$STATUS" != "0" ] ; then | |
while [ "$STATUS" != "0" ] ; do | |
DISPLAY=:0 XAUTHORITY=${HOME}/.Xauthority xmodmap ${HOME}/.Xmodmap 2> /dev/null | |
STATUS="$?" | |
sleep 1 | |
done | |
fi | |
brightness=$(cat /sys/class/backlight/backlight/brightness) | |
while [ -f /sys/class/backlight/backlight/brightness ]; do | |
currentBrightness=$(cat /sys/class/backlight/backlight/brightness) | |
screen=$(XAUTHORITY=${HOME}/.Xauthority DISPLAY=:0 xset q 2> /dev/null | grep "is O") | |
if [[ $screen = *"is Of"* ]]; then | |
if [[ $currentBrightness != "0" ]]; then | |
currentBrightness = 0 | |
brightness=$(cat /sys/class/backlight/backlight/brightness) | |
echo 0 > /sys/class/backlight/backlight/brightness | |
# disable the touch input device | |
xinput disable 1c25000.rtp | |
fi | |
sleep 0.5 | |
else | |
if [[ $currentBrightness = "0" ]]; then | |
echo $brightness > /sys/class/backlight/backlight/brightness | |
# enable the touch input device | |
xinput enable 1c25000.rtp | |
fi | |
sleep 5 | |
fi | |
done | |
} | |
setPocketchip & | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment