Skip to content

Instantly share code, notes, and snippets.

@omgmog
Created August 27, 2019 08:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omgmog/994e186eab6ec356d13616740efd5fd6 to your computer and use it in GitHub Desktop.
Save omgmog/994e186eab6ec356d13616740efd5fd6 to your computer and use it in GitHub Desktop.
/usr/sbin/pocketchip-load patched to disable/enable touch input while sleeping
#!/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