Skip to content

Instantly share code, notes, and snippets.

@shinyquagsire23
Created January 12, 2020 22:15
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 shinyquagsire23/2a5b472abe3221c52b8be817d4145260 to your computer and use it in GitHub Desktop.
Save shinyquagsire23/2a5b472abe3221c52b8be817d4145260 to your computer and use it in GitHub Desktop.
Surface Go ChromeOS touchscreen fix - on-wake script and upstart daemon config
#!/bin/bash
# copy to /usr/sbin
interface=org.chromium.PowerManager
member=SetPolicy
# Run once just to be sure
echo "Surface Go fix daemon start..." > /dev/kmsg
echo "on" > /sys/devices/pci0000:00/0000:00:15.1/i2c_designware.1/power/control
# And run every time the system enters and returns from suspend
dbus-monitor --system "interface='$interface', member='$member'" |
while read update; do
if [[ "$update" =~ "$member" ]]; then
echo "Power policy updated... Fixing touchscreen." > /dev/kmsg
echo "on" > /sys/devices/pci0000:00/0000:00:15.1/i2c_designware.1/power/control
fi
done
# copy to /etc/init/
description "Surface Go touchscreen daemon"
author "Max Thomas mtinc2@gmail.com"
start on started powerd
stop on stopping powerd
expect fork
respawn
respawn limit 3 10 # if the job respawns 3 times in 10 seconds, stop trying.
env VMODULE_ARG=
env UPSTART_RUN=1
exec /usr/sbin/surfacego-touchscreen &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment