Use systemd for Surface Go touch power management

Signed-off-by: Dorian Stoll <dorian.stoll@tmsp.io>
This commit is contained in:
Dorian Stoll 2019-12-28 22:13:53 +01:00 committed by Blaž Hrastnik
parent d563c17422
commit daf69af19c
2 changed files with 14 additions and 14 deletions

View file

@ -0,0 +1,11 @@
[Unit]
Description=Surface Go Touchscreen Power Management
[Service]
Type=oneshot
RemainAfterExit=yes
ConditionPathExists=/sys/devices/pci0000:00/0000:00:15.1/i2c_designware.1/power/control
Exec=/bin/sh -c "echo on > /sys/devices/pci0000:00/0000:00:15.1/i2c_designware.1/power/control"
[Install]
WantedBy=multi-user.target

View file

@ -37,8 +37,6 @@ ask() {
done
}
SUR_MODEL="$(dmidecode | grep "Product Name" -m 1 | xargs | sed -e 's/Product Name: //g')"
echo "==> Copying the config files under root to where they belong..."
for dir in $(ls root/); do
cp -Rbv "root/$dir/"* "/$dir/"
@ -50,6 +48,9 @@ cp -rv firmware/* /lib/firmware/
echo "==> Making /lib/systemd/system-sleep/sleep executable..."
chmod -v a+x /lib/systemd/system-sleep/sleep
echo "==> Enabling power management for Surface Go touchscreen..."
systemctl enable -q surfacego-touchscreen
echo
echo "Suspend is recommended over hibernate. If you chose to use"
@ -72,18 +73,6 @@ fi
echo
if [ "$SUR_MODEL" = "Surface Go" ]; then
if [ ! -f "/etc/init.d/surfacego-touchscreen" ]; then
echo "==> Patching power control for Surface Go touchscreen..."
echo "echo \"on\" > /sys/devices/pci0000:00/0000:00:15.1/i2c_designware.1/power/control" \
> /etc/init.d/surfacego-touchscreen
chmod -v 755 /etc/init.d/surfacego-touchscreen
update-rc.d surfacego-touchscreen defaults
fi
fi
echo
echo "Setting your clock to local time can fix issues with Windows dualboot."
if ask "Do you want to set your clock to local time instead of UTC?" N; then
echo "==> Setting clock to local time..."