<?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=213.67.138.15</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=213.67.138.15"/>
	<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/wiki/Special:Contributions/213.67.138.15"/>
	<updated>2026-09-29T07:21:51Z</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=4914</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=4914"/>
		<updated>2005-05-18T23:54:44Z</updated>

		<summary type="html">&lt;p&gt;213.67.138.15: /* Example: go to sleep on lid close */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Basically, acpid just executes scripts residing in &amp;lt;tt&amp;gt;/etc/acpi/actions&amp;lt;/tt&amp;gt;. Which script to launch at which event is configured in several files in &amp;lt;tt&amp;gt;/etc/acpi/events&amp;lt;/tt&amp;gt;. {{cmd|man acpid}} holds detailed information on how to configure acpid.&lt;br /&gt;
&lt;br /&gt;
The [[ibm-acpi]] package includes example scripts in the &amp;lt;tt&amp;gt;config&amp;lt;/tt&amp;gt; folder inside the tarball. They are a good starting point to adjust them to your needs. You also might want to have a look at the [[Configs#ACPI | ACPI section of the Configs page]] or the [[:Category:Scripts|Scripts]] repository. 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;
&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;
The event script needs to be created within &amp;lt;tt&amp;gt;/etc/acpi/events&amp;lt;/tt&amp;gt; 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;
&amp;lt;tt&amp;gt;/var/log/acpid&amp;lt;/tt&amp;gt; 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 &amp;lt;tt&amp;gt;sleep.sh&amp;lt;/tt&amp;gt; script residing in &amp;lt;tt&amp;gt;/etc/acpi/actions&amp;lt;/tt&amp;gt; and pass the event description text using the %e placeholder.&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;
Our example &amp;lt;tt&amp;gt;/etc/acpi/actions/sleep.sh&amp;lt;/tt&amp;gt; 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;
 # 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;
 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;
 # 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;
The lid generates an event for both opening and closing thus requiring&lt;br /&gt;
that we check it's state and only act if it's closed.&lt;br /&gt;
&lt;br /&gt;
Note that the &amp;lt;code&amp;gt;echo -n &amp;quot;mem&amp;quot; &amp;gt; /sys/power/state&lt;br /&gt;
&amp;lt;/code&amp;gt; line does not return until we are revived. So there is&lt;br /&gt;
only one event generated and there is no need to check the state of&lt;br /&gt;
anything.&lt;br /&gt;
&lt;br /&gt;
The console switching code in this script is a special solution for&lt;br /&gt;
[[Problem with LCD backlight remaining on during ACPI sleep|a problem where the backlight doesn't switch off]]&lt;br /&gt;
on the {{T30}} and some other models. Before going to sleep, these models switch to console mode which causes the&lt;br /&gt;
backlight to come back on. So we preemptively switch to console mode and turn off the backlight using [[radeontool]]&lt;br /&gt;
before going to sleep.&lt;br /&gt;
&lt;br /&gt;
A problem encountered when trying to get suspend to work on X40 was that the display did not turn back on properly afterwards. The fix for this was to insert &amp;lt;tt&amp;gt;acpi_sleep=s3_bios&amp;lt;/tt&amp;gt; into &amp;lt;tt&amp;gt;/boot/grub/menu.lst&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 title           Debian GNU/Linux, kernel 2.6.11-1-686&lt;br /&gt;
 root            (hd0,0)&lt;br /&gt;
 kernel          /boot/vmlinuz-2.6.11-1-686 root=/dev/hda1 ro acpi_sleep=s3_bios&lt;br /&gt;
 initrd          /boot/initrd.img-2.6.11-1-686&lt;br /&gt;
 savedefault&lt;br /&gt;
 boot&lt;br /&gt;
&lt;br /&gt;
I also encountered a problem with the USB-mouse not working properly after a resume from suspend. This was fixed by &amp;lt;tt&amp;gt;rmmod uhci_hcd&amp;lt;/tt&amp;gt; in the suspend script followed by a &amp;lt;tt&amp;gt;modprobe uhci_hcd&amp;lt;/tt&amp;gt; after the suspend.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:570]] [[Category:570E]] [[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]]&lt;/div&gt;</summary>
		<author><name>213.67.138.15</name></author>
		
	</entry>
</feed>