5 .
/etc
/conf.d
/acpi-eeepc-generic.conf
6 .
/etc
/acpi
/eeepc
/acpi-eeepc-generic-functions.sh
8 eeepc_notify
"Bluetooth toggle not implemented yet!!!" stop
11 EEEPC_RADIO_SAVED_STATE_FILE
=$EEEPC_VAR/bluetooth-saved
13 if [ -e $EEEPC_RADIO_SAVED_STATE_FILE ]; then
14 RADIO_SAVED_STATE
=$
(cat $EEEPC_RADIO_SAVED_STATE_FILE)
19 # Find the right rfkill switch, but default to the second one
22 [ -e /sys
/class
/rfkill
] && lsrfkill
=`/bin/ls /sys/class/rfkill/`
23 for r
in $lsrfkill; do
25 name
=`cat /sys/class/rfkill/$r/name`
26 [ "$name" == "eeepc-bluetooth" ] && rfkill
=$r
29 # Get rfkill switch state (0 = card off, 1 = card on)
30 RADIO_CONTROL
="/sys/class/rfkill/${rfkill}/state"
32 [ -e "$RADIO_CONTROL" ] && RADIO_STATE
=$
(cat $RADIO_CONTROL)
34 [ ! -d "$EEEPC_VAR" ] && mkdir
-p $EEEPC_VAR 2>/dev
/null
36 # Get bluetooth interface
39 logger
"acpi-eeepc-generic-bluetooth-toggle.sh: Current state: $RADIO_STATE ($RADIO_CONTROL)"
42 eeepc_notify
"Turning Bluetooth Radio on..." gnome-dev-wavelan
44 # Execute pre-up commands just once
45 [ $1 -eq 1 ] && execute_commands
"${COMMANDS_Bluetooth_PRE_UP[@]}"
48 [ -e "$RADIO_CONTROL" ] && echo 1 > $RADIO_CONTROL
51 ( /sbin
/modprobe
$BLUETOOTH_DRIVER 2>/dev
/null
&& (
52 # If successful, enable card
53 echo 1 > $EEEPC_RADIO_SAVED_STATE_FILE
54 # Execute post-up commands
55 execute_commands
"${COMMANDS_Bluetooth_POST_UP[@]}"
57 eeepc_notify
"Bluetooth Radio is now on" gnome-dev-wavelan
59 eeepc_notify
"Could not enable Bluetooth radio" stop
60 # If module loading unsuccessful, try again
61 if [ $1 -lt $WIFI_TOGGLE_MAX_TRY ]; then
62 eeepc_notify
"Trying again in 2 second ($(($1+1)) / $WIFI_TOGGLE_MAX_TRY)" gnome-dev-wavelan
70 eeepc_notify
"Turning Bluetooth Radio off..." gnome-dev-wavelan
72 # Execute pre-down commands just once
73 [ $1 -eq 1 ] && execute_commands
"${COMMANDS_BLUETOOTH_PRE_DOWN[@]}"
75 # Put interface down and wait 1 second
76 #/sbin/ifconfig $Bluetooth_IF down 2>/dev/null
80 ( /sbin
/modprobe
-r $BLUETOOTH_DRIVER 2>/dev
/null
&& (
81 # If successful, disable card through rkfill and save the state
82 [ -e "$RADIO_CONTROL" ] && echo 0 > $RADIO_CONTROL
83 echo 0 > $EEEPC_RADIO_SAVED_STATE_FILE
85 # Execute post-down commands
86 execute_commands
"${COMMANDS_BLUETOOTH_POST_DOWN[@]}"
88 eeepc_notify
"Bluetooth Radio is now off" gnome-dev-wavelan
90 # If module unloading unsuccessful, try again
91 eeepc_notify
"Could not disable Bluetooth radio" stop
92 if [ $1 -lt $WIFI_TOGGLE_MAX_TRY ]; then
93 eeepc_notify
"Trying again in 2 second ($(($1+1)) / $WIFI_TOGGLE_MAX_TRY)" gnome-dev-wavelan
100 function radio_toggle
{
101 if [ "$RADIO_STATE" = "1" ]; then
108 function radio_restore
{
109 if [ "$RADIO_SAVED_STATE" = "1" ]; then