Install a newer kernel
Code:
$ sudo add-apt-repository ppa:kernel-ppa/ppa
$ sudo apt-get update
$ sudo apt-get install linux-image-generic-pae-lts-backport-maverick \
linux-headers-generic-pae-lts-backport-maverick \
build-essential
Reboot to use the new kernel (2.6.35-19 at the time of writing).
Update: 2.6.35-19 is the best kernel I tried so far regarding battery usage, I can get as low as 8W with it, while newer kernels don't drop below 12W (tried 2.6.35-22 and 2.6.37-7 from the kernel PPA).
Install acpi_call to disable the Nvidia card
The Nvidia discrete graphics card doesn’t work at the time of this writing, so it’s best to completely disable it to save battery. You’ll need the acpi_call module to do so:
Code:
$ git clone http://github.com/mkottman/acpi_call.git
$ cd acpi_call
$ make
This builds a kernel module named acpi_call.ko. Try it and see if it works:
Code:
$ grep rate /proc/acpi/battery/BAT0/state
present rate: 19913 mW
$ sudo insmod acpi_call.ko
$ sudo echo '\_SB.PCI0.PEG1.GFX0._OFF' > /proc/acpi/call
$ grep rate /proc/acpi/battery/BAT0/state
present rate: 12558 mW
Copy the module to the current kernel's modules library. You'll need to do this after each kernel upgrade :
Code:
$ sudo cp acpi_call.ko /lib/modules/`uname -r`/kernel/drivers/acpi/
$ sudo depmod
And have it loaded at boot time: edit /etc/modules and add an acpi_call line to it. This is how it looks on my system after a fresh install:
Code:
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
lp
acpi_call
To disable the discrete graphics card at startup, edit /etc/rc.local and add the acpi_call command to it, e.g.:
Code:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
echo '\_SB.PCI0.PEG1.GFX0._OFF' > /proc/acpi/call
exit 0
Last but not least, blacklist the nouveau driver (it caused instability on my system when playing with acpi_call). Create a file named /etc/modprobe.d/blacklist-nvidia.conf with this content:
Code:
blacklist nouveau
blacklist nvidia
And regenerate the initramfs image for the current kernel:
Code:
$ sudo update-initramfs -u
Reboot, and verify your power consumption is at its minimum.
To have the acpi_call recompiled after each kernel upgrade, copy the acpi_call source to /usr/local/src:
Code:
$ cd .. && sudo mkdir -p /usr/local/src && sudo cp -r acpi_call /usr/local/src
Then create a script named /etc/kernel/postinst.d/acpi-call and put the following in it:
Code:
#!/bin/bash
# We're passed the version of the kernel being installed
inst_kern=$1
if [ ! -e /usr/local/src/acpi_call ] ; then
echo "acpi_call: WARNING - Failed to find source directory /usr/local/src/acpi_call. Cannot proceed" >&2
exit 0
fi
cd /usr/local/src/acpi_call/
rm -f acpi_call.ko
make
if [ ! -e acpi_call.ko ] ; then
echo "acpi_call: WARNING - Failed to build. Will not be installed in the new kernel" >&2
exit 0
fi
cp acpi_call.ko /lib/modules/${inst_kern}/kernel/drivers/acpi/
And make it executable:
Code:
$ sudo chmod 755 /etc/kernel/postinst.d/acpi-call
Make the trackpad toggle (Fn+F9) button work
Edit /etc/acpi/asus-touchpad.sh and replace the script with this:
Code:
#!/bin/sh
[ -f /usr/share/acpi-support/state-funcs ] || exit 0
. /usr/share/acpi-support/power-funcs
getXconsole
DEVICE_ID=`xinput -list | grep -i touchpad | grep id= | sed 's/.*id=\([0-9]*\).*/\1/' `
if xinput -list-props $DEVICE_ID | grep "Device Enabled" | grep "1$" > /dev/null
then
xinput set-int-prop $DEVICE_ID "Device Enabled" 8 0
else
xinput set-int-prop $DEVICE_ID "Device Enabled" 8 1
fi
Configure the trackpad for X
The trackpad is recognized correctly as a synaptics device with Maverick’s (2.6.35) kernel. This has the effect of making the “multitouch” functions stop to work. Add this in /etc/X11/xorg.conf to bring them back:
Code:
Section "InputClass"
Identifier "touchpad catchall"
MatchIsTouchpad "on"
MatchDevicePath "/dev/input/event*"
Driver "synaptics"
Option "VertTwoFingerScroll" "on"
Option "HorizTwoFingerScroll" "on"
Option "CircularScrolling" "off"
Option "CricularTrigger" "0"
Option "TapButton1" "1"
Option "TapButton2" "2"
Option "TapButton3" "3"
EndSection
Note: this may not be necessary, my trackpad only stopped to function properly once and I haven't been able to reproduce the issue. You can fix it if it happens to you with this config though.
Fix suspend
Suspend doesn’t work out of the box because of a problem with the USB buses, we need to disable them before going to sleep.
We also need to switch the nvidia card back on before suspending, or it becomes impossible to switch it off with acpi_call after two suspend cycles.
Create a file named /etc/pm/sleep.d/20_custom-asus-u35jc and paste this script:
Code:
#!/bin/sh
BUSES="0000:00:1a.0 0000:00:1d.0"
case "${1}" in
hibernate|suspend)
# Switch USB buses off
for bus in $BUSES; do
echo -n $bus | tee /sys/bus/pci/drivers/ehci_hcd/unbind
done
# Switch nvidia card on before going to sleep, avoids the "constant on"
# bug that occurs after 2 suspend/resume cycles (thanks kos888)
echo '\_SB.PCI0.PEG1.GFX0._ON' > /proc/acpi/call
;;
resume|thaw)
# Switch USB buses back on and nvidia card off
for bus in $BUSES; do
echo -n $bus | tee /sys/bus/pci/drivers/ehci_hcd/bind
done
echo '\_SB.PCI0.PEG1.GFX0._OFF' > /proc/acpi/call
;;
esac
Don’t forget to make it executable :
Code:
chmod +x /etc/pm/sleep.d/20_custom-asus-u35jc
Fix flipped webcam under Skype
The video comes out flipped upside down. Here is a trick to make it behave correctly under Skype. Create a script, e.g. in /usr/bin/skype-webcam-fixed:
Code:
#!/bin/sh
export LIBV4LCONTROL_FLAGS=3
LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so /usr/bin/skype
Or on 64 bits systems:
Code:
#!/bin/sh
export LIBV4LCONTROL_FLAGS=3
LD_PRELOAD=/usr/lib32/libv4l/v4l1compat.so /usr/bin/skype
Make it executable :
Code:
chmod +x /usr/bin/skype-webcam-fixed
Now when you want to run skype use this script instead of /usr/bin/skype.
Things not working
- Hibernate results in a black screen, though it works in single user mode so it should not be too hard to fix. To reboot use the magic SysRq sequence (hold Alt+Print Scr and type R, E, I, S, U, B)
- Nvidia card is not working
This is adapted from my blog post, which itself is a compilation of infos from around the internet and this forum.
Bookmarks