Difference between revisions of "Talk:How to configure acpid"

From ThinkWiki
Jump to: navigation, search
(Set ATI driver to run on economy mode when running on battery)
(Lock screen on wake: test fix)
Line 238: Line 238:
  if [ ! -z "$XUSER" ] ; then
  if [ ! -z "$XUSER" ] ; then
         if ! xscreensaver-command -time|grep "screen locked" ; then
         if ! su -c "DISPLAY=:0 /usr/bin/xscreensaver-command -time|grep 'screen locked'" - XUSER ; then
                 su -c "DISPLAY=:0 /usr/bin/xscreensaver-command -lock" - $XUSER >/tmp/lid.log 2>&1
                 su -c "DISPLAY=:0 /usr/bin/xscreensaver-command -lock" - $XUSER >/tmp/lid.log 2>&1
Line 276: Line 276:
  if [ ! -z "$XUSER" ] ; then
  if [ ! -z "$XUSER" ] ; then
         if ! xscreensaver-command -time|grep "screen locked" ; then
         if ! su -c "DISPLAY=:0 /usr/bin/xscreensaver-command -time|grep 'screen locked'" - XUSER ; then
                 su -c "DISPLAY=:0 /usr/bin/xscreensaver-command -lock" - $XUSER >/tmp/lid.log 2>&1
                 su -c "DISPLAY=:0 /usr/bin/xscreensaver-command -lock" - $XUSER >/tmp/lid.log 2>&1

Revision as of 19:40, 25 May 2006

This content was merged from my original T30 specific page T30_ACPI_Sleeping that is now being redirected here. IMO this page is a mistake because the solution is specific to machines with radeon video. It would be better if someone could resurrect the origial page. Also the below script is a little sketchy.

As i wrote you before, the information on this page is not only T30 specific and we don't want to end up with hundreds of pages covering the same topic just designating a different machine in the name.

I.e. would you like to have another page called A31p_ACPI_Sleeping? And another one X31_ACPI_Sleeping? All being the same except for the mentioned model? The instructions for these models would be precisely the same and it would only mean redundant maintenance.

The overall topic of your original page is covered by the following pages:

Furthermore, those pages are directly accessible from the T30 model page and they link to one another as well.

Your only argument for having it on a separate page is that T30 users wanting to use ACPI sleep can find it more easily. I think that a user can find all the needed information pretty easily if he follows a logical path like looking on the T30 model page, and the ACPI-HOWTO page. First you want to make ACPI work in general. Then if you think you managed that but still have a problem, you look for further information, i.e. have a look into the problems pages. In this case you even don't need to since the according problem page is linked directly from the ACPI-Howto page.

What if a A31p user comes to ThinkWiki with the same problem? Will he find the information when it's on a page labelled "T30_ACPI_Sleeping"? I guess not. So what do we do? Make a second page and redirect that to this page? Why then is it bad to redirect "T30_ACPI_Sleeping" to a page where all the relevant information can be accessed from? If you think this page is the wrong target, we can change it to point to the LCD backlight problem page.

Furthermore, this page is not specific to notebooks featuring radeons. The general information in the beginning is acpid-specific and else generic. The example event entry is acpi-sleep and lid specific and else generic. The actual example script features 5 lines that are radeon (or T30, A30, A31p, X30 and X31) specific, as is also stated in a comment below the script.

Specific for notebooks with radeons is the Problem with LCD backlight remaining on during ACPI sleep page. It is in fact even more specific, since it covers the exact problem that doesn't affect all radeon based ThinkPads.

Your original page covered three different topics in one page, making it specific for exactly what your page title designated: T30s, ACPI and sleep mode. But all three of those topics are distinct topics in themselves and are not specific to your what your page title designates.

If you find more intuitive page names than i did feel free to propose them, but i really don't see the point in having a separate page to maintain for each specific question a user might come up with.


Which event is which

That may be a silly question but which button correspond to which entry in the /etc/acpi/events? I know event=button/lid corresponds to closing the lid event=button/sleep is the Fn-F4 button but the rest? Oub 22:00, 10 February 2006 (CET):

See the ibm-acpi section in How to get special keys to work. Wyrfel 00:04, 11 February 2006 (CET)

Hi I am sorry, but I still don't understand, according to the section

How to get special keys to work. Fn F4 is bound as follows

Fn F4 ibm/hotkey HKEY 00000080 00001004
however my script sleeptbtn in /etc/acpi/events is as follows:
event=button[ /]sleep
This way Fn F4 is bound to mihibernate. It works fine. Are you saying

that the script could also work with the following instructions:

ibm/hotkey HKEY 00000080 00001004
I am confused. I think it would be good to have a list similar to

that in How to get special keys to work.

But instead of using HKEY is should use syntaxes like this, if


Fn F4 event=button[ /]sleep
Oub 17:18, 11 February 2006 (CET):

Hi, if you use the ibm-acpi driver it should only work with something like "ibm/hotkey HKEY 00000080 00001004". Are you using ibm-acpi? That your config works could indicate the you are using thinkpad-acpi instead, because your config expects a string "button/sleep" or "button sleep", while the event generated by ibm-acpi doesn't include the string "sleep" at all.

We could copy the table fromm How to get special keys to work here, but i'd rather prefer to leave a note here that points there. This reduces double maintenance and strictly seen it is a button config, not a power management one (one could configure it to do something that's not PM related at all).

Wyrfel 03:30, 12 February 2006 (CET)

It is really confusing! Although for me
event=button[ /]sleep
works, well it seems that I use ibm-acpi. I am using the 2.6.10

kernel, and activated that option in the configuration process. I cannot remember to have installed thinkpad-acpi, and dpkg -l | grep thinkpad does not return anything meaningful (I am on Debian). I have tpb and tpct, thinkpad-base and laptop-mode-tools installed. So I am really puzzled.

You still did not answer my question: what are the string equivalents

to the hotkey entries in the list found at http://www.thinkwiki.org/wiki/How_to_get_special_keys_to_work. Again in that list I see for example:

key     event
Fn F4   ibm/hotkey HKEY 00000080 00001004
Fn F12  ibm/hotkey HKEY 00000080 0000100c
So I would like to have a list of the form
key    event
Fn F4  event=button[ /]power
Fn F12 ?????
Oub 17:13, 12 February 2006 (CET):

I guess i just didn't understand your question, which is because of the fact that to my knowledge there are no "string equivalents" for the hotkey entries. Or in other words, these "hotkey entries" ARE the "string equivalents". Those are exactly the strings that acpid will recieve from ibm-acpi. AFAIK it doesn't recieve anything in the form of "button[ /]sleep" at all. That's why in theory, your config shouldn't work. Don't know why it does in reality, maybe you should install a SETI client and check for the existance extraterrestrical lifeforms in your ThinkPad. ;-) (Sorry, just being rediculous.)

However, let's try discovering it in a more reasonable approach: do a # tar -f /var/log/acpid. Then press the FnF4 combination and see what happens in the terminal. Look for lines that say "recieved event" and then look at the event strings there. Do they more look like "button[ /]sleep" or more like "ibm/hotkey ...."? Also, please do a # dmesg | grep ibm_acpi. If it returns some lines you would have ibm_acpi running, if not, probably something else. (Though 2.6.10 was exactly the first kernel that included ibm-acpi, if i remember right, it included both thinkpad-acpi and ibm-acpi.)

Just checking again, it would definately seem to me that you are using thinkpad-acpi. Look at [http://rigtorp.se/thinkpad.xhtml the authors page], his config matches yours.

Wyrfel 20:07, 12 February 2006 (CET)


You mean tail -f /var/log/acpid instead of tar -f? Here comes the output

tail -f /var/log/acpid

ERROR: Module hsfsoar does not exist in /proc/modules
/usr/local/sbin/hibernate: 812: switchto: not found
[Sun Feb 12 20:17:15 2006] END HANDLER MESSAGES
[Sun Feb 12 20:17:15 2006] action exited with status 0
[Sun Feb 12 20:17:15 2006] executing action "/etc/acpi/actions/lm_lid.sh button/lid LID 00000080 00000005"
[Sun Feb 12 20:17:15 2006] BEGIN HANDLER MESSAGES
Laptop mode was already disabled, not disabling.
[Sun Feb 12 20:17:15 2006] END HANDLER MESSAGES
[Sun Feb 12 20:17:15 2006] action exited with status 0
[Sun Feb 12 20:17:15 2006] completed event "button/lid LID 00000080 00000005"
now comes Fn F4 which hibernates my machine!
[Sun Feb 12 21:02:25 2006] received event "button/sleep SLPB 00000080 0000000b"
[Sun Feb 12 21:02:25 2006] executing action "/usr/local/sbin/mihibernate"
[Sun Feb 12 21:02:25 2006] BEGIN HANDLER MESSAGES
ERROR: Module hsfusbcd2 does not exist in /proc/modules
ERROR: Module hsfmc97ali does not exist in /proc/modules
ERROR: Module hsfmc97via does not exist in /proc/modules
ERROR: Module hsfmc97ich does not exist in /proc/modules
ERROR: Module hsfpcibasic2 does not exist in /proc/modules
ERROR: Module hsfmc97sis does not exist in /proc/modules
ERROR: Module hsfmc97ati does not exist in /proc/modules
ERROR: Module hsfserial does not exist in /proc/modules
ERROR: Module hsfengine does not exist in /proc/modules
ERROR: Module hsfosspec does not exist in /proc/modules
ERROR: Module hsfsoar does not exist in /proc/modules
/usr/local/sbin/hibernate: 812: switchto: not found
[Sun Feb 12 21:03:28 2006] END HANDLER MESSAGES
[Sun Feb 12 21:03:28 2006] action exited with status 0
[Sun Feb 12 21:03:28 2006] completed event "button/sleep SLPB 00000080 0000000b"
dmesg | grep ibm_acpi. 

Does not return anything may be I ask eric about the Fn F12 key, sorry to bother you with that problem. Indeed my configuration is odd. I copied it from Linux for Laptops: one of the configurations of a working Debian installation. Oub 21:46, 12 February 2006 (CET):

Dude, you are using the thinkpad-acpi driver. :-) Examine the output of # dmesg | grep acpi, you should see something that confirms that.

Wyrfel 00:08, 13 February 2006 (CET)

Hello, Is there a repository of scripts somewhere that I can use? I can't get the Fn keys to do anything in gentoo (2.6.15-r1). I have acpid & radeontool installed, ibm-acpi is compiled as a module into the kernel (that all works - log files suggest that every combo button push works but there's no result because no event script). I'm looking for a script (default.sh) that would allow me to use Fn-F3, Fn-F4, Fn-F5 (control the state of my atheros wifi) and open/close lid event. I'm scouring the 'net but no success. I would use the ubuntu scripts (I love how it "just works out of the box!!") but those scripts refer to directories and other add-ons that I don't have installed (and don't want to install either).


Hi, the only repository we have is the Scripts category. I know it's not sufficient for your issues. In former times, everyone had to install ibm-acpi from the package which included good default scripts. since ibm-acpi is in the kernel now, the scripts from the package are just a bit too far away for most users to get the path to them. Maybe we should add the missing default scripts as single pages and categorize them under the Scripts category for a start.

Wyrfel 01:57, 10 March 2006 (CET)

This ibm_acpi business and the way it's presented here is extremely confusing. The multitude of commands and methods scattered all around really make it difficult to follow. The lack of any working action scripts makes it all even worse. I realize that distros are different and people have different installations, but can't there be 1 generic tell-all method that ought to work regardless of distro used?

Whatever I try, I cannot get the Fn keys to do what they're supposed to in gentoo. Closest I get is pressing FnF3, the screen blanks for a second and turns back on. FnF4 shows no result, nor do the rest. This is disheartening! ....

Steve --Papi 18:29, 20 March 2006 (CET)

Lock screen on wake

To lock the screen (in Gnome) when I open the lid, I've added these lines in my /etc/acpi/actions/lm_lid.sh script  :

XUSER=`ps aux|grep -w x\\-session-manager|cut -d' ' -f 1|head -n1`

if [ ! -z "$XUSER" ] ; then
        if ! su -c "DISPLAY=:0 /usr/bin/xscreensaver-command -time|grep 'screen locked'" - XUSER ; then
                su -c "DISPLAY=:0 /usr/bin/xscreensaver-command -lock" - $XUSER >/tmp/lid.log 2>&1

For information, here is my complete /etc/acpi/actions/lm_lid.sh file, on a Debian, with laptop mode :


# lid button pressed/released event handler

# if launched through a lid event and lid is open, do nothing
echo "$1" | grep "button/lid" && grep -q open /proc/acpi/button/lid/LID/state && exit 0

# remove USB 1.1 driver
rmmod uhci_hcd

# sync filesystem and clock
/sbin/hwclock --systohc

# switch to console
chvt 6
/usr/sbin/radeontool light off

# go to sleep
sleep 5 && echo -n "mem" > /sys/power/state

# readjust the clock (it might be off a bit after suspend)
/sbin/hwclock --adjust
/sbin/hwclock --hctosys

# reload USB 1.1 driver
modprobe uhci_hcd

XUSER=`ps aux|grep -w x\\-session-manager|cut -d' ' -f 1|head -n1`

if [ ! -z "$XUSER" ] ; then
        if ! su -c "DISPLAY=:0 /usr/bin/xscreensaver-command -time|grep 'screen locked'" - XUSER ; then
                su -c "DISPLAY=:0 /usr/bin/xscreensaver-command -lock" - $XUSER >/tmp/lid.log 2>&1

# turn on the backlight and switch back to X
/usr/bin/radeontool light on

test -f /usr/sbin/laptop_mode || exit 0

/usr/sbin/laptop_mode auto

Zubro 17:25, 21 May 2006 (CEST)

Set ATI driver to run on economy mode when running on battery

Here is the /etc/acpi/actions/lm_ac_adapter.sh I use on a Debian to lower the frequency of the ATI chip when my AC adapter is unplugged :


# ac on/offline event handler

test -f /usr/sbin/laptop_mode && /usr/sbin/laptop_mode auto

# if not launched through a ac_adapter event do nothing
echo "$1" | grep -qv "ac_adapter" && exit 0

# get user running X
XUSER=`ps aux|grep -w x\\-session-manager|cut -d' ' -f 1|head -n1`

# if X not found, quit
test -z "$XUSER"  && exit 0

# set GPU speed
if [ "$4" -eq 0 ] ; then
        # AC adapter is off-line

        su -c "DISPLAY=:0 /usr/X11R6/bin/aticonfig --set-powerstate=1 --effective=now" - $XUSER

elif [ "$4" -eq 1 ] ; then
        # AC adapter is on-line

        su -c "DISPLAY=:0 /usr/X11R6/bin/aticonfig --set-powerstate=3 --effective=now" - $XUSER

Zubro 17:29, 21 May 2006 (CEST)