Toggling the Bluetooth Radio - ThinkPad

Here you'll find a place for solutions and hints.

Please use one of the support subforums below for questions or if you have any issues and need support.

Toggling the Bluetooth Radio - ThinkPad

Postby David_Batson » Dec 15th, '12, 18:51

I have been using the following method to toggle the Bluetooth Radio on and off with the hotkey combo Fn+F9.
Likely this could be adapted to use other hotkeys.

rfkill needs to be installed.

To find acpi events, run acpi_listen in Konsole, then press a hotkey such as ThinkVantage or hotkey combo such as Fn+F9. Some potential hotkey(s) will not show acpi events as they are already used by the system.

For using Fn+F9 I created the file /etc/acpi/events/bluetoothconf as root.
Code: Select all
event=ibm/hotkey HKEY 00000080 00001009
action=/etc/acpi/actions/bluetooth.sh


I created the file /etc/acpi/actions/bluetooth.sh as root and made it executable.
Code: Select all
#!/bin/sh

BT_RFKILL=$(rfkill list | grep tpacpi_bluetooth_sw | sed 's/\([0-9]\+\):.*/\1/')
BT_STATE=$(/usr/bin/rfkill list $BT_RFKILL | grep "Soft blocked: yes")

if [ "x" == "x$BT_STATE" ]; then
   /usr/bin/rfkill block $BT_RFKILL
else
   /usr/bin/rfkill unblock $BT_RFKILL
fi

exit 0


Lastly I ran the following command in Konsole as root:
Code: Select all
etc/init.d/acpid restart


Now I use Fn+F9 to toggle the Bluetooth Radio off and on.
David_Batson
 
Posts: 128
Joined: May 1st, '11, 05:19

Return to The magician suggests...

Who is online

Users browsing this forum: No registered users and 1 guest

cron