[PATCH hal 2/2] add a WWAN (Wireless WAN/Cellular) killswitch for Dell laptops

Faidon Liambotis paravoid at debian.org
Sun Aug 5 05:26:28 PDT 2007


HAL is already using dellWirelessCtl to control Dell's kill switch for
Bluetooth and WLAN. The same utility allows the switching of the WWAN
(Wireless WAN aka Cellular) cards shipped in some laptops.

Include this in HAL, mostly for completness right now. It may get more
useful in the feature; other vendors have began shipping WWAN too.
---
 doc/spec/hal-spec-properties.xml                  |    8 ++++++-
 policy/hal-killswitch.policy                      |   13 ++++++++++-
 tools/linux/hal-system-killswitch-get-power-linux |   18 +++++++++++++++++
 tools/linux/hal-system-killswitch-set-power-linux |   22 +++++++++++++++++++++
 4 files changed, 58 insertions(+), 3 deletions(-)

diff --git a/doc/spec/hal-spec-properties.xml b/doc/spec/hal-spec-properties.xml
index 94bc171..8983330 100644
--- a/doc/spec/hal-spec-properties.xml
+++ b/doc/spec/hal-spec-properties.xml
@@ -6710,7 +6710,7 @@ org.freedesktop.Hal.Device.Volume.method_signatures = {'ssas', 'as', 'as'}
               <entry></entry>
               <entry>wlan</entry>
               <entry></entry>
-              <entry>Kill switch is for turning Wireless networking on/off</entry>
+              <entry>Kill switch is for turning Wireless LAN (WLAN) networking on/off</entry>
             </row>
             <row>
               <entry></entry>
@@ -6719,6 +6719,12 @@ org.freedesktop.Hal.Device.Volume.method_signatures = {'ssas', 'as', 'as'}
               <entry>Kill switch is for turning Bluetooth on/off</entry>
             </row>
             <row>
+              <entry></entry>
+              <entry>wwan</entry>
+              <entry></entry>
+              <entry>Kill switch is for turning Wireless WAN (WWAN) networking on/off</entry>
+            </row>
+            <row>
               <entry>
                 <literal>killswitch.access_method</literal> (string)
               </entry>
diff --git a/policy/hal-killswitch.policy b/policy/hal-killswitch.policy
index c658cdc..5cafa67 100644
--- a/policy/hal-killswitch.policy
+++ b/policy/hal-killswitch.policy
@@ -31,8 +31,17 @@ file are instantly applied.
     </policy>
 
     <policy id="hal-killswitch-wlan">
-      <description>Turn WLAN radio On/Off</description>
-      <message>System policy prevents turning the WLAN radio On/Off</message>
+      <description>Turn Wireless LAN (WLAN) radio On/Off</description>
+      <message>System policy prevents turning the Wireless LAN (WLAN) radio On/Off</message>
+      <defaults>
+        <allow_inactive>no</allow_inactive>
+        <allow_active>yes</allow_active>
+      </defaults>
+    </policy>
+
+    <policy id="hal-killswitch-wwan">
+      <description>Turn Wireless WAN (WWAN) radio On/Off</description>
+      <message>System policy prevents turning the Wireless WAN (WWAN) radio On/Off</message>
       <defaults>
         <allow_inactive>no</allow_inactive>
         <allow_active>yes</allow_active>
diff --git a/tools/linux/hal-system-killswitch-get-power-linux b/tools/linux/hal-system-killswitch-get-power-linux
index f19d1f4..3bd7c4a 100755
--- a/tools/linux/hal-system-killswitch-get-power-linux
+++ b/tools/linux/hal-system-killswitch-get-power-linux
@@ -63,6 +63,24 @@ elif [ "$HAL_PROP_KILLSWITCH_TYPE" = "wlan" ]; then
 	echo "Access type not supported" >&2
 	exit 1
     fi
+elif [ "$HAL_PROP_KILLSWITCH_TYPE" = "wwan" ]; then
+    if [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "dell" -a -x /usr/bin/dellWirelessCtl ]; then
+	# TODO: write our own binary that links with libsmbios?
+	/usr/bin/dellWirelessCtl --st_wwan
+	value=$?
+	if [ "$value" = "0" ]; then
+	    exit 1
+	elif [ "$value" = "1" ]; then
+	    exit 0
+	else
+	    echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
+	    echo "dellWirelessCtl returned $value" >&2
+	fi
+    else
+	echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
+	echo "Access type not supported" >&2
+	exit 1
+    fi
 else
     echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
     echo "Killswitch type not supported" >&2
diff --git a/tools/linux/hal-system-killswitch-set-power-linux b/tools/linux/hal-system-killswitch-set-power-linux
index 85a4548..c19534d 100755
--- a/tools/linux/hal-system-killswitch-set-power-linux
+++ b/tools/linux/hal-system-killswitch-set-power-linux
@@ -71,6 +71,28 @@ elif [ "$HAL_PROP_KILLSWITCH_TYPE" = "wlan" ]; then
 	echo "Access type not supported" >&2
 	exit 1
     fi
+elif [ "$HAL_PROP_KILLSWITCH_TYPE" = "wwan" ]; then
+    if [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "dell" -a -x /usr/bin/dellWirelessCtl ]; then
+
+	# As a side effect we disable the physical kill switch
+
+	# TODO: write our own binary that links with libsmbios?
+	if [ "$value" = "true" ]; then
+	    /usr/bin/dellWirelessCtl --sw_wwan 0 --wwan 1
+	    ret=$?
+	else
+	    /usr/bin/dellWirelessCtl --sw_wwan 0 --wwan 0
+	    ret=$?
+	fi
+	if [ "$ret" != "0" ]; then
+	    echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
+	    echo "dellWirelessCtl returned $ret" >&2
+	fi
+    else
+	echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
+	echo "Access type not supported" >&2
+	exit 1
+    fi
 else
     echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
     echo "Killswitch type not supported" >&2
-- 
1.5.2.4



More information about the hal mailing list