low power consumption

I recently bought a Desknote A531 (it's quite the same as an Desknote A530) laptop at ebay, it's quite a nice thingy, yet it features only 2 hours of battery-runtime. I hope to increase the runtime by various tricks like running the system only in ramdisks and such. If I succeed in saving power somewhere I'll write it here, but first I must wait for it to arrive. - Well, that point got solved the laptop is right here in front of my nose...

Well, to get Debian working is not quite easy if you don't have the right installation CDs. At least the one I downloaded was complete crap. Fortunately we just developped an installation for our backupserver so I used that instead. Works quite well, as it seems by now.

Ok, first serious problem solved:X11 gave me some funny colors which flimmered quite bad. lspci says I got a SiS315PRO as a video card. The things to do were:

If the funny colors remain, try different values for PanelDelayCompensation from 1 to 32. For additional information about the SiS driver, see the driver author's website .

Next thing is the touchpad, well it's a synaptics touchpad, and well supported by X, although the default driver doesn't seem to detect it, so get the newest version of the driver (0.12.5 worked here). Download it here.

apt-get install xlibs-dev
Then compile it and copy it to /usr/X11/lib/modules/input/ modify your /etc/X11/XF86Config-4 to contain

		Section "InputDevice"
			Driver        "synaptics"
			Identifier    "Configured Mouse"
			Option        "Device"        "/dev/psaux"
			Option        "Protocol"      "auto-dev"
			Option        "Edges"         "1900 5400 1800 4000"
			Option        "Finger"        "25 30"
			Option        "MaxTapTime" "80"
			Option        "MaxTapMove" "220"
			Option        "VertScrollDelta" "100"
			Option        "MinSpeed"      "0.02"
			Option        "MaxSpeed"      "0.18"
			Option        "AccelFactor" "0.0010"
			Option        "EdgeMotionUseAlways"   "true"
			Option        "CircularScrolling"     "on"
			Option        "CircScrollTrigger"     "3"
		EndSection
	

This will work, but you can easily configure the pad to your like, just see the homepage of the driver.

Next thing is WLAN. The A531 has a Prism3 chipset linked to the USB bus (there are two of them, one slower and one faster USB2.0 linked to the outside ports) First, get yourself a copy of the Prism3 drivers from here. Read the README, it's quite an installation guide. Then load

			usbcore
			ehci_hcd
			ohci_hcd
			p80211
			prism2_usb
		
these modules. The package provides some init scripts, and configuration files as well, but they didn't work too well with me, so I wrote quick-and-dirty scripts which connect to me a specific WLAN. This script connects to an access point using WEP and a static IP.
			#!/bin/bash

			wlanctl-ng wlan0 lnxreq_ifstate ifstate=enable
			wlanctl-ng wlan0 dot11req_mibset mibattribute=p2CnfRoamingMode=1
			wlanctl-ng wlan0 dot11req_mibset mibattribute=dot11WEPDefaultKeyID=0
			wlanctl-ng wlan0 dot11req_mibset mibattribute=dot11ExcludeUnencrypted=true
			wlanctl-ng wlan0 dot11req_mibset mibattribute=dot11PrivacyInvoked=true
			wlanctl-ng wlan0 dot11req_mibset mibattribute=dot11WEPDefaultKey0=00:00:00:00:00:00:00:00:00:00:00:00:00
			wlanctl-ng wlan0 lnxreq_autojoin ssid="somessid" authtype=sharedkey
			ifconfig eth0 down
			ifconfig wlan0 192.168.0.163 up
			route add default gw 192.168.0.1
		
Of course you need to change the 00s in the key to your real values. One other command is extremely useful:
			wlanctl-ng wlan0 lnxreq_wlansniff enable=true channel=6
		
This puts the card into a mode where it receives all packages, you can then sniff them by
			tcpdump -i wlan0
		
As many access points broadcast their ssid, this is quite a good way to find out which WLANs are reachable.

To switch the card into ad-hoc mode I use these commands: (The rmmod/modprobe stuff is necessary - elseways the card driver gets an error because it tries to switch on the card twice, at least that's what I got from the sources)

		rmmod prism2_usb
		modprobe prism2_usb
		wlanctl-ng lnxreq_ifstate ifstate=enable
		wlanctl-ng wlan0 dot11req_start ssid=foo bsstype=independent \
			beaconperiod=100 dtimperiod=3 cfpollable=false cfpollreq=false \
			cfpperiod=3 cfpmaxduration=100 probedelay=100 dschannel=10 \
			basicrate1=2 basicrate2=4 operationalrate1=2 operationalrate2=4 \
			operationalrate3=11 operationalrate4=22
	

Since 2.6.6 you can read the CPU-temperature by loading

		i2c-ali1535
		adm1021
		eeprom
		i2c-dev
	

and then call

		sensors
	

This will get you the additional information that the Laptop contains 256 MB RAM ;)

Another thing which I came up with is a script to switch off all devices not needed for typing simple text files. I hope the battery will last longer than usual in this mode, but that still has to be tested. You need to have ACPI power management in the kernel and have the processor module loaded (or compiled in) However, here it is:

			#!/bin/bash

			echo -n "going into low-power mode"

			mount -t tmpfs tmpfs /mnt/lowpower
			for script in /etc/rc0.d/K*; do
			        $script stop
			done

			rsync -av /var/lowpower/* /mnt/lowpower/
			mkdir -p "/mnt/lowpower/home/drahflow"
			rsync -av "/home/drahflow/lowpower" "/mnt/lowpower/home/drahflow/"

			wlanctl-ng wlan0 lnxreq_ifstate ifstate=disable
			hdparm -S 6 -y /dev/hda
			{
			#echo /sys/devices/pnp0
			#echo /sys/devices/pnp1
			echo /sys/devices/pci0000:00/0000:00:0a.3
			echo /sys/devices/pci0000:00/0000:00:0a.2
			echo /sys/devices/pci0000:00/0000:00:0a.1
			echo /sys/devices/pci0000:00/0000:00:0a.0
			echo /sys/devices/pci0000:00/0000:00:11.0
			echo /sys/devices/pci0000:00/0000:00:10.0/ide1
			echo /sys/devices/pci0000:00/0000:00:08.0
			#echo /sys/devices/pci0000:00/0000:00:07.0
			echo /sys/devices/pci0000:00/0000:00:06.0
			echo /sys/devices/pci0000:00/0000:00:05.0
			} | while read dir; do
							echo $dir off
			find $dir -name 'state' -exec bash -c "echo -n '3' > {}" \;
			done
			echo -n '0:7' > /proc/acpi/processor/CPU1/limit

			export HOME=/home/drahflow
			while chroot /mnt/lowpower /bin/bash --login; do :; done
			export HOME=

			echo -n '0:0' > /proc/acpi/processor/CPU1/limit
			find /sys/devices/ -name 'state' -exec bash -c "echo -n '0' > {}" \;
			hdparm -S 60 -y /dev/hda
			wlanctl-ng wlan0 lnxreq_ifstate ifstate=enable

			for script in /etc/rc2.d/S*; do
							$script start
			done

			rsync -av "/mnt/lowpower/home/drahflow/lowpower" "/home/drahflow/"
			umount /mnt/lowpower
		
Well, my home directory is hardwired, and you need to create /var/lowpower as a root-tree containing bash and some texteditor, but it works. To exit the main loop, simple press CTRL-C and then CTRL-D while being in bash.

This guide is far from being complete, but it's more than nothing already. If you feel something important is missing, mail me. More on Linux on laptops can be found at tuxmobil.org.