Running Slackware Linux on Thinkpad T61

ACPID and HotKeys Configuration in Slackware Linux for ThinkPad T61

Author: Cherife Li
Make sure ACPI is enabled in the kernel. For 2.6.x kernel, check as below:
    --- ACPI (Advanced Configuration and Power Interface) Support
    [*]   Deprecated /proc/acpi files
    [*]   Deprecated power /proc/acpi directories
    [*]   Future power /sys interface
    [*]   Deprecated /proc/acpi/event support
    <M>   AC Adapter
    <M>   Battery
    <M>   Button
    <M>   Video
    <M>   Fan
    -*-   Dock
    <M>     Removable Drive Bay (EXPERIMENTAL)
    <M>   Processor
    <M>     Thermal Zone
    
$ cat ~/.Xmodmap
    keycode 144 = XF86AudioPrev
    keycode 153 = XF86AudioNext
    keycode 159 = XF86LaunchA
    keycode 160 = XF86AudioMute
    keycode 162 = XF86AudioPlay
    keycode 164 = XF86AudioStop
    keycode 174 = XF86AudioLowerVolume
    keycode 176 = XF86AudioRaiseVolume
    keycode 227 = F35
    keycode 233 = XF86Forward
    keycode 234 = XF86Back
    
$ xmodmap ~/.Xmodmap
Store the ACPI event files in /etc/events directory, and the action scripts in /etc/actions directory.
They could be merged into one file.
$ cat /etc/acpi/events/lockscreen
    event=ibm/hotkey HKEY 00000080 00001002
    action=/etc/acpi/actions/lockscreen.sh
    
$ cat /etc/acpi/actions/lockscreen.sh
    #!/bin/sh
    xlock -display :0
    
$ cat /etc/acpi/events/sleep
    event=ibm/hotkey HKEY 00000080 00001004
    action=/etc/acpi/actions/sleep.sh
    
$ cat /etc/acpi/actions/sleep.sh
    #!/bin/sh
    # sleep.sh test script for measuring power drain during suspend-to-ram with ACPI

    #if ! grep -q '^charging state:.*discharging' /proc/acpi/battery/$BATTERY/state; then
    #   echo 'Not running on battery power, did you forget to disconnect the charger?'
    #   exit 1
    #fi

    if [ "$UID" != "0" ]; then
      echo 'This script can only be run by root.'
      exit 1
    fi

    # remove USB for external mouse before sleeping
    if lsmod | grep '^usbhid' >/dev/null ; then
      /sbin/modprobe -r -s usbhid
    fi
    if lsmod | grep '^uhci_hcd' >/dev/null ; then
      /sbin/modprobe -r -s uhci_hcd
    fi
    if lsmod | grep '^ehci_hcd' >/dev/null ; then
      /sbin/modprobe -r -s ehci_hcd
    fi

    # save system time
    hwclock --systohc

    # check to turn off think-light
    if egrep 'status.*on' /proc/acpi/ibm/light ; then
      echo off > /proc/acpi/ibm/light
    fi

    # go to sleep
    if [ -e /proc/acpi/sleep ]; then
      sleep 2 && echo 3 > /proc/acpi/sleep
    else
      sleep 2 && echo -n mem > /sys/power/state
    fi

    # restore USB support 
    if !(lsmod | grep '^ehci_hcd') >/dev/null ; then
      /sbin/modprobe -s ehci_hcd
    fi
    if !(lsmod | grep '^uhci_hcd') >/dev/null ; then
      /sbin/modprobe -s uhci_hcd
    fi
    if !(lsmod | grep '^usbhid')   >/dev/null ; then
      /sbin/modprobe -s usbhid
    fi

    # restore system time
    hwclock --hctosys
    
$ cat /etc/acpi/events/powerbtn
    event=button/power PWRF 00000080 .*
    action=/etc/acpi/actions/powerbtn.sh
    
$ cat /etc/acpi/actions/powerbtn.sh
    #!/bin/sh
    DISPLAY=':0.0' xmessage -buttons Shutdown:0,Cancel:1 -timeout 6 -default Shutdown -title "Shutting Down" -center "  Shutdown the computer?  "

    if [ "$?" == "0" ]; then
      shutdown -h now
    fi
    

Problems

    The fn-brightness (Fn + Home/End) hotkey won't work. I don't change the brightness from time to time, so currently I just added this line into rc.local:
      echo 6 > /sys/class/backlight/acpi_video1/brightness
      
    The Wlan led won't work. The wireless card works.

    Since using kernel 2.6.26, the two issues above have been solved. Wlan led is supported since kernel 2.6.26. I have no idea about since when the brightness keys are supported.

    The volume keys won't work.
    I use keys defined in fluxbox to control the volume. See Fluxbox volume keys configuration.

    Reference:
    http://www.nabble.com/T61-brightness-volume-td15076943.html
    
Back to Index of Running Slackware Linux on ThinkPad T61.

Valid XHTML & CSS|©2008 dOtImes.cOm, All rights reserved.|Creative Commons|Linux on Laptops|TuxMobil|Firefox
Google™ Powered
Posted and Maintained by Cherife Li
Last Update: Monday, 2008-07-14, 16:48, UTC+8.