From: Elan Ruusamäe Date: Tue, 17 Nov 2009 21:30:03 +0000 (+0000) Subject: - IBM_LAPTOP is back (thinkpad_acpi module) X-Git-Tag: auto/th/acpid-2_0_3-1~9 X-Git-Url: http://git.pld-linux.org/?p=packages%2Facpid.git;a=commitdiff_plain;h=180a224063bd1371f0e5195f9679796676e58580;hp=f3cb2b45053d0b1010105b0e4eea25209e7fc989 - IBM_LAPTOP is back (thinkpad_acpi module) - add $MODULES for all modules support (idea from debian) - loads modules at once (speed) Changed files: acpid.init -> 1.29 acpid.sysconfig -> 1.12 --- diff --git a/acpid.init b/acpid.init index 59d4d68..4100a76 100644 --- a/acpid.init +++ b/acpid.init @@ -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" diff --git a/acpid.sysconfig b/acpid.sysconfig index b2bb703..4293446 100644 --- a/acpid.sysconfig +++ b/acpid.sysconfig @@ -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"