Page 1 of 1

toggling bluetooth on/off - t42 ubuntu

Posted: Sat Jun 04, 2005 11:22 pm
by rossman
Fn-F5 turns off the wireless antenna but the bluetooth antenna stays on. Anybody know how to toggle bluetooth antenna in ubuntu?

Thanks,
Ross
T42 (2373-3UU)

Posted: Sun Jun 05, 2005 2:10 pm
by Volker
You are confused, by default Fn-F5 toggles Bluetooth but not wlan.

If you want to customize this behaviour, install ibm-acpi. This lets you disable any default action. Then you can hook acpid in to receive the Fn-F5 keypress. Turning wlan/Bluetooth on/off is just a matter of loading/unloading the relevant drivers.

Posted: Sun Jun 05, 2005 6:01 pm
by rossman
I double checked - after pressing Fn-F5 the wireless light goes out and I lose connection to my AP but the bluetooth light stays on and my BT mouse continues to function.

I followed this howto.

However, I do not get on screen display when I press the function keys.

I'm a linux n00b, how do I load/unload the bluetooth driver?

Thanks,
ross

Posted: Mon Jun 06, 2005 10:02 am
by Volker
Strange that your Fn-F5 behaves differently.

The easiest way to enable/disable bluetooth is then http://ibm-acpi.sourceforge.net/. Install, load modules, and

Code: Select all

echo disable > /proc/acpi/ibm/bluetooth
echo enable > /proc/acpi/ibm/bluetooth

Posted: Tue Jun 07, 2005 6:15 am
by rossman
That works. Thanks for the info Volker.

Another oddity, while booting, pressing Fn-F5 does like you say, disable bluetooth but once I'm logged in it disables wireless. I guess my setup is changing it from default. I don't think I did this because I have no idea how to change the settings!

Posted: Tue Jun 07, 2005 6:19 am
by egibbs
Thanks for the link. I have a T42p with both Wifi and BT, and although I don't reguarly use either I've been wondering how to get BT working.

I added the Debian repos to /etc/apt/sources.list and was able to DL and install ibm-acpi through Synaptics in Ubuntu. I am not able to use the commands you listed directly, I get Permission Denied even if running as root - maybe because I have tpb running as well. However Fn+F5 now reliably turns the BT radio (and LED) on and off.

Of course the drawback is that Fn+F5 no longer works to turn the Wifi on and off. I CAN control the Wifi by running /etc/acpi/wireless.sh, which is what tpb is supposed to call when it detects an Fn+F5 press, but that's a pain.

I'm thinking about hacking together the wireless.sh and bluetooth.sh scripts to combine both sets of functions - so Fn+F5 will turn both BT and Wifi on and off together. But I'm thinking there has to be a more elegant solution.

Any ideas?

Posted: Tue Jun 07, 2005 11:24 am
by rossman
How about enabling Fn-F6 to turn wireless on/off? In my case I'd like it to turn BT on/off. Anybody know how to do this?

Posted: Tue Jun 07, 2005 12:04 pm
by egibbs
I did try (simplistically) editing the wireless event handler script to change the part of the key scan code that read 0105 to 0106 but nothing happened. Not sure if I needed to restart gnome or x-org or something, of if Fn+F6 is simply not a mapped key.

I think the Fn keys work different from normal scan codes - they are actually generated by the keyboard controller rather than by direct scan. And since Fn+F6 is not assigned to any event in the standard TP setup, the controller may not output a code for it ever.

I suppose I could try one of the keys that are mapped - like Fn+F7, but I pretty much want all of the existing functions.

Anybody know for sure if Fn+F6 should generate a detectable event?

Ed Gibbs

Posted: Wed Jun 08, 2005 11:36 am
by Volker
I don't think that Fn-F6 can generate any detectable event. ibm-acpi lets you change the behaviour of the following keys:

Code: Select all

	key	bit	behavior when set	behavior when unset

	Fn-F3			always generates ACPI event
	Fn-F4			always generates ACPI event
	Fn-F5	0010	generate ACPI event	enable/disable Bluetooth
	Fn-F7	0040	generate ACPI event	switch LCD and external display
	Fn-F8	0080	generate ACPI event	expand screen or none
	Fn-F9	0100	generate ACPI event	none
	Fn-F12			always generates ACPI event

Posted: Sat Jul 09, 2005 8:24 am
by AndreasMeier
Volker wrote:I don't think that Fn-F6 can generate any detectable event. ibm-acpi lets you change the behaviour of the following keys:

Code: Select all

	key	bit	behavior when set	behavior when unset

	Fn-F3			always generates ACPI event
	Fn-F4			always generates ACPI event
	Fn-F5	0010	generate ACPI event	enable/disable Bluetooth
	Fn-F7	0040	generate ACPI event	switch LCD and external display
	Fn-F8	0080	generate ACPI event	expand screen or none
	Fn-F9	0100	generate ACPI event	none
	Fn-F12			always generates ACPI event
Where can I change that ?

Regards
Andreas

Posted: Sat Jul 09, 2005 11:29 am
by Volker

Code: Select all

echo 0x0000 > /proc/acpi/ibm/hotkey
and replace 0x0000 with the bitmask of your choice. For details, see ibm-acpi's README.

Posted: Sun Jul 10, 2005 4:49 pm
by AndreasMeier
Thanks Volker,
I give it a try.

@rossman,
what about your Fn-F6 key ? Is it a mappable key or not ?
I think that would be a nice idea to have WLAN on Fn-F5 and bluetooth on Fn-F6, but xev is not giving me a keycode after pressing this comibination.

Regards
Andreas

Posted: Fri Jul 15, 2005 8:16 am
by AndreasMeier
Has anyone of you here found a reliable way of getting bluetooth activated by pressing (any) Fn-Key other than Fn-F5 ?

In my Kubuntu Hoary, Fn-F5 is toogling WLAN.
Now I'm trying to enable bluetooth.
I tried echo enable > /proc/acpi/ibm/bluetooth, status is then ena bled, but bluetooth manager says that now adapter is found.
Also the bluetooth-LED is not lighted.

So, to be honest, I'm looking for more things:
1.) Activate Bluetooth with Fn-F9 (which is not yet assigned by other ACPI events).
2.) Get WLAN-LED working if enabled
3.) Get Bluetooth-LED working if enabled

I have a T42 with WLAN and Bluetooth.

Perhaps you have some hints for me.
Thanks in advance,
Regards
Andreas

Posted: Fri Jul 15, 2005 2:09 pm
by AndreasMeier
So, I have Bluetooth working including the LED :-)
After a restart, the adapter was found and the LED was working.

I think (or hope) that the WLAN-LED is coming up, when my WLAN connection is properly configured and working.

So, basically only question 1 is still left, if I can somehow reconfigure Fn-F6 or Fn-F9 for toggling Bluetooth on/off.

Regards,
Andreas

Posted: Sat Jul 16, 2005 4:22 am
by AndreasMeier
No, I have another question.

I can (manually) enable my bluetooth adapter with "echo enable > /proc/acpi/ibm/bluetooth".
Before I do that, the kdebluetoothd says, that there is no adapter found.
After I enable bluetooth, kdebluetoothd stays with this status.
Also after I restart the bluetooth services with "sudo /etc/init.d/bluez-utils restart", the status wont change.

But when I do a reboot, at next startup, the adapter was found and can be used.

Is it possible to initialize the adapter without a reboot ?

Regards
Andreas

Posted: Mon Jul 18, 2005 3:14 pm
by jkraemer
I set up my T42 so I can toggle Bluetooth using Fn-F6.

Have a look in the ACPI section of my little Ubuntu/T42 howto:

http://www.jkraemer.net/knowhow/t42_ubuntu.html

Edit: actually I used the acpi-support package, ibm-acpi isn't installed here. Seems to me it isn't really needed, as the other function keys work fine, too.

Greetings,
Jens