[Debian-eeepc-devel] [PATCH] Load eeepc_laptop and set SHEngine in background

Luca Niccoli lultimouomo at gmail.com
Tue Oct 13 12:40:50 UTC 2009


The attached patch sets adds a line to /etc/modprobe.d/eeepc.conf to make
modprobe fork to background while loading eeepc_laptop, and modifies the
init script accordingly to wait for it to be loaded.
It also makes the init script do the SHEngine setting in background, as that
is very slow.

diff -ruN eeepc-acpi-scripts-1.1.2/debian/eeepc-acpi-scripts.init eeepc-acpi-scripts-1.1.2.new/debian/eeepc-acpi-scripts.init
--- eeepc-acpi-scripts-1.1.2/debian/eeepc-acpi-scripts.init	2009-08-10 10:04:32.000000000 +0200
+++ eeepc-acpi-scripts-1.1.2.new/debian/eeepc-acpi-scripts.init	2009-10-13 14:19:22.407764702 +0200
@@ -11,9 +11,6 @@
 # exit if package not installed
 test -f /usr/share/eeepc-acpi-scripts/functions.sh || exit 0
 
-# exit if eeepc-laptop isn't loaded (should be loaded by udev)
-test -d /sys/bus/platform/devices/eeepc || exit 0
-
 PATH="/sbin:/bin"
 
 . /lib/lsb/init-functions
@@ -36,6 +33,14 @@
 case "$1" in
   start|restart|reload|force-reload)
 
+    # The module could be loading in background, let's wait for it.
+
+    modprobe --use-blacklist --ignore-install eeepc_laptop || :
+
+    # Check if the sysfs interface is present. If not, it's time to die.
+
+    [ -d /sys/bus/platform/devices/eeepc ] || exit 0
+
     # First, get the kernel version.
 
     KERNEL="`uname -r`"
@@ -98,10 +103,10 @@
 	    log_action_cont_msg '(manual)'
 	elif [ "$(cat /sys/class/power_supply/AC0/online 2>/dev/null)" = 0 ]; then
 	    log_action_cont_msg '(battery)'
-	    set_shengine "${PWR_CLOCK_BATTERY:-$(($SHENGINE_LIMIT - 1))}" || :
+	    set_shengine "${PWR_CLOCK_BATTERY:-$(($SHENGINE_LIMIT - 1))}" &
 	else
 	    log_action_cont_msg '(AC)'
-	    set_shengine "${PWR_CLOCK_AC:-0}" || :
+	    set_shengine "${PWR_CLOCK_AC:-0}" &
 	fi
 	log_action_end_msg $?
     fi
diff -ruN eeepc-acpi-scripts-1.1.2/etc/modprobe.d/eeepc.conf eeepc-acpi-scripts-1.1.2.new/etc/modprobe.d/eeepc.conf
--- eeepc-acpi-scripts-1.1.2/etc/modprobe.d/eeepc.conf	2009-08-10 10:04:32.000000000 +0200
+++ eeepc-acpi-scripts-1.1.2.new/etc/modprobe.d/eeepc.conf	2009-10-13 14:20:02.723740277 +0200
@@ -2,3 +2,4 @@
 blacklist pcspkr
 blacklist i2c_i801
 options snd_hda_intel power_save=5
+install eeepc_laptop /sbin/modprobe --ignore-install eeepc_laptop $CMDLINE_OPTS &



More information about the Debian-eeepc-devel mailing list