[Debian-eeepc-devel] [eeepc-acpi-scripts PATCH] rfkill bits for use with kernel 2.6.28
Darren Salt
linux at youmustbejoking.demon.co.uk
Wed Dec 3 16:39:18 UTC 2008
Prefer to use rfkill where available for toggling wireless & bluetooth.
If you find that the device isn't being enabled, enable it in the BIOS
configuration first.
diff --git a/etc/acpi/actions/wireless.sh b/etc/acpi/actions/wireless.sh
--- a/etc/acpi/actions/wireless.sh
+++ b/etc/acpi/actions/wireless.sh
@@ -2,7 +2,9 @@
. /usr/share/eeepc-acpi-scripts/functions.sh
-wlan_control=/sys/devices/platform/eeepc/wlan
+detect_rfkill eeepc-wlan
+wlan_control="$RFKILL"
+[ -e $wlan_control ] || wlan_control=/sys/devices/platform/eeepc/wlan # pre-2.6.28
[ -e $wlan_control ] || wlan_control=/proc/acpi/asus/wlan # pre-2.6.26
case $1 in
diff --git a/etc/acpi/lib/bluetooth.sh b/etc/acpi/lib/bluetooth.sh
--- a/etc/acpi/lib/bluetooth.sh
+++ b/etc/acpi/lib/bluetooth.sh
@@ -2,7 +2,9 @@
#
# to be sourced
-BT_CTL=/sys/devices/platform/eeepc/bluetooth
+detect_rfkill eeepc-bluetooth
+BT_CTL="$RFKILL"
+[ -e $BT_CTL ] || BT_CTL=/sys/devices/platform/eeepc/bluetooth # pre-2.6.28
[ -e $BT_CTL ] || BT_CTL=/proc/acpi/asus/bluetooth # pre-2.6.26
# check if bluetooth is switched on and return success (exit code 0 if it is
# return failure (exit code 1) if it is not
diff --git a/functions.sh b/functions.sh
--- a/functions.sh
+++ b/functions.sh
@@ -12,6 +12,20 @@ detect_wlan()
fi
echo "Detected WLAN module $WLAN_MOD on $WLAN_IF" >&2
+}
+
+# detect which rfkill has name=$1
+detect_rfkill()
+{
+ local _rfkill
+ for _rfkill in /sys/class/rfkill/*; do
+ if [ "$(cat "$_rfkill/name")" = "$1" ]; then
+ echo "Detected $1 as rfkill $_rfkill" >&2
+ RFKILL="$_rfkill/state"
+ return
+ fi
+ done
+ RFKILL=''
}
detect_x_display()
--
| Darren Salt | linux or ds at | nr. Ashington, | Toon
| RISC OS, Linux | youmustbejoking,demon,co,uk | Northumberland | Army
| Kill all extremists!
You are so narrow-minded that you can see through a keyhole with two eyes.
More information about the Debian-eeepc-devel
mailing list