Comment 3 for bug 24680

Revision history for this message
Tomas Frydrych (tf-o-hand) wrote :

On the tp the BT and Wifi are a single device and the Fn+F5 simply turns the device on/off. It is possible to toggle the BT only by something like

#!/bin/sh
#/etc/acpi/bluetooth.sh

. /etc/acpi/osd

cat /proc/acpi/ibm/bluetooth|grep status|grep -q enabled
if [ $? == 0 ]; then
  echo disabled > /proc/acpi/ibm/bluetooth;
  osd_print 'Bluetooth off'
else
  echo enabled > /proc/acpi/ibm/bluetooth;
  osd_print 'Bluetooth on'
fi

/etc/acpi/osd generates tpb-like onscreen msg, and contains the following:

#!/bin/bash
# /etc/acpi/osd
# written by J Kraemer, output and location modified by EM
# output closely matches default output of tpb on-screen display

osd_print() {
  xuser=`cat /tmp/X_user_for_osd`
  su - $xuser -c "echo $1 | DISPLAY=:0.0 osd_cat -d 3 -p bottom -A left -O 1 -s 2 -S black -i 25 -o -21 -c blue &"
}

You can then bind the bluetooth.sh script to a Fn+F* key with an /etc/acpi/events/ibm-bluetooth file like this:

# /etc/acpi/events/ibmbluetooth
# This is called when the user presses Fn-F8 button and calls
# /etc/acpi/bluetooth.sh for further processing.

event=ibm/hotkey HKEY 00000080 00001008
action=/etc/acpi/bluetooth.sh

You could presumably improve the script tied to the F5 button to circle through the available combinations, but it is not a very practical system (you might not want to loose your bluetooth connection, even temporarily, when needing to turn wifi on/off).

Helpful documentation is found here:

http://thinkwiki.org/wiki/How_to_get_special_keys_to_work

(NB: not all the Fn+F* keys work on all the thinkpads; for example on t41p Fn+F6 does not generate any events at all)