星期二, 3月 13, 2012

My ubuntu (11.10 Oneiric) on ASUS U41S

I bought a laptop,ASUS U41S, and installed ubuntu 11.10 on it. But found out many issues and record how to fix it listed below. The solution are from my experiences, many links (googling) and references, just integrate all fixes here. Not sure can fit all people using ubuntu on asus.

1. Fan Speed control.
When I power on my laptop with Ubuntu, the fan speed always (or usually) make lots of noises. Then I find a way to make it being quieter, that's lm_sensors. (but maybe still need to refer to power consumption as item 2.)

- Install lm-sensors


2. power consumption (2.5 hrs to 6 hrs)

- Enable ACPI ASPM
edit /etc/default/grub and add pcie_aspm=force
update-grub

#The major eating-power-monster will be the nvidia and unity3D with compiz, so change to 2D first.
- About acpi_call
git clone http://github.com/mkottman/acpi_call.git
cd acpi_call
make
sudo insmod acpi_call.ko # first trying
--> then copy acpi_call.ko to /lib/module/... and depmod -a
./test_off.sh # you can use this script to find out your "parameter" of acpi_call to disable the nvidia h/w

*** build acpi_call in dkms format under 12.10 ***
apt-get install dkms
put acpi_call folder into /usr/src/acpi_call-0.1
modify Makefile and dkms.conf

Makefile
obj-m := acpi_call.o default: $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules clean: rm acpi_call.mod.o acpi_call.o acpi_call.ko
dkms.conf

PACKAGE_NAME="acpi_call"
PACKAGE_VERSION="0.1"
CLEAN="make clean"
BUILT_MODULE_NAME[0]="acpi_call"
DEST_MODULE_NAME[0]="acpi_call"
MAKE[0]="make IGNORE_CC_MISMATCH=1 KDIR=$kernel_source_dir PWD=$dkms_tree/acpi_call/0.1/build"
DEST_MODULE_LOCATION[0]="/kernel/drivers/acpi"
AUTOINSTALL="yes"

build dkms format
sudo dkms add -m acpi_call -v 0.1
sudo dkms build -m acpi_call -v 0.1
sudo dkms install -m acpi_call -v 0.1

(can check the status with "dkms status" command)
and here is the link for reference.
https://wiki.ubuntu.com/Kernel/Dev/DKMSPackaging
http://hybrid-graphics-linux.tuxfamily.org/index.php?title=Acpi_call

---- save these in /etc/rc.local -----
# remove nouveau for nvidia before X
modprobe -r nouveau
# Disable nvidia h/w
modprobe acpi_call
echo "\_SB.PCI0.PEG0.GFX0.DOFF" > /proc/acpi/call
#then reboot, you should have more than 5 hrs power consumption now.

3. Suspend issue (can't fix hibernate yet)
From the solution, looks like the issue caused by usb.
- add the contents below into /etc/pm/sleep.d/20_suspend and chmod to 755
#!/bin/sh
#inspired by http://art.ubuntuforums.org/showpost.php?p=9744970&postcount=19
#...and http://thecodecentral.com/2011/01/18/fix-ubuntu-10-10-suspendhibernate-not-working-bug
# tidied by tqzzaa :)

VERSION=1.1
DEV_LIST=/tmp/usb-dev-list
DRIVERS_DIR=/sys/bus/pci/drivers
DRIVERS="ehci xhci" # ehci_hcd, xhci_hcd
HEX="[[:xdigit:]]"
MAX_BIND_ATTEMPTS=2
BIND_WAIT=0.1

unbindDev() {
echo -n > $DEV_LIST 2>/dev/null
for driver in $DRIVERS; do
DDIR=$DRIVERS_DIR/${driver}_hcd
for dev in `ls $DDIR 2>/dev/null | egrep "^$HEX+:$HEX+:$HEX"`; do
echo -n "$dev" > $DDIR/unbind
echo "$driver $dev" >> $DEV_LIST
done
done
}

bindDev() {
if [ -s $DEV_LIST ]; then
while read driver dev; do
DDIR=$DRIVERS_DIR/${driver}_hcd
while [ $((MAX_BIND_ATTEMPTS)) -gt 0 ]; do
echo -n "$dev" > $DDIR/bind
if [ ! -L "$DDIR/$dev" ]; then
sleep $BIND_WAIT
else
break
fi
MAX_BIND_ATTEMPTS=$((MAX_BIND_ATTEMPTS-1))
done
done < $DEV_LIST
fi
rm $DEV_LIST 2>/dev/null
}

case "$1" in
hibernate|suspend) unbindDev;;
resume|thaw) bindDev;;
esac