packages: acpid/acpid.init, acpid/acpid.sysconfig - IBM_LAPTOP is back (thi...

glen glen at pld-linux.org
Tue Nov 17 22:30:08 CET 2009


Author: glen                         Date: Tue Nov 17 21:30:08 2009 GMT
Module: packages                      Tag: HEAD
---- Log message:
- IBM_LAPTOP is back (thinkpad_acpi module)
- add $MODULES for all modules support (idea from debian)
- loads modules at once (speed)

---- Files affected:
packages/acpid:
   acpid.init (1.28 -> 1.29) , acpid.sysconfig (1.11 -> 1.12) 

---- Diffs:

================================================================
Index: packages/acpid/acpid.init
diff -u packages/acpid/acpid.init:1.28 packages/acpid/acpid.init:1.29
--- packages/acpid/acpid.init:1.28	Tue Nov 17 22:14:02 2009
+++ packages/acpid/acpid.init	Tue Nov 17 22:30:03 2009
@@ -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 @@
 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: packages/acpid/acpid.sysconfig
diff -u packages/acpid/acpid.sysconfig:1.11 packages/acpid/acpid.sysconfig:1.12
--- packages/acpid/acpid.sysconfig:1.11	Tue Nov 17 22:14:02 2009
+++ packages/acpid/acpid.sysconfig	Tue Nov 17 22:30:03 2009
@@ -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"
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/acpid/acpid.init?r1=1.28&r2=1.29&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/acpid/acpid.sysconfig?r1=1.11&r2=1.12&f=u



More information about the pld-cvs-commit mailing list