Skip to content

Instantly share code, notes, and snippets.

@cesarmiquel
Created September 22, 2017 21:10
Show Gist options
  • Save cesarmiquel/c19d8af6e9bdd127695362b8647b9833 to your computer and use it in GitHub Desktop.
Save cesarmiquel/c19d8af6e9bdd127695362b8647b9833 to your computer and use it in GitHub Desktop.
Ubuntu 17.04 worked out of the box, but there was one annoyance: battery life. For some reason, the laptop was using 10 watts at idle. Thanks to some forum posts, I managed to tweak various kernel module options and got idle down to 4 watts. This drastically improved battery life. I then put together a script to enable power savings on startup. …
#!/bin/sh
# Disable the NMI watchdog
echo '0' > '/proc/sys/kernel/nmi_watchdog';
# Runtime power management for I2C devices
for i in /sys/bus/i2c/devices/*/device/power/control ; do
echo auto > ${i}
done
# Runtime power-management for PCI devices
for i in /sys/bus/pci/devices/*/power/control ; do
echo auto > ${i}
done
# Runtime power-management for USB devices
for i in /sys/bus/usb/devices/*/power/control ; do
echo auto > ${i}
done
# Low power SATA
for i in /sys/class/scsi_host/*/link_power_management_policy ; do
echo min_power > ${i}
done
# Disable Wake-on-LAN on ethernet port
ethtool -s wlan0 wol d;
ethtool -s eth0 wol d
#Enable Audio codec power management
echo '1' > '/sys/module/snd_hda_intel/parameters/power_save';
# Low power wireless
iw dev wlan0 set power_save on
@cesarmiquel
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment