[Debian-eeepc-devel] [SCM] Maintenance of eeepc-acpi-scripts debian package branch, master, updated. db56a3bc8a47819398ae7ae768722932aa9aea75
Damyan Ivanov
dmn at debian.org
Sun Aug 31 09:53:46 UTC 2008
The following commit has been merged in the master branch:
commit db56a3bc8a47819398ae7ae768722932aa9aea75
Author: Damyan Ivanov <dmn at debian.org>
Date: Sun Aug 31 12:50:08 2008 +0300
support toggling of Bluetooth
tested on model 901, uses soft-button #4
diff --git a/actions/hotkey.sh b/actions/hotkey.sh
index 5dba0ba..24c3737 100755
--- a/actions/hotkey.sh
+++ b/actions/hotkey.sh
@@ -47,6 +47,14 @@ show_volume() {
notify Volume $percent
}
+show_bluetooth() {
+ if bluetooth_is_on; then
+ notify Bluetooth On
+ else
+ notify Bluetooth Off
+ fi
+}
+
#show_brightness() {
# # final digit of ACPI code is brightness level in hex
# level=0x${code:${#code}-1}
@@ -95,4 +103,9 @@ case $code in
0000002?)
# actual brightness change is handled in hardware
;;
+ 0000001d)
+ # soft-buton 4 -- toggle bluetooth
+ toggle_bluetooth
+ show_bluetooth
+ ;;
esac
diff --git a/debian/changelog b/debian/changelog
index 220b600..679c050 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+eeepc-acpi-scripts (1.0.6) UNRELEASED; urgency=low
+
+ * hotkey.sh, functions.sh: support toggling of Bluetooth on model 901 via
+ soft-button #4
+
+ -- Damyan Ivanov <dmn at debian.org> Sun, 31 Aug 2008 12:50:22 +0300
+
eeepc-acpi-scripts (1.0.5) unstable; urgency=low
[ Nico Golde ]
diff --git a/functions.sh b/functions.sh
index 34915c0..08d89bd 100644
--- a/functions.sh
+++ b/functions.sh
@@ -33,3 +33,38 @@ detect_x_display()
export DISPLAY=:0
fi
}
+
+BT_CTL=/sys/devices/platform/eeepc/bluetooth
+# check if bluetooth is switched on and return success (exit code 0 if it is
+# return failure (exit code 1) if it is not
+#
+# uses the acpi platform driver interface if that is available
+# if not, uses hcitool to see if there is a hci0 device
+bluetooth_is_on()
+{
+ if [ -e $BT_CTL ]; then
+ [ $( cat $BT_CTL ) = "1" ]
+ else
+ hcitool dev | grep -q hci0
+ fi
+}
+
+toggle_bluetooth()
+{
+ if bluetooth_is_on; then
+ if [ -e $BT_CTL ]; then
+ echo 0 > $BT_CTL
+ # udev should unload the module now
+ else
+ hciconfig hci0 down
+ rmmod hci_usb
+ fi
+ else
+ if [ -e $BT_CTL ]; then
+ echo 1 > $BT_CTL
+ # udev should load the module now
+ else
+ modprobe hci_usb
+ fi
+ fi
+}
--
Maintenance of eeepc-acpi-scripts debian package
More information about the Debian-eeepc-devel
mailing list