Thinkpad acpi buttons HOWTO (was Re: [ltp] IBM Thinkpad T23
with Kernel 2.6.8.1)
morpheus
linux-thinkpad@linux-thinkpad.org
Sun, 19 Dec 2004 09:56:26 -0500
It's not an insult, it's a valid criticism...there's a big difference.
It may piss you off, but it should help you realize how best to get help
from us in the future. Ask anyone on any mailing list how they feel when
people post questions like yours...you'll likely get the same response.
If you had told us what you had tried, what didn't work and where you
were stuck, you'd have gotten a lot more help than asking "how to set up
ACPI buttons for sleep."
tpctl will let you suspend/hibernate from the command line. However, if
you want to set up your Fn-Fx buttons to sleep, suspend, etc. what you
need is ibm_acpi and acpid as described in the readme I sent to you. If
you have trouble with it, feel free to post a question, we're always
happy to help with specific questions.
-m
On Sat, 2004-12-18 at 23:20 -0600, TechWizard wrote:
> Sorry for sounded useless....!
> But I've been messing around with this laptop for 4 whole days.
> Yes.. it P*sses me off when I get an insult like that.
>
> You don't need a reason why i use this very old Alias.
>
> I will try this tpctl
> Thanks for the reply on tpctl for the other kind people.
>
> On Sat, 18 Dec 2004, morpheus wrote:
>
> > Since you are a "TechWizard" you should be aware of an amazing thing
> > called Google. Generally we use this to search the mailing list before
> > asking basic questions that very likely have been answered before.
> > >>From google, enter:
> > site:linux-thinkpad.org acpi buttons howto
> >
> > To save you the trouble, I have appended my HOWTO below, which I just
> > posted last week.
> >
> > Sorry if I sound rude, but throwing a question like "how do I set up
> > acpi" to this list only shows that you haven't tried at all to find the
> > answer yourself, and want someone to just give it to you gift-wrapped.
> > You will get a much better response, make more friends, have more fun
> > and learn a lot more if you try to do it yourself first (google is great
> > for this), then ask for advice on a specific issue when you get stuck.
> >
> > This acpi issue is especially frustrating since I just posted a HOWTO
> > last week!
> >
> > Anyway, in future try google with site:linux-thinkpad.org to search the
> > archives.
> >
> > -m
> >
> > Thinkpad ACPI and Function Key HOWTO by morpheus
> > -------------------------------------------------
> > First, compile and install ibm-acpi, which you can get from http://ibm-
> > acpi.sourceforge.net/
> >
> > Click on README for installation details.
> >
> > After install, don't forget to do:
> > # modprobe ibm_acpi
> > # echo enable > /proc/acpi/ibm/hotkey
> > # echo 0xffff > /proc/acpi/ibm/hotkey
> > (where ffff should be replaced by the key mask, as described in the
> > README.)
> > Also, if you want it to automatically enable in Fedora all the time,
> > edit /etc/rc.d/rc.local and add the lines above to this file.
> >
> > The hard part here is that the README doesn't tell you how to configure
> > acpi events themselves.
> >
> > You must create config files for each event in the
> > directory /etc/acpi/events.
> > There is already a file there called "sample.conf" which you can copy to
> > Fn-F3.conf, or Fn-F4.conf (make as many as you need).
> > Then just edit the files. There are only two lines:
> > event=
> > action=
> > For "event=" use the following:
> >
> > Key Event Line
> > ----- -------------------------------------------
> > Fn-F3 event=ibm/hotkey HKEY 00000080 00001003
> > Fn-F4 event=ibm/hotkey HKEY 00000080 00001004
> > Fn-F5 event=ibm/hotkey HKEY 00000080 00001005
> > Fn-F7 event=ibm/hotkey HKEY 00000080 00001007
> > Fn-F12 event=ibm/hotkey HKEY 00000080 0000100c
> >
> > For more events, run
> > # tail -f /var/log/acpid
> > Then press keys and watch what event appears.
> >
> > For the "action=" line you can run any command. However, it is easier
> > to manage if you create scripts in /etc/acpi/actions which are named the
> > same as your config files. For example:
> > Fn-F3.sh
> > Fn-F4.sh
> > These should contain the commands you want to run. Don't forget to make
> > them executable!!
> > # chmod a+x Fn-F3.sh
> >
> > For the T42p, the ibm-acpi /proc/acpi/ibm/video cannot be used to turn
> > the LCD backlight on and off. Fortunately there is a package called
> > radeontool that can do this. You can apt-get it or get an RPM from
> > rpm.pbone.net.
> >
> > Next, save the following script as /etc/acpi/actions/Fn-F3.sh
> >
> > #!/bin/bash
> > 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
> >
> > This script will toggle your backlight on and off. If you create a
> > config file in /etc/acpi/events/ that contains the following:
> >
> > event=ibm/hotkey HKEY 00000080 00001003
> > action=sh /etc/acpi/actions/Fn-F3.sh
> >
> > You can now toggle the backlight with the Fn-F3 key.
> >
> > As for the other keys, you can just copy /etc/acpi/events/Fn-F3 to files
> > called Fn-F4, Fn-F5, etc., then edit them so the event and action lines
> > match the key number.
> >
> > Now, all you have to do is create scripts in /etc/acpi/actions that
> > match the key numbers.
> >
> > Here are mine (Fn-F3 is above):
> >
> > /etc/acpi/actions/Fn-F4.sh -- For Suspend
> > #!/bin/bash
> > echo 3 > /proc/acpi/sleep
> >
> > /etc/acpi/actions/Fn-F5.sh -- For Bluetooth
> > #!/bin/bash
> > #!/bin/bash
> > grep enabled /proc/acpi/ibm/bluetooth
> > if [ "$?" == "0" ]; then
> > echo disable > /proc/acpi/ibm/bluetooth
> > else
> > echo enable > /proc/acpi/ibm/bluetooth
> > fi
> >
> > /etc/acpi/actions/Fn-F7.sh -- Since the xorg radeon driver won't allow
> > you to switch displays dynamically, you can use this for something else.
> > I use it to switch the wireless lan radio on and off:
> > #!/bin/bash
> > lsmod | grep ath_pci
> > if [ "$?" == "0" ]; then
> > modprobe -r ath_pci
> > modprobe -r ath_hal
> > modprobe -r wlan
> > else
> > modprobe wlan
> > modprobe ath_hal
> > modprobe ath_pci
> > fi
> >
> > /etc/acpi/actions/Fn-F12.sh -- For Hibernate
> > #!/bin/bash
> > echo 4 > /proc/acpi/sleep
> >
> > Be careful when editing these files if you use an editor like kedit that
> > automatically makes backups like Fn-F7~. If these are in
> > your /etc/acpi/events directory, they will be loaded by acpi (which
> > loads all files in that directory that don't begin with a period). To be
> > sure, do a:
> > # rm /etc/acpi/events/*~
> >
> > Finally, before you test if the buttons work, you need to reload the
> > config files by typing:
> > # /etc/init.d/acpid restart
> >
> > Note, in order for sleep and hibernate to work, you need to have acpi
> > set up properly. Here's a good resource for more info:
> > http://x1.cs.umd.edu/t42p.html
> >
> > Good luck!!
> >
> > On Sat, 2004-12-18 at 15:55 -0600, TechWizard wrote:
> > > How do I enable my ACPI buttons to put linux to sleep and
> > > stuff?
> >
> > --
> > The linux-thinkpad mailing list home page is at:
> > http://mailman.linux-thinkpad.org/mailman/listinfo/linux-thinkpad
> >