[Debian-eeepc-commits] [SCM] Maintenance of eeepc-acpi-scripts debian package branch, master, updated. 9310ca7d0d0f36a47074f599a9eeea7f3c7a4ebc
Darren Salt
linux at youmustbejoking.demon.co.uk
Sat Mar 28 17:42:26 UTC 2009
The following commit has been merged in the master branch:
commit 1a76731380cf40381564ed0e914cc660d67ee98f
Author: Darren Salt <linux at youmustbejoking.demon.co.uk>
Date: Sat Mar 28 15:24:05 2009 +0000
Use an init script to load pciehp and rfkill-input if needed.
This obsoletes the pciehp script and its entry in /etc/modprobe.d/eeepc.conf.
diff --git a/debian/changelog b/debian/changelog
index c25c0d0..b9f8790 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -25,10 +25,8 @@ eeepc-acpi-scripts (1.0.12) UNRELEASED; urgency=low
* When locking the display, if all else fails, try xtrlock.
* Prepare for netlink-enabled acpid: ignore lid-open events and handle
differently-reported hotkey events.
- * Modify /etc/modprobe.d/eeepc for Linux 2.6.27 and later.
- The pciehp module's pciehp_slot_with_bus option was removed in 2.6.27,
- and the module isn't needed in 2.6.29 since eeepc-laptop handles the
- wireless hotplugging.
+ * Use an init script to load pciehp (if needed) and rfkill-input (if
+ available; we rely on it if the kernel is 2.6.29 or newer).
[ Raphael Geissert ]
* Auto detect the playback devices and the playback switches
diff --git a/debian/eeepc-acpi-scripts.init b/debian/eeepc-acpi-scripts.init
new file mode 100644
index 0000000..153abf0
--- /dev/null
+++ b/debian/eeepc-acpi-scripts.init
@@ -0,0 +1,101 @@
+#! /bin/sh -e
+### BEGIN INIT INFO
+# Provides: eeepc-acpi-scripts
+# Required-Start: udev mountkernfs
+# Required-Stop:
+# Default-Start: S
+# Default-Stop:
+# Short-Description: Load modules which are useful on EeePCs and similar hardware
+### END INIT INFO
+
+# 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/module/eeepc_laptop || exit 0
+
+PATH="/sbin:/bin"
+
+. /lib/lsb/init-functions
+
+load_module ()
+{
+ log_action_cont_msg "$1"
+ maybe_warn modprobe $@
+}
+
+maybe_warn ()
+{
+ local WARN
+ WARN="$($@ 2>&1 || :)"
+ if [ -n "$WARN" ]; then
+ echo "$WARN"
+ log_warning_msg "$WARN"
+ fi
+}
+
+case "$1" in
+ start|restart|reload|force-reload)
+
+ # First, get the kernel version.
+
+ KERNEL="`uname -r`"
+ case "$KERNEL" in
+ 2.6.*)
+ KERNEL="`echo $KERNEL | sed -re 's/^([0-9]+\.){2}([0-9]+).*$/\2/'`"
+ ;;
+ *)
+ KERNEL=0
+ ;;
+ esac
+
+ # Now load the modules. We ignore failure since it's possible that
+ # they're built into the running kernel.
+
+ log_action_begin_msg 'Loading EeePC support modules'
+
+ # Load pciehp if required.
+ # There are three recognised cases:
+ # - kernel 2.6.26 & older: two parameters required
+ # - kernel 2.6.27 & .28 : one of those parameters has been removed
+ # - kernel 2.6.29 & newer: hotplugging is handled in eeepc-laptop
+ if [ -d /sys/module/pciehp ]; then
+ # Hmm, already present
+ if [ "$KERNEL" -ge 29 ]; then
+ # 2.6.29 and newer (problem)
+ log_warning_msg 'Module "pciehp" is loaded; trying to unload'
+ maybe_warn modprobe -r pciehp
+ fi
+ else
+ # Load it if needed
+ if [ "$KERNEL" -lt 27 ]; then
+ # 2.6.26 and older
+ load_module pciehp pciehp_force=1 pciehp_slot_with_bus=1
+ elif [ "$KERNEL" -lt 29 ]; then
+ # 2.6.27 and 2.6.28
+ load_module pciehp pciehp_force=1
+ fi
+ fi
+
+ # Load rfkill-input if possible, i.e. kernel is 2.6.28 or newer.
+ # This results in faster WLAN hw toggling.
+ if [ "$KERNEL" -ge 28 ] && ! grep -q '^H.*\brfkill\b' /proc/bus/input/devices; then
+ load_module rfkill-input
+ fi
+
+ # Done.
+
+ log_action_end_msg 0
+ ;;
+
+ stop)
+ # Nothing to do.
+ ;;
+
+ *)
+ echo "Usage: /etc/init.d/eeepc-acpi-scripts {start|stop|restart|reload|force-reload}"
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/debian/rules b/debian/rules
index f7e509d..54ef99b 100755
--- a/debian/rules
+++ b/debian/rules
@@ -34,7 +34,7 @@ install: build
install -m 0644 etc/acpi/lib/* $(TMP)/etc/acpi/lib
install -m 0755 etc/alsa/modprobe-post-install.d/* $(TMP)/etc/alsa/modprobe-post-install.d
install -m 0644 etc/modprobe.d/* $(TMP)/etc/modprobe.d
- install -m 0644 functions.sh pciehp.sh $(TMP)/usr/share/$(PKG)/
+ install -m 0644 functions.sh $(TMP)/usr/share/$(PKG)/
binary-indep: build install
dh_testdir
diff --git a/etc/modprobe.d/eeepc.conf b/etc/modprobe.d/eeepc.conf
index 20a28b0..5cc0101 100644
--- a/etc/modprobe.d/eeepc.conf
+++ b/etc/modprobe.d/eeepc.conf
@@ -1,5 +1,3 @@
# module options specific for Asus EeePC
blacklist pcspkr
-# different kernel versions, different options...
-install pciehp sh /usr/share/eeepc-acpi-scripts/pciehp.sh
options snd_hda_intel power_save=5
diff --git a/pciehp.sh b/pciehp.sh
deleted file mode 100644
index f8be1e5..0000000
--- a/pciehp.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#! /bin/sh
-
-# Load pciehp if required.
-# There are three recognised cases:
-# - kernel 2.6.26 & older: two parameters required
-# - kernel 2.6.27 & .28 : one of those parameters has been removed
-# - kernel 2.6.29 & newer: hotplugging is handled in eeepc-laptop
-
-KERNEL="`uname -r`"
-case "$KERNEL" in
- 2.6.*)
- KERNEL="`echo $KERNEL | sed -re 's/^([0-9]+\.){2}([0-9]+).*$/\2/'`"
- if [ "$KERNEL" -lt 27 ]; then
- # 2.6.26 and older
- exec modprobe --ignore-install pciehp pciehp_force=1 pciehp_slot_with_bus=1
- elif [ "$KERNEL" -lt 29 ]; then
- # 2.6.27 and 2.6.28
- exec modprobe --ignore-install pciehp pciehp_force=1
- fi
- ;;
-esac
-
-exit 0
--
Maintenance of eeepc-acpi-scripts debian package
More information about the Debian-eeepc-commits
mailing list