volanin
May 26th, 2009, 11:24 AM
Ubuntu is already very good at energy-saving while your macbook is idle. But there are some extra watts you can easily save to increase battery time even more! Two of the most common are:
1. Disable wireless if you don't need it!
Even if you aren't connected to a wireless network, your adapter is still sitting there using about 2 watts of power for nothing. To prevent it from wasting this energy, you can unload the driver/module from the system, effectively turning off the device.
To make this process very easy, copy the following lines into a script and create an icon for it in the desktop or the panel. Everytime you run it, it will load or unload the driver/module, turning the wireless adapter on/off!
lsmod | grep -q ath9k
if [ $? == 0 ]; then
zenity --question --text "Do you want to turn wireless OFF?"
if [ $? == 0 ]; then gksudo rmmod ath9k; fi
else
zenity --question --text "Do you want to turn wireless ON?"
if [ $? == 0 ]; then gksudo modprobe ath9k; fi
fi
2. Properly enable USB autosuspend!
The macbook is mostly USB based. The keyboard, the trackpad and almost every other device in the machine uses the USB bus to operate. You can easily save another 1-2 watts of power by allowing linux to suspend the USB devices when they are idle. This is exacly what powertop does when you press the 'U' key, but it is not enabled by default every boot.
Copy the lines below to the beginning of your /etc/rc.local file:
for DEVICE in /sys/bus/usb/devices/*; do
if [ -w $DEVICE/power/autosuspend ]; then
echo 0 > $DEVICE/power/autosuspend
fi
if [ -w $DEVICE/power/level ]; then
echo auto > $DEVICE/power/level
fi
done
This should do it!
I hope you can enjoy the extra battery time you'll get!
1. Disable wireless if you don't need it!
Even if you aren't connected to a wireless network, your adapter is still sitting there using about 2 watts of power for nothing. To prevent it from wasting this energy, you can unload the driver/module from the system, effectively turning off the device.
To make this process very easy, copy the following lines into a script and create an icon for it in the desktop or the panel. Everytime you run it, it will load or unload the driver/module, turning the wireless adapter on/off!
lsmod | grep -q ath9k
if [ $? == 0 ]; then
zenity --question --text "Do you want to turn wireless OFF?"
if [ $? == 0 ]; then gksudo rmmod ath9k; fi
else
zenity --question --text "Do you want to turn wireless ON?"
if [ $? == 0 ]; then gksudo modprobe ath9k; fi
fi
2. Properly enable USB autosuspend!
The macbook is mostly USB based. The keyboard, the trackpad and almost every other device in the machine uses the USB bus to operate. You can easily save another 1-2 watts of power by allowing linux to suspend the USB devices when they are idle. This is exacly what powertop does when you press the 'U' key, but it is not enabled by default every boot.
Copy the lines below to the beginning of your /etc/rc.local file:
for DEVICE in /sys/bus/usb/devices/*; do
if [ -w $DEVICE/power/autosuspend ]; then
echo 0 > $DEVICE/power/autosuspend
fi
if [ -w $DEVICE/power/level ]; then
echo auto > $DEVICE/power/level
fi
done
This should do it!
I hope you can enjoy the extra battery time you'll get!