[Debian-eeepc-devel] [SCM] Maintenance of eeepc-acpi-scripts debian package branch, master, updated. 6742528e5492fed9adff8cb50935b08123ee9405
Damyan Ivanov
dmn at debian.org
Sun Sep 7 11:25:56 UTC 2008
The following commit has been merged in the master branch:
commit ef5e24a4cc8bfba695943f62a492360274f267e9
Author: Damyan Ivanov <dmn at debian.org>
Date: Sun Sep 7 12:47:42 2008 +0300
move bluetooth support from functions.sh to etc/acpi/lib/bluetooth.sh
conffiles are better for keeping user customizations
diff --git a/actions/hotkey.sh b/actions/hotkey.sh
index 71bcb3c..db77541 100755
--- a/actions/hotkey.sh
+++ b/actions/hotkey.sh
@@ -85,6 +85,7 @@ show_bluetooth() {
}
handle_bluetooth_toggle() {
+ . /etc/acpi/lib/bluetooth.sh
if [ -e $BT_CTL ] || [ "$BLUETOOTH_FALLBACK_TO_HCITOOL" = "yes" ]; then
toggle_bluetooth
show_bluetooth
diff --git a/functions.sh b/functions.sh
index ba666f9..d7915e2 100644
--- a/functions.sh
+++ b/functions.sh
@@ -36,49 +36,6 @@ detect_x_display()
fi
}
-BT_CTL=/sys/devices/platform/eeepc/bluetooth
-[ -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
-#
-# 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
- if [ "$BLUETOOTH_FALLBACK_TO_HCITOOL" = "yes" ]; then
- hcitool dev | grep -q hci0
- else
- false
- fi
- fi
-}
-
-toggle_bluetooth()
-{
- if bluetooth_is_on; then
- if [ -e $BT_CTL ]; then
- echo 0 > $BT_CTL
- # udev should unload the module now
- elif [ "$BLUETOOTH_FALLBACK_TO_HCITOOL" = "yes" ]; then
- hciconfig hci0 down
- rmmod hci_usb
- # TODO: enable autosuspend of the USB device
- # that is, echo "auto" > /sys/bus/usb/devices/$DEV/power/level
- # the problem is determining what the right $DEV is
- fi
- else
- if [ -e $BT_CTL ]; then
- echo 1 > $BT_CTL
- # udev should load the module now
- elif [ "$BLUETOOTH_FALLBACK_TO_HCITOOL" = "yes" ]; then
- modprobe hci_usb
- fi
- fi
-}
-
CAM_CTL=/sys/devices/platform/eeepc/camera
[ -e $CAM_CTL ] || CAM_CTL=/proc/acpi/asus/camera #pre-2.6.26
# check if camera is enabled and return success (exit code 0 if it is
diff --git a/lib/bluetooth.sh b/lib/bluetooth.sh
new file mode 100755
index 0000000..c1eb790
--- /dev/null
+++ b/lib/bluetooth.sh
@@ -0,0 +1,46 @@
+# a shell library for handling Bluetooth on Asus EeePC
+#
+# to be sourced
+
+BT_CTL=/sys/devices/platform/eeepc/bluetooth
+[ -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
+#
+# 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
+ if [ "$BLUETOOTH_FALLBACK_TO_HCITOOL" = "yes" ]; then
+ hcitool dev | grep -q hci0
+ else
+ false
+ fi
+ fi
+}
+
+toggle_bluetooth()
+{
+ if bluetooth_is_on; then
+ if [ -e $BT_CTL ]; then
+ echo 0 > $BT_CTL
+ # udev should unload the module now
+ elif [ "$BLUETOOTH_FALLBACK_TO_HCITOOL" = "yes" ]; then
+ hciconfig hci0 down
+ rmmod hci_usb
+ # TODO: enable autosuspend of the USB device
+ # that is, echo "auto" > /sys/bus/usb/devices/$DEV/power/level
+ # the problem is determining what the right $DEV is
+ fi
+ else
+ if [ -e $BT_CTL ]; then
+ echo 1 > $BT_CTL
+ # udev should load the module now
+ elif [ "$BLUETOOTH_FALLBACK_TO_HCITOOL" = "yes" ]; then
+ modprobe hci_usb
+ fi
+ fi
+}
--
Maintenance of eeepc-acpi-scripts debian package
More information about the Debian-eeepc-devel
mailing list