thinkpad wifi hotkey toggles bluetooth and wifi at the same time

Bug #24680 reported by Matthew East
34
Affects Status Importance Assigned to Milestone
acpi-support (Ubuntu)
Fix Released
Medium
Paul Sladen

Bug Description

The Thinkpad wiki hotkey (Fn F5) should toggle either just bluetooth, or
bluetooth and wireless individually (both off -> one on -> other on -> both on
-> both off etc). However it toggles them both collectively, which is pretty
irritating, and makes it difficult to save power by turning off the unwanted one.

https://wiki.ubuntu.com/LaptopTestingTeam/ThinkpadT43-1871: https://wiki.ubuntu.com/LaptopTestingTeam/ThinkpadT43-1871

Revision history for this message
Matthew East (mdke) wrote :

confirming because Adam sees this too.

Revision history for this message
Loic Pefferkorn (loic) wrote :
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)

Revision history for this message
Paul Sladen (sladen) wrote :

I can confirm this, but I'm not sure what to do about it. There's one button marked on the keyboard and two-meanings.

I'd be tempted to leave the hotkey doing both (bluetooth follows wifi status) and then have a menu item somewhere else (eg. g-p-m) that can disable them independently. (Attach it to something else rather than adding another set of menu entries).

Revision history for this message
Matthew East (mdke) wrote :

Windows toggles them individually, in my opinion this is clearly the most desirable behaviour.

Revision history for this message
Paul Sladen (sladen) wrote :

According to my notes at:

  https://wiki.ubuntu.com/LaptopTestingTeam/ThinkpadR52

it pops up a dialogue in the middle of the screen. This is doable but then means you need to have a GUI running.

I think the current solution is good enough for the Dapper release but we might want to think about it more in future (what if you have 1 wifi and two bluetooth devices plugged in...).

Revision history for this message
Adam Conrad (adconrad) wrote :

In Windows, you only get the GUI popup if you have the appropriate OSD app installed. Even without it, however, Fn+F5 toggles in a rotation:

Both on
Wireless on, bluetooth off
Bluetooth on, wireless off
Both off

At least, that's how it works in my Windows installation (no GUI, just silent changes).

I may have the order of the two intermediate steps backwards (in the middle of too many things to reboot and test), but that's the basic idea.

Revision history for this message
Paul Sladen (sladen) wrote : Re: [Bug 24680] thinkpad wifi hotkey toggles bluetooth and wifi at the same time

> Both on; Wireless on, bluetooth off; Bluetooth on, wireless off; Both off

In that case, IMHO, we should do that. Probably best to file a bug that
says that is what the behaviour positively should be

The only complication is that it requires state saving (or it might not, if
the state of both wireless and bluetooth can be acquired. The Bluetooth
state can be got easily but for the wireless it calls out and depends on
another script.

 -Paul
--
Britain is just cold, in a pesky way. Nottingham, GB

Revision history for this message
Matthew East (mdke) wrote :

<quote>Probably best to file a bug that says that is what the behaviour positively should be</quote>

That is exactly what _this_ bug report says, or am I missing something?

Changed in acpi-support:
status: Unconfirmed → Confirmed
Revision history for this message
Florian Boucault (fboucault) wrote :

Is anybody working on it ?

Revision history for this message
David Eriksson (meldavid) wrote :

How is this?

Revision history for this message
Paul Sladen (sladen) wrote :

Looks good, we're in Beta freeze at this moment though. btw, we're trying to make all scripts POSIX compliant so that they use dash as '/bin/sh' instead of 'bash'.

Revision history for this message
Paul Sladen (sladen) wrote :

BTW, is the 4-way rotation sequence the same as in MS Windows?

Revision history for this message
David Eriksson (meldavid) wrote :

The rotation is both off -> wireless on -> bluetooth on -> both on. I tried Windows and they changed it to both off -> both on only as far as I could see. I still think the 4-way rotation is better.

Revision history for this message
Florian Boucault (fboucault) wrote :

How can we get this nice work included in Feisty ?

Revision history for this message
Adi Roiban (adiroiban) wrote :

This is my ibm-wireless.sh script.

Revision history for this message
Adi Roiban (adiroiban) wrote :

This is how the zenity dialog looks

Revision history for this message
Martey Dodoo (martey) wrote :

Adi, your uploaded script has a bug so disabling *only* the bluetooth device does not work. It is simple to fix, though.

Paul Sladen (sladen)
Changed in acpi-support:
assignee: mjg59 → sladen
status: Confirmed → In Progress
Revision history for this message
Adi Roiban (adiroiban) wrote :

I have fix logic of the script. I had wrote it like a prototype without testing it.

Now it uses /sys/class/net/eth1/device/rf_kill instead of power/state.

I think there will be a problem (permission probleme) with display the zenity windows run as root in the user display.
We must run the script as root but the zenity dialog as the curent user.
There is still the problem of intergrating this script with the acpi scripts

Revision history for this message
Paul Sladen (sladen) wrote :

acpi-support (0.93) feisty; urgency=low

  * Change 'wireless.sh' to use 'device/rf_kill' for wireless devices (if
    available) in preference to 'device/power/state' which was been
    removed by the upstream kernel developers.
    (Closes: LP #42820)
  * Teach 'lib/state-funcs:isAnyWirelessPoweredOn()' to also check
    'device/rf_kill' if it's available.
    (Closes: LP #42820)
  * Change 'ibm-wireless.sh' to rotate wireless and bluetooth states
    through the sequence: both, bluetooth only, wireless only, neither.
    (Closes: LP #24680)
  * Correct inverted logic in 'isAnyWirelessPoweredOn()'.
    (Closes: LP #66083)
  * Change script shebangs to use '/bin/sh' instead of '/bin/bash'.

 -- Paul Sladen <email address hidden> Wed, 21 Mar 2007 04:55:27 +0000

Changed in acpi-support:
status: In Progress → Fix Released
Revision history for this message
roofone (roofone) wrote :

I've implemented the Zenity script and it works well...if I run it as root or restart acpid using sudo. If I don't, Zenity is unable to open the dialog.

Things i've tried that haven't worked:
I tried starting acpid as me rather than root, and I've tried xhost +local:root.

Any ideas?

Revision history for this message
Adi Roiban (adiroiban) wrote :

In this case I think we should use dbus.
I don't see other options.

In this case the zenity + dbus-send + dbus-recv script will run in user mode, and we should have a dbus daemon solving request.

There is a big drawback here due to the fact that we should have a daemon running, of we will need to invoke a program.

Revision history for this message
roofone (roofone) wrote :

I've resorted to restarting acpid in my .bashrc. It works for me, but is probably not the best solution.

Revision history for this message
Jerone Young (jerone) wrote :

This issue has returned in Ubuntu Hardy builds (where it was fixed in Gutsy). If you press the Bluetooth key it turns on bluetooth and kills wifi! It's pretty bad.

Revision history for this message
David Jaša (dejv) wrote :

I noticed this regression on Hardy too, so I'm reopening the bug.

Changed in acpi-support:
status: Fix Released → Confirmed
Revision history for this message
Adi Roiban (adiroiban) wrote :

Yes. This is a regression in Hardy.

On my z60m pressing Fn+F5 only changes the bluetooth state.

Revision history for this message
Jerone Young (jerone) wrote :

I have a lauchpad bug open with a fix for this for Hardy. It has been ignored up to this point:

https://bugs.launchpad.net/ubuntu/+source/acpi-support/+bug/183682

Revision history for this message
P (p92) wrote :

see bug #108897 for a fix on gutsy

Revision history for this message
P (p92) wrote :

it seems to work again for me on hardy beta with a thinkpad X40

Revision history for this message
Daniel Hahler (blueyed) wrote :

Pascal, which version of acpi-support are you using?
I'm asking, because the referenced fix in bug 183682 has been reverted and bug 108897 has not been fixed, too.

Revision history for this message
P (p92) wrote :

$ dpkg -l acpi-support
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-f/Unpacked/Failed-cfg/Half-inst/t-aWait/T-pend
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Nom Version Description
+++-==================-==================-====================================================
ii acpi-support 0.108 a collection of useful events for acpi

Revision history for this message
David Jaša (dejv) wrote :

This works for me on TP T40, if it also works for other subscribers I suggest to close bug in Hardy.

Revision history for this message
Jerone Young (jerone) wrote :

Acpi-support in Intrepid now only toggle bluetooth.

Changed in acpi-support:
status: Confirmed → Fix Released
Revision history for this message
ccc1 (cllccl-deactivatedaccount) wrote :

can confirm that and it doesn't save the state. on startup bluetooth is always enabled.

Revision history for this message
ccc1 (cllccl-deactivatedaccount) wrote :

i don't mind that it only toggles bluetooth since i can use the switch on my thinkpad to disable
bluetooth + wifi. but it's annyoing that the bluetooth status isn't saved. see bug:

https://bugs.launchpad.net/ubuntu/+bug/280811

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.