3 Author: Paul Warren <u3292467@student.anu.edu.au>
6 How to get your shiny LFS box to shutdown when you press the
12 ACPI [1] is the advanced Configuration and Power interface. It
13 basically is an upgrade of the old Advanced Power Management
14 interface, and allows for much more flexibility in configuring actions
17 The ACPI Daemon is a user space daemon that reacts to these events
18 through the /proc interface.
20 To get the package fire this link up in your browser and choose your
21 favourite sourceforge mirror.
23 http://prdownloads.sourceforge.net/acpid/acpid-1.0.1.tar.gz?download
27 http://umn.dl.sourceforge.net/sourceforge/acpid/acpid-1.0.1.tar.gz
30 First of all you need to ensure your motherboard and power supply
31 supports the ACPI standard. Most models post 2000 should be Ok, as
32 well as a few before that, check your manufacturers documentation though.
34 ACPID should be used in conjunction with kernels greater than 2.4.8,
35 but versions before that can be patched with the latest ACPI drivers.
36 This shouldn't be a concern for LFS people, with linux-2.4.19 as
39 Next step is to ensure that your kernel has the drivers loaded, either
40 in the kernel proper or as modules.
41 [*] Power Management support
42 [*] ACPI support (NEW)
43 [ ] ACPI Debug Statements (NEW)
44 <M> ACPI Bus Manager (NEW)
49 < > Embedded Controller
51 If you're on a laptop you can add in AC Adaptor and Embedded
54 The usual procedures apply for installing your new kernel and
55 modules. The modules are called:
61 I'm not sure about the AC adaptor and Embedded Controller, because
62 I don't have a laptop to test it on.
64 So do something like the following if you are using BSD style init.
66 cat >> /etc/rc.d/rc.modules << "EOF"
69 modprobe ospm_processor
73 and this for sysvinit. Thanks to DĂȘnis Volpato Martins
75 cat > $rc_base/init.d/acpid << "EOF"
77 # Begin $rc_base/init.d/acpid
79 # Based on sysklogd script from LFS-3.1 and earlier.
80 # Rewritten by DĂȘnis Volpato Martins - dvm@linux-sc.org
83 source /etc/sysconfig/rc
88 echo "Starting acpid..."
91 modprobe ospm_processor
98 echo "Stopping acpid..."
103 echo "Reloading acpid..."
118 echo "Usage: $0 {start|stop|reload|restart|status}"
123 # End $rc_base/init.d/acpid
126 there is some symlinking to do here, but I'm not sure how that works
127 either. Will research it one day.
130 Next, on to the ACPI Daemon. The source requires no ./configure, as
131 it only depends on the kernel, so do a
137 Now for the configuring.
139 We need to make an acpi directory under /etc, and an events directory
142 mkdir -p /etc/acpi/events
144 First of all is the event Handler.
146 cat > /etc/acpi/acpi_handler.sh << "EOF"
148 # Default acpi script that takes an entry for all actions
157 *) logger "ACPI action $2 is not defined"
161 *) logger "ACPI group $1 / action $2 is not defined"
165 chmod 755 /etc/acpi/event_handler.sh
170 cat > /etc/acpi/events/default << "EOF"
171 # This is the ACPID default configuration, it takes all
172 # events and passes them to /etc/acpi/default.sh for further
175 # event keeps a regular expression matching the event. To get
176 # power events only, just use something like "event=button power.*"
178 # action keeps the command to be executed after an event occurs
179 #This halts the computer when the Power button is pressed.
182 action=/sbin/shutdown -h now
184 # Optionally you can specify the placeholder %e. It will pass
185 # through the whole kernel event message to the program you've
189 action=/etc/acpi/acpi_handler.sh %e
191 chmod 755 /etc/acpi/events/default
194 you can add actions for other events.
196 And now you can run, as root
199 To get acpid to run on boot, add /usr/sbin/acpid into your rc.local
200 file. Or use the above rc.acpid for sysvinit.
202 Test if it works by pressing your power button. I've never
203 experienced any problems with doing this. But email me if you get into
208 [1] http://www.acpi.info/index.html