hal: Branch 'master' - 2 commits

David Zeuthen david at kemper.freedesktop.org
Fri Mar 23 17:04:41 PDT 2007


 NEWS                                              |    2 
 configure.in                                      |   31 ++++++++++-
 fdi/policy/10osvendor/10-rfkill-switch.fdi        |    6 +-
 fdi/policy/10osvendor/Makefile.am                 |    2 
 tools/Makefile.am                                 |    4 -
 tools/hal-system-killswitch-get-power             |    4 -
 tools/hal-system-killswitch-set-power             |    4 -
 tools/linux/Makefile.am                           |    4 -
 tools/linux/hal-system-bluetooth-get-power-linux  |   22 -------
 tools/linux/hal-system-bluetooth-set-power-linux  |   22 -------
 tools/linux/hal-system-killswitch-get-power-linux |   59 +++++++++++++++++++++
 tools/linux/hal-system-killswitch-set-power-linux |   61 ++++++++++++++++++++++
 12 files changed, 161 insertions(+), 60 deletions(-)

New commits:
diff-tree fca55ae474f6d3736a190741e222b2cd1a91322d (from 1e8845e9ad0a2583b21d962c1a683597ead69c65)
Author: David Zeuthen <davidz at redhat.com>
Date:   Fri Mar 23 20:03:35 2007 -0400

    forgot to add 10-rfkill-switch.fdi (renamed from 10-bluetooth-switch.fdi)

diff --git a/fdi/policy/10osvendor/10-rfkill-switch.fdi b/fdi/policy/10osvendor/10-rfkill-switch.fdi
new file mode 100644
index 0000000..c6b8a72
--- /dev/null
+++ b/fdi/policy/10osvendor/10-rfkill-switch.fdi
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deviceinfo version="0.2">
+
+  <device>
+    <match key="info.capabilities" contains="killswitch">
+      <append key="info.interfaces" type="strlist">org.freedesktop.Hal.Device.KillSwitch</append>
+
+      <append key="org.freedesktop.Hal.Device.KillSwitch.method_names" type="strlist">SetPower</append>
+      <append key="org.freedesktop.Hal.Device.KillSwitch.method_signatures" type="strlist">b</append>
+      <append key="org.freedesktop.Hal.Device.KillSwitch.method_argnames" type="strlist">power</append>
+      <append key="org.freedesktop.Hal.Device.KillSwitch.method_execpaths" type="strlist">hal-system-killswitch-set-power</append>
+
+      <append key="org.freedesktop.Hal.Device.KillSwitch.method_names" type="strlist">GetPower</append>
+      <append key="org.freedesktop.Hal.Device.KillSwitch.method_signatures" type="strlist"></append>
+      <append key="org.freedesktop.Hal.Device.KillSwitch.method_argnames" type="strlist"></append>
+      <append key="org.freedesktop.Hal.Device.KillSwitch.method_execpaths" type="strlist">hal-system-killswitch-get-power</append>
+    </match>
+  </device>
+
+</deviceinfo>
diff-tree 1e8845e9ad0a2583b21d962c1a683597ead69c65 (from 0cd8dccc8382f26d3b3f68f6131aefd08b134232)
Author: David Zeuthen <davidz at redhat.com>
Date:   Fri Mar 23 20:02:43 2007 -0400

    use libsmbios to add support for bluetooth, wlan RF kill on Dell laptops

diff --git a/NEWS b/NEWS
index d16f1a1..cc4d80a 100644
--- a/NEWS
+++ b/NEWS
@@ -11,7 +11,7 @@ Requirements for HAL 0.5.9 ""
  - dbus             >= 0.60      (with glib bindings)
  - glib             >= 2.6.0
  - expat            >= 1.95.8
- - hal-info         >= git version as of 20070228
+ - hal-info         >= git version as of 20070323
  - libusb           >= 0 0.1.10a (optional)
  - pciutils         >= 2.2.3     (optional
  - dmidecode        >= 2.7       (optional)
diff --git a/configure.in b/configure.in
index d9f61e6..2f460ec 100644
--- a/configure.in
+++ b/configure.in
@@ -325,8 +325,8 @@ if test "$LIB_SMBIOS" = "yes" ; then
         int micro ;
 
         if ( sscanf( LIBSMBIOS_RELEASE_VERSION , "%d.%d.%d", &major, &minor, &micro ) == 3 ) {
-	    if ((major == 0 && minor == 11 && micro >= 6) ||
-               (major >= 0 && minor > 11)) {
+	    if ((major == 0 && minor == 13 && micro >= 4) ||
+               (major >= 0 && minor > 13)) {
 		return 0;
 	    }
 	}
@@ -777,6 +777,30 @@ elif test "x$with_dell_backlight" = "x" 
 fi
 AM_CONDITIONAL(BUILD_DELL, test x$BUILD_DELL = xyes)
 
+dnl Dell RF KILL
+AC_ARG_WITH(dell-rfkill,        [  --with-dell-rfkill      Whether to build Dell RF-kill support (auto)])
+BUILD_DELL_RFKILL=no
+if test "x$with_dell_rfkill" = "xyes" ; then
+   BUILD_DELL=yes
+elif test "x$with_dell_rfkill" = "x" ; then
+  if test "$USE_SMBIOS" = "yes" ; then
+    case "${HALD_BACKEND}" in
+      linux)
+        case "${host}" in
+	  i[[3456]]86-*-*)
+            BUILD_DELL_RFKILL=yes
+	    ;;
+	  *)
+	    ;;
+	esac
+        ;;
+      *)
+        ;;
+    esac
+   fi
+fi
+AM_CONDITIONAL(BUILD_DELL_RFKILL, test x$BUILD_DELL_RFKILL = xyes)
+
 dnl Sony PIC support
 AC_ARG_ENABLE(sonypic,
 		AC_HELP_STRING([--enable-sonypic],[Build with Sony PIC support]),
@@ -913,7 +937,8 @@ echo "
         OMAP utils:                 ${BUILD_OMAP} (Linux only, arm only)
         CPU frequency scaling:      ${BUILD_CPUFREQ} (Linux only)
 	USB wireless mouse power:   ${BUILD_USBCSR} (Linux only, requires libusb)
-	Dell Backlight              ${BUILD_DELL} (Linux only, requires libsmbios >= 0.11.6)
+	Dell Backlight:             ${BUILD_DELL} (Linux only, requires libsmbios >= 0.13.4)
+	Dell RF Kill:               ${BUILD_DELL_RFKILL} (Linux only, requires libsmbios >= 0.13.4)
 
         Maintainer mode:            ${USE_MAINTAINER_MODE}
         Building verbose mode:      ${enable_verbose_mode}
diff --git a/fdi/policy/10osvendor/10-bluetooth-switch.fdi b/fdi/policy/10osvendor/10-bluetooth-switch.fdi
deleted file mode 100644
index bd3918e..0000000
--- a/fdi/policy/10osvendor/10-bluetooth-switch.fdi
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<deviceinfo version="0.2">
-
-  <device>
-    <match key="killswitch.type" string="bluetooth">
-      <append key="info.interfaces" type="strlist">org.freedesktop.Hal.Device.KillSwitch</append>
-
-      <append key="org.freedesktop.Hal.Device.KillSwitch.method_names" type="strlist">SetPower</append>
-      <append key="org.freedesktop.Hal.Device.KillSwitch.method_signatures" type="strlist">b</append>
-      <append key="org.freedesktop.Hal.Device.KillSwitch.method_argnames" type="strlist">power</append>
-      <append key="org.freedesktop.Hal.Device.KillSwitch.method_execpaths" type="strlist">hal-system-bluetooth-set-power</append>
-
-      <append key="org.freedesktop.Hal.Device.KillSwitch.method_names" type="strlist">GetPower</append>
-      <append key="org.freedesktop.Hal.Device.KillSwitch.method_signatures" type="strlist"></append>
-      <append key="org.freedesktop.Hal.Device.KillSwitch.method_argnames" type="strlist"></append>
-      <append key="org.freedesktop.Hal.Device.KillSwitch.method_execpaths" type="strlist">hal-system-bluetooth-get-power</append>
-    </match>
-  </device>
-
-</deviceinfo>
diff --git a/fdi/policy/10osvendor/Makefile.am b/fdi/policy/10osvendor/Makefile.am
index 7b84aef..98bbe92 100644
--- a/fdi/policy/10osvendor/Makefile.am
+++ b/fdi/policy/10osvendor/Makefile.am
@@ -5,7 +5,7 @@ dist_fdi_DATA = 			\
 	10-keyboard-policy.fdi		\
 	10-power-mgmt-policy.fdi	\
 	10-toshiba-buttons.fdi		\
-	10-bluetooth-switch.fdi		\
+	10-rfkill-switch.fdi		\
 	10-laptop-panel-mgmt-policy.fdi	\
 	15-storage-luks.fdi		\
 	20-storage-methods.fdi
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 492d2f8..2b96220 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -120,8 +120,8 @@ script_SCRIPTS =				\
 	hal-system-lcd-get-brightness		\
 	hal-system-lcd-set-brightness		\
 	hal-system-power-set-power-save		\
-	hal-system-bluetooth-get-power		\
-	hal-system-bluetooth-set-power
+	hal-system-killswitch-get-power		\
+	hal-system-killswitch-set-power
 
 EXTRA_DIST=$(man_MANS) $(MAN_IN_FILES) gen-libgphoto-hal-fdi $(script_SCRIPTS)
 
diff --git a/tools/hal-system-bluetooth-get-power b/tools/hal-system-bluetooth-get-power
deleted file mode 100644
index 4de48bd..0000000
--- a/tools/hal-system-bluetooth-get-power
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2007 Bastien Nocera <bnocera at redhat.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# Check for environment variables
-if [ -z "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" ]; then
-        echo "org.freedesktop.Hal.Device.UnknownError" >&2
-	echo "Missing or empty environment variable(s)." >&2
-	echo "This script should be started by hald." >&2
-	exit 1
-fi
-
-# TODO: check privilege
-
-if [ -n "$HALD_UNAME_S" -a -x ./$HALD_UNAME_S/hal-system-bluetooth-get-power-$HALD_UNAME_S ]; then
-    exec ./$HALD_UNAME_S/hal-system-bluetooth-get-power-$HALD_UNAME_S $@
-else
-    echo "org.freedesktop.Hal.Device.UnknownError" >&2
-    echo "No back-end for your operating system" >&2
-    exit 1
-fi
diff --git a/tools/hal-system-bluetooth-set-power b/tools/hal-system-bluetooth-set-power
deleted file mode 100644
index 7c80a26..0000000
--- a/tools/hal-system-bluetooth-set-power
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2007 Bastien Nocera <bnocera at redhat.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# Check for environment variables
-if [ -z "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" ] ; then
-        echo "org.freedesktop.Hal.Device.UnknownError" >&2
-        echo "Missing or empty environment variable(s)." >&2
-        echo "This script should be started by hald." >&2
-        exit 1
-fi
-
-# TODO: check privilege
-
-# read value for set bluetooth power
-read value
-export value
-
-if [ -n "$HALD_UNAME_S" -a -x ./$HALD_UNAME_S/hal-system-bluetooth-set-power-$HALD_UNAME_S ]; then
-    exec ./$HALD_UNAME_S/hal-system-bluetooth-set-power-$HALD_UNAME_S $@
-else
-    echo "org.freedesktop.Hal.Device.UnknownError" >&2
-    echo "No back-end for your operating system" >&2
-    exit 1
-fi
diff --git a/tools/hal-system-killswitch-get-power b/tools/hal-system-killswitch-get-power
new file mode 100755
index 0000000..67ba021
--- /dev/null
+++ b/tools/hal-system-killswitch-get-power
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+# Copyright (C) 2007 Bastien Nocera <bnocera at redhat.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+# Check for environment variables
+if [ -z "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" ]; then
+        echo "org.freedesktop.Hal.Device.UnknownError" >&2
+	echo "Missing or empty environment variable(s)." >&2
+	echo "This script should be started by hald." >&2
+	exit 1
+fi
+
+# TODO: check privilege
+
+if [ -n "$HALD_UNAME_S" -a -x ./$HALD_UNAME_S/hal-system-killswitch-get-power-$HALD_UNAME_S ]; then
+    exec ./$HALD_UNAME_S/hal-system-killswitch-get-power-$HALD_UNAME_S $@
+else
+    echo "org.freedesktop.Hal.Device.UnknownError" >&2
+    echo "No back-end for your operating system" >&2
+    exit 1
+fi
diff --git a/tools/hal-system-killswitch-set-power b/tools/hal-system-killswitch-set-power
new file mode 100755
index 0000000..4175c60
--- /dev/null
+++ b/tools/hal-system-killswitch-set-power
@@ -0,0 +1,30 @@
+#!/bin/sh
+#
+# Copyright (C) 2007 Bastien Nocera <bnocera at redhat.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+# Check for environment variables
+if [ -z "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" ] ; then
+        echo "org.freedesktop.Hal.Device.UnknownError" >&2
+        echo "Missing or empty environment variable(s)." >&2
+        echo "This script should be started by hald." >&2
+        exit 1
+fi
+
+# TODO: check privilege
+
+# read value for set bluetooth power
+read value
+export value
+
+if [ -n "$HALD_UNAME_S" -a -x ./$HALD_UNAME_S/hal-system-killswitch-set-power-$HALD_UNAME_S ]; then
+    exec ./$HALD_UNAME_S/hal-system-killswitch-set-power-$HALD_UNAME_S $@
+else
+    echo "org.freedesktop.Hal.Device.UnknownError" >&2
+    echo "No back-end for your operating system" >&2
+    exit 1
+fi
diff --git a/tools/linux/Makefile.am b/tools/linux/Makefile.am
index d3bd975..ea4e873 100644
--- a/tools/linux/Makefile.am
+++ b/tools/linux/Makefile.am
@@ -16,8 +16,8 @@ script_SCRIPTS =					\
 	hal-system-lcd-get-brightness-linux		\
 	hal-system-lcd-set-brightness-linux		\
 	hal-system-power-set-power-save-linux		\
-	hal-system-bluetooth-get-power-linux		\
-	hal-system-bluetooth-set-power-linux
+	hal-system-killswitch-get-power-linux		\
+	hal-system-killswitch-set-power-linux
 
 EXTRA_DIST = 90-hal.rules $(script_SCRIPTS)
 
diff --git a/tools/linux/hal-system-bluetooth-get-power-linux b/tools/linux/hal-system-bluetooth-get-power-linux
deleted file mode 100644
index 6dd8c77..0000000
--- a/tools/linux/hal-system-bluetooth-get-power-linux
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2007 Bastien Nocera <bnocera at redhat.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-if [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "sonypic" ]; then
-	value="`hal-system-sonypic getbluetooth`"
-	if [ $? -ne 0 ]; then
-		echo "org.freedesktop.Hal.Device.BluetoothButton.NotSupported" >&2
-		exit 1
-	fi
-	exit ${value}
-else
-	echo "org.freedesktop.Hal.Device.BluetoothButton.NotSupported" >&2
-	echo "Access type not supported" >&2
-	exit 1
-fi
-
diff --git a/tools/linux/hal-system-bluetooth-set-power-linux b/tools/linux/hal-system-bluetooth-set-power-linux
deleted file mode 100644
index f3c80ad..0000000
--- a/tools/linux/hal-system-bluetooth-set-power-linux
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2007 Bastien Nocera <bnocera at redhat.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-if [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "sonypic" ]; then
-	hal-system-sonypic setbluetooth $value
-	if [ $? -ne 0 ]; then
-		echo "org.freedesktop.Hal.Device.BluetoothButton.NotSupported" >&2
-		exit 1
-	fi
-	exit 0
-else
-	echo "org.freedesktop.Hal.Device.BluetoothButton.NotSupported" >&2
-	echo "Access type not supported" >&2
-	exit 1
-fi
-
diff --git a/tools/linux/hal-system-killswitch-get-power-linux b/tools/linux/hal-system-killswitch-get-power-linux
new file mode 100755
index 0000000..7249694
--- /dev/null
+++ b/tools/linux/hal-system-killswitch-get-power-linux
@@ -0,0 +1,59 @@
+#!/bin/sh
+#
+# Copyright (C) 2007 Bastien Nocera <bnocera at redhat.com>
+# Copyright (C) 2007 David Zeuthen <davidz at redhat.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+if [ "$HAL_PROP_KILLSWITCH_TYPE" = "bluetooth" ]; then
+    if [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "sonypic" ]; then
+	value="`hal-system-sonypic getbluetooth`"
+	if [ $? -ne 0 ]; then
+	    echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
+	    echo "hal-system-sonypic returned unexpected value" >&2
+	    exit 1
+	fi
+	exit ${value}
+    elif [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "dell" ]; then
+	# TODO: write our own binary that links with libsmbios?
+	dellWirelessCtl --st_bt
+	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
+elif [ "$HAL_PROP_KILLSWITCH_TYPE" = "wlan" ]; then
+    if [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "dell" ]; then
+	# TODO: write our own binary that links with libsmbios?
+	dellWirelessCtl --st_wlan
+	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
+    exit 1
+fi
diff --git a/tools/linux/hal-system-killswitch-set-power-linux b/tools/linux/hal-system-killswitch-set-power-linux
new file mode 100755
index 0000000..b207372
--- /dev/null
+++ b/tools/linux/hal-system-killswitch-set-power-linux
@@ -0,0 +1,61 @@
+#!/bin/sh
+#
+# Copyright (C) 2007 Bastien Nocera <bnocera at redhat.com>
+# Copyright (C) 2007 David Zeuthen <davidz at redhat.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+if [ "$HAL_PROP_KILLSWITCH_TYPE" = "bluetooth" ]; then
+    if [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "sonypic" ]; then
+	hal-system-sonypic setbluetooth $value
+	if [ $? -ne 0 ]; then
+	    echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
+	    exit 1
+	fi
+	exit 0
+    elif [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "dell" ]; then
+	# TODO: write our own binary that links with libsmbios?
+	if [ "$value" = "true" ]; then
+	    dellWirelessCtl --bt 1
+	    ret=$?
+	else
+	    dellWirelessCtl --bt 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
+elif [ "$HAL_PROP_KILLSWITCH_TYPE" = "wlan" ]; then
+    if [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "dell" ]; then
+	# TODO: write our own binary that links with libsmbios?
+	if [ "$value" = "true" ]; then
+	    dellWirelessCtl --wlan 1
+	    ret=$?
+	else
+	    dellWirelessCtl --wlan 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
+    exit 1
+fi
+


More information about the hal-commit mailing list