[ltp] T40, ACPI, and sleeping

Steffen Dreise linux-thinkpad@linux-thinkpad.org
Wed, 02 Feb 2005 01:57:04 +0100


Hi there,
finaly got "all" my acpi stuff wokring, thanks to Bob Alexander.
I wont paste all the configs, but u get the link to a tar ball ;)
Here we go:
xorg.conf, .config, /etc/acpi/*:
www.rootbox.de/t42pconfs.tar.bz2
(Xorg 6.7, 2.6.10-6,ati-drivers-3.14.6)

Something about acpi-actions:
---------------------------------<snip>---------------------------------
#!/bin/sh
if [ $2 != "HKEY" ] ; then exit ; fi
case "$3 $4" in
        "00000080 00001003")
        # Fn-F3, Blank screen

                if [ -f /etc/acpi/actions/lightoff ]; then
                radeontool light on
                rm /etc/acpi/actions/lightoff
                else
                radeontool light off
                touch /etc/acpi/actions/lightoff
                fi
                ;;
        "00000080 00001004")
        # Fn-F4, Sleep
                echo "7 blink" >/proc/acpi/ibm/led
                echo "4 off" >/proc/acpi/ibm/led
                /usr/local/bin/radeontool light off
                /sbin/hotplug stop
                /usr/bin/logger "Fn+F4 Suspending to RAM"
                /bin/sync
                /sbin/hwclock --systohc
                echo -n mem > /sys/power/state
                /sbin/hwclock --hctosys
                /usr/bin/logger "Resuming from Fn+F4 Suspending to RAM"
                /sbin/hotplug start
                echo "4 on" >/proc/acpi/ibm/led
                echo "7 off" >/proc/acpi/ibm/led
                /usr/local/bin/radeontool light on
                ;;
        "00000080 00001005")
        # Fn-F5, Wireless
                if grep -q enabled /proc/acpi/ibm/bluetooth ; then
                        echo disable > /proc/acpi/ibm/bluetooth
                elif grep -q disabled /proc/acpi/ibm/bluetooth ; then
                        echo enable > /proc/acpi/ibm/bluetooth
                fi
                ;;
        "00000080 00001007")
        # Fn-F7, Switch display
                ;;
        "00000080 0000100c")
        # Fn-F12, Hibernate
                swapoff /dev/hda3 &> /dev/null
                mkswap /dev/hda3
                swapon /dev/hda3
                /usr/bin/logger "Fn+F12 Suspending to DISK"
                echo disk > /sys/power/state
                logger "resume"
                swapoff /dev/hda3
                ;;
esac
---------------------------------</snap>---------------------------------

I think the hibernate part is a realy dirty hack, i duno if u should use
this crap ;).
1st i did fdisk /dev/hda and delete all :p just renember the cylinders,
problem was that i needed a 2nd swap but doenst have one ;) So delete
swap and /, then readd them in mind with the old cylinder entries.
After reboot, a stone falls from my heart :)

The swapoff/mkswap/swapon part ... when i dont do this my swap groes up
and up after some hibernates ;) this is evil ;P with this crap it works,
im not a scripter so thats realy dirty, i will be happy if someone have
a better idea. Maybe theres already some hibernate stuff in gentoo or
so... but i doenst know one. Because of this, i wrote my one hibernate
script. Presing F12 hibernates and shuts done our all loving baby. After
pressing power again, it boots up and reloads the hibernated part. Sorry
my english sucks, btw. ;)

Suspend to ram and blanking the screen works correctly, thanks again to
Bob Alexander who wrote the basic sleep part.

After hibernating my acpi wasnt work, my prob was it that i add the acpi
addons modulary to the kernel... After putting them in <*> it works..

So whats todo, for me, my bluetooth button should do that, for whats it
for ;) enabling bluetooth *g* Sometimes, after rebooting it works,
sometimes it doesnt work, did not realy spend time for it. 
The monitor switching button is also idleing ;)

Somebody got it?
Once again, im really sorry for mir poor english hope u understand the
main part *g*

regards,
Steffen