]> git.pld-linux.org Git - packages/acpid.git/commitdiff
- IBM_LAPTOP is back (thinkpad_acpi module)
authorElan Ruusamäe <glen@pld-linux.org>
Tue, 17 Nov 2009 21:30:03 +0000 (21:30 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
- add $MODULES for all modules support (idea from debian)
- loads modules at once (speed)

Changed files:
    acpid.init -> 1.29
    acpid.sysconfig -> 1.12

acpid.init
acpid.sysconfig

index 59d4d683ce58a2ce154d572579b1241b998ddd7f..4100a767ccc85aab707b7f44675f90e13538be12 100644 (file)
@@ -8,6 +8,9 @@
 #
 # pidfile:     /var/run/acpid.pid
 
+# Check for ACPI event-file support on kernel side
+[ -r /proc/acpi/event ] || exit 0
+
 # Source function library.
 . /etc/rc.d/init.d/functions
 
@@ -16,38 +19,51 @@ LAPTOP_MODULES=""
 VARIOUS_MODULES=""
 ASUS_LAPTOP=""
 TOSHIBA_LAPTOP=""
+MODULES=""
 
 # Configuration file.
 . /etc/sysconfig/acpid
 
+# As the name says. If the kernel supports modules,
+# it'll try to load the ones listed in "MODULES".
+load_modules() {
+       [ -f /proc/modules ] || return 0
+
+       if [ "$MODULES" = "all" ]; then
+               MODULES=$(sed -rn 's#^kernel/(drivers|misc)/acpi/([^/]+/)*(.*)\.ko(\.gz)?:.*#\3#p' /lib/modules/$(uname -r)/modules.dep)
+       else
+               # assemble from old lists
+               MODULES="$MODULES $LAPTOP_MODULES"
+               MODULES="$MODULES $VARIOUS_MODULES"
+               if is_yes "$ASUS_LAPTOP"; then
+                       MODULES="$MODULES asus_acpi"
+               fi
+               if is_yes "$TOSHIBA_LAPTOP"; then
+                       MODULES="$MODULES toshiba_acpi"
+               fi
+               if is_yes "$IBM_LAPTOP"; then
+                       MODULES="$MODULES ibm_acpi"
+               fi
+               # strip spaces
+               MODULES=$(echo ${MODULES})
+       fi
+
+       if [ -z "$MODULES" ]; then
+               return
+       fi
+
+       show "Loading ACPI modules..."; busy
+       modprobe --all $MODULES && ok || fail
+}
+
 # Start daemons.
 start() {
        if [ -f /var/lock/subsys/acpid ]; then
                msg_already_running "ACPI Event Daemon"
                return
        fi
-       
-       if [ ! -d /proc/acpi/button ]; then
-               modprobe -s button
-       fi
 
-       # Load additional modules:
-       if [ -n "$LAPTOP_MODULES" ]; then
-               for i in $LAPTOP_MODULES; do
-                       modprobe -s $i
-               done
-       fi
-       if [ -n "$VARIOUS_MODULES" ]; then
-               for i in $VARIOUS_MODULES; do
-                       modprobe -s $i
-               done
-       fi
-       # Determine if it's ASUS or TOSHIBA laptop
-       if is_yes "$ASUS_LAPTOP"; then
-               modprobe -s asus_acpi
-       elif is_yes "$TOSHIBA_LAPTOP"; then
-               modprobe -s toshiba_acpi
-       fi
+       load_modules
 
        # starting:
        msg_starting "ACPI Event Daemon"
index b2bb7037b2cbfa45cb0d1d9fe9e2e66a1a281b79..42934462a364a9b71221780d983c40333848f46e 100644 (file)
@@ -3,16 +3,24 @@
 # Define nice level for acpid:
 SERVICE_RUN_NICE_LEVEL="+0"
 
-# Program arguments:
+# Program arguments passed to acpid commandline
 PROGRAM_ARGS=""
 
+# Modules to load before starting acpid
+
 # These modules are needed on laptops.
 #LAPTOP_MODULES="ac battery"
 
-# Various ACPI modules, usefull on destop system
+# Various ACPI modules, useful on destop system
 #VARIOUS_MODULES="fan processor thermal"
 
-# If you have ASUS or TOSHIBA laptop you can try to uncomment one of
+# If you have ASUS, TOSHIBA or IBM (thinkpad) laptop you can try to uncomment one of
 # this options to get additional features provided by acpi in this laptops
 #ASUS_LAPTOP="yes"
 #TOSHIBA_LAPTOP="yes"
+#IBM_LAPTOP="yes"
+
+# MODULES is a space seperated list of modules to load, or "all" to load all
+# acpi drivers, or commented out to load modules from above variables
+#MODULES="battery ac processor button fan thermal video"
+#MODULES="all"
This page took 1.002475 seconds and 4 git commands to generate.