<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.thinkwiki.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sigil</id>
	<title>ThinkWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.thinkwiki.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sigil"/>
	<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/wiki/Special:Contributions/Sigil"/>
	<updated>2026-05-02T15:39:47Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.12</generator>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=How_to_configure_acpid&amp;diff=19477</id>
		<title>How to configure acpid</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=How_to_configure_acpid&amp;diff=19477"/>
		<updated>2006-02-07T05:04:24Z</updated>

		<summary type="html">&lt;p&gt;Sigil: syntax error, need sleep 5 &amp;amp;&amp;amp;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
==Introduction==&lt;br /&gt;
Basically, [[acpid]] just executes scripts residing in {{path|/etc/acpi/actions}}. Which script to launch at which event is configured in several files in {{path|/etc/acpi/events}}. All actions are documented in {{path|/var/log/acpid}}.&lt;br /&gt;
&lt;br /&gt;
==Sources of Information==&lt;br /&gt;
*{{cmduser|man acpid}} holds detailed information on how to configure acpid.&lt;br /&gt;
*The [[ibm-acpi]] package includes example scripts in the {{path|config}} folder inside the tarball. They are a good starting point to adjust them to your needs.&lt;br /&gt;
*You also might want to have a look at the [[Configs#ACPI | ACPI section of the Configs page]] or the [[:Category:Scripts|Scripts]] repository.&lt;br /&gt;
*And you can find information about the event strings [[ibm-acpi]] generates for certain keys at the [[How to get special keys to work#ibm-acpi_events | Special Keys HOWTO]].&lt;br /&gt;
&lt;br /&gt;
==Example: go to sleep on lid close==&lt;br /&gt;
To make the ThinkPad go to sleep when you close the lid, you need to add&lt;br /&gt;
an event handler for the lid event and an action script that takes care&lt;br /&gt;
of going to sleep and resuming.&lt;br /&gt;
&lt;br /&gt;
===Event Script===&lt;br /&gt;
The event script needs to be created within {{path|/etc/acpi/events}} and can have any name you like.&lt;br /&gt;
In this case we call it lid because it will trigger the lid event. Do {{cmdroot|vi /etc/acpi/events/lid}} and make it look like this:&lt;br /&gt;
 event=button/lid&lt;br /&gt;
 action=/etc/acpi/actions/sleep.sh %e&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;event&amp;quot; line is a regular expression specifying the events we're&lt;br /&gt;
interested in. You can determine what the event strings are from looking at&lt;br /&gt;
{{path|/var/log/acpid}} after trying to suspend, close the lid, etc. .&lt;br /&gt;
You can find information about the event strings [[ibm-acpi]] generates for certain keys at the [[How to get special keys to work#ibm-acpi_events | Special Keys HOWTO]].&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;action&amp;quot; line is the command to be executed when these events are&lt;br /&gt;
dispatched. In this example we call the {{path|sleep.sh}} script residing in {{path|/etc/acpi/actions}} and pass the event description text using the %e placeholder.&lt;br /&gt;
&lt;br /&gt;
For the script you an use the &amp;lt;tt&amp;gt;hibernate&amp;lt;/tt&amp;gt; script of [http://www.suspend2.net/ Software Suspend 2] (it is independent of the [[Software Suspend 2|suspend-to-disk]] functionality), or any of many examples available on the web, such as the one below.&lt;br /&gt;
&lt;br /&gt;
{{NOTE|To make your changes take effect after adding or modifying the events files you must do a &amp;lt;tt&amp;gt;kill -SIGHUP `pidof acpid`&amp;lt;/tt&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
===Action Script===&lt;br /&gt;
Our example {{path|/etc/acpi/actions/sleep.sh}} script looks as follows:&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 &lt;br /&gt;
 # if launched through a lid event and lid is open, do nothing&lt;br /&gt;
 echo &amp;quot;$1&amp;quot; | grep &amp;quot;button/lid&amp;quot; &amp;amp;&amp;amp; grep -q open /proc/acpi/button/lid/LID/state &amp;amp;&amp;amp; exit 0&lt;br /&gt;
 &lt;br /&gt;
 # remove USB 1.1 driver&lt;br /&gt;
 rmmod uhci_hcd&lt;br /&gt;
  &lt;br /&gt;
 # sync filesystem and clock&lt;br /&gt;
 sync&lt;br /&gt;
 /sbin/hwclock --systohc&lt;br /&gt;
 &lt;br /&gt;
 # switch to console&lt;br /&gt;
 FGCONSOLE=`fgconsole`&lt;br /&gt;
 chvt 6&lt;br /&gt;
 /usr/sbin/radeontool light off&lt;br /&gt;
 &lt;br /&gt;
 # go to sleep&lt;br /&gt;
 sleep 5 &amp;amp;&amp;amp; echo -n &amp;quot;mem&amp;quot; &amp;gt; /sys/power/state&lt;br /&gt;
 &lt;br /&gt;
 # readjust the clock (it might be off a bit after suspend)&lt;br /&gt;
 /sbin/hwclock --adjust&lt;br /&gt;
 /sbin/hwclock --hctosys&lt;br /&gt;
 &lt;br /&gt;
 # reload USB 1.1 driver&lt;br /&gt;
 modprobe uhci_hcd&lt;br /&gt;
 &lt;br /&gt;
 # turn on the backlight and switch back to X&lt;br /&gt;
 radeontool light on&lt;br /&gt;
 chvt $FGCONSOLE&lt;br /&gt;
&lt;br /&gt;
====Explanations====&lt;br /&gt;
*The lid generates an event for both opening and closing thus requiring that we check its state and only act if it's closed.&lt;br /&gt;
*There have been problems encountered with the USB devices not working properly after a resume from suspend. To circumvent those we remove the USB driver prior to suspend and reload it afterwards.&lt;br /&gt;
*Note that the {{cmdroot|echo -n &amp;quot;mem&amp;quot; &amp;gt; /sys/power/state}} line does not return until we are revived. So there is only one event generated and there is no need to check the state of anything.&lt;br /&gt;
*The console switching code in this script is a special solution for [[Problem with LCD backlight remaining on during ACPI sleep|a problem where the backlight doesn't switch off]] on the {{T30}} and some other models. Before going to sleep, these models switch to console mode which causes the backlight to come back on. So we preemptively switch to console mode and turn off the backlight using [[radeontool]] before going to sleep.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
*If something doesn't work, your first action should be a {{cmdroot|tail /var/log/acpid}}. It will tell you a lot about what is going on. If it has &amp;quot;Permission denied&amp;quot; errors, check the permissions of your {{path|/etc/acpi/actions}} scripts (especially make sure that the executable bit is set). Also check the permissions for other involved files like i.e. device nodes.&lt;br /&gt;
*If your display doesn't come back on resume, look [[Problem with display remaining black after resume|here]].&lt;br /&gt;
*My X21 didn't reset the sleep LED (the small moon), it was blinking after the sleep, if you have the ibm-acpi kernel module loaded, you can switch it of after the sleep by appending this line to the script:&lt;br /&gt;
 echo 7 off &amp;gt; /proc/acpi/ibm/led&lt;br /&gt;
{{NOTE|&lt;br /&gt;
The ibm-acpi module must have the experimental&amp;lt;math&amp;gt;=&amp;lt;/math&amp;gt;1 parameter passed to if for /proc/acpi/ibm/led to work.  You can either do this through a /etc/modprobe.d entry or manually.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:770X]] [[Category:770Z]] [[Category:A20m]] [[Category:A20p]] [[Category:A20m]] [[Category:A20p]] [[Category:A21e]] [[Category:A21m]] [[Category:A21p]] [[Category:A22e]] [[Category:A22m]] [[Category:A22p]] [[Category:G40]] [[Category:G41]] [[Category:R30]] [[Category:R31]] [[Category:R32]] [[Category:R40]] [[Category:R40e]] [[Category:R50]] [[Category:R50p]] [[Category:R51]] [[Category:R52]] [[Category:T20]] [[Category:T21]] [[Category:T22]] [[Category:T23]] [[Category:T30]] [[Category:T40]] [[Category:T40p]] [[Category:T41]] [[Category:T41p]] [[Category:T42]] [[Category:T42p]] [[Category:T43]] [[Category:T43p]] [[Category:X20]] [[Category:X21]] [[Category:X22]] [[Category:X23]] [[Category:X24]] [[Category:X30]] [[Category:X31]] [[Category:X32]] [[Category:X40]] [[Category:X41]] [[Category:X41 Tablet]] [[Category:TransNote]]&lt;/div&gt;</summary>
		<author><name>Sigil</name></author>
		
	</entry>
</feed>