[Debian-eeepc-commits] [SCM] Maintenance of eeepc-acpi-scripts debian package branch, rfkill, updated. 1.1.1-18-g32d546f

Darren Salt linux at youmustbejoking.demon.co.uk
Sun Jul 26 01:21:07 UTC 2009


The following commit has been merged in the rfkill branch:
commit 32d546fa20b8cdee566236f0489e98688e47b655
Author: Darren Salt <linux at youmustbejoking.demon.co.uk>
Date:   Sun Jul 26 02:11:02 2009 +0100

    rfkill dev: fix mis-hardwiring, simplify/fix detection, use device class names.
    
    The reason for using device class names is that rfkill(1) presently only takes
    index numbers or class names, not specific device names (which would be more
    useful).

diff --git a/etc/acpi/actions/wireless.sh b/etc/acpi/actions/wireless.sh
index 8a67f49..168f9dc 100755
--- a/etc/acpi/actions/wireless.sh
+++ b/etc/acpi/actions/wireless.sh
@@ -2,7 +2,7 @@
 
 . /usr/share/eeepc-acpi-scripts/functions.sh
 
-detect_rfkill eeepc-wlan
+detect_rfkill eeepc-wlan wlan
 wlan_control="$RFKILL"
 
 if ! have_dev_rfkill; then
diff --git a/etc/acpi/lib/bluetooth.sh b/etc/acpi/lib/bluetooth.sh
index ba68397..5c0a5ab 100644
--- a/etc/acpi/lib/bluetooth.sh
+++ b/etc/acpi/lib/bluetooth.sh
@@ -2,7 +2,7 @@
 #
 # to be sourced
 
-detect_rfkill eeepc-bluetooth
+detect_rfkill eeepc-bluetooth bluetooth
 BT_CTL="$RFKILL"
 if ! have_dev_rfkill; then
   [ -e "$BT_CTL" ] || BT_CTL=/sys/devices/platform/eeepc/bluetooth # pre-2.6.28
@@ -15,7 +15,7 @@ fi
 # if not, uses hcitool to see if there is a hci0 device
 bluetooth_is_on()
 {
-    if [ -e "$BT_CTL" ]; then
+    if have_dev_rfkill || [ -e "$BT_CTL" ]; then
         [ $( get_rfkill "$BT_CTL" ) = "1" ]
     else
         if [ "$BLUETOOTH_FALLBACK_TO_HCITOOL" = "yes" ]; then
@@ -29,7 +29,7 @@ bluetooth_is_on()
 toggle_bluetooth()
 {
     if bluetooth_is_on; then
-        if [ -e "$BT_CTL" ]; then
+        if have_dev_rfkill || [ -e "$BT_CTL" ]; then
             set_rfkill "$BT_CTL" 0
             # udev should unload the module now
         elif [ "$BLUETOOTH_FALLBACK_TO_HCITOOL" = "yes" ]; then
@@ -42,7 +42,7 @@ toggle_bluetooth()
 	    done
         fi
     else
-        if [ -e "$BT_CTL" ]; then
+        if have_dev_rfkill || [ -e "$BT_CTL" ]; then
             set_rfkill "$BT_CTL" 1
             # udev should load the module now
         elif [ "$BLUETOOTH_FALLBACK_TO_HCITOOL" = "yes" ]; then
diff --git a/functions.sh b/functions.sh
index aaef7f3..e0b6a42 100644
--- a/functions.sh
+++ b/functions.sh
@@ -19,26 +19,21 @@ detect_wlan()
     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 [ -f "$_rfkill/name" ] && [ "$(cat "$_rfkill/name")" = "$1" ]; then
-            echo "Detected $1 as rfkill $_rfkill" >&2
-            RFKILL="$_rfkill/state"
-            return
-        fi
-    done
-    RFKILL=''
-}
-
 have_dev_rfkill()
 {
   [ -c /dev/rfkill ]
 }
 
 if have_dev_rfkill; then
+    # detect which rfkill has name=$1
+    detect_rfkill()
+    {
+	RFKILL=''
+	if rfkill list | grep -q "$1:"; then
+	    RFKILL="${2:-1}"
+	fi
+    }
+
     get_rfkill()
     {
 	# simple yes/no, so...
@@ -48,13 +43,27 @@ if have_dev_rfkill; then
     set_rfkill()
     {
 	if [ "$2" = 0 ]; then
-	    rfkill block bluetooth
+	    rfkill block "$1"
 	else
-	    rfkill unblock bluetooth
+	    rfkill unblock "$1"
 	fi
     }
-else
-    # we have no /dev/rfkill
+else # we have no /dev/rfkill
+
+    # detect which rfkill has name=$1
+    detect_rfkill()
+    {
+	local _rfkill
+	for _rfkill in /sys/class/rfkill/*; do
+	    if [ -f "$_rfkill/name" ] && [ "$(cat "$_rfkill/name")" = "$1" ]; then
+		echo "Detected $1 as rfkill $_rfkill" >&2
+		RFKILL="$_rfkill/state"
+		return
+	    fi
+	done
+	RFKILL=''
+    }
+
     get_rfkill()
     {
 	cat "$1"

-- 
Maintenance of eeepc-acpi-scripts debian package



More information about the Debian-eeepc-commits mailing list