stockmind / dell-xps-9560-ubuntu-respin

Collection of scripts and tweaks to adapt Ubuntu and Linux Mint ISO images to let them run smooth on Dell XPS 15 9560.
345 stars 155 forks source link

Touch screen power saving #14

Open luispabon opened 6 years ago

luispabon commented 6 years ago

Another power top tunable that could be set on boot:

echo 'auto' > '/sys/bus/usb/devices/1-9/power/control';
luispabon commented 6 years ago

/lib/systemd/system/touchscren-powersave.service

[Unit]
Description=Enable touch screen powersave

[Service]
Type=oneshot
ExecStart=/bin/sh -c "echo 'auto' > '/sys/bus/usb/devices/1-9/power/control';"

[Install]
WantedBy=default.target
sudo systemctl enable touchscren-powersave
luispabon commented 6 years ago

The reason I have these as services is because powertop autotune messes up with certain devices I have sometimes connected on boot. For instance my external keyboard or mouse become unresponsive on first interaction if they're idle for more than a few seconds, which is infuriating.

ryanshow commented 6 years ago

For some reason this script was working for me when invoking it manually, but not on boot. I think that there is some other process setting the autosuspend setting to "on" after the touchscreen-powersave service runs.

Regardless, I managed to make it work by changing the Type line to:

Type=idle

This delays the execution of the service to later in the boot to ensure that it won't be overridden by whatever was forcing autosuspend off.