responsibility for enabling/disabling bluetooth?

Bastien Nocera hadess at
Thu Jan 3 03:08:54 PST 2008

On Mon, 2007-12-31 at 17:04 -0600, Ben Liblit wrote:
> HAL running on my ThinkPad X61 correctly detects when the special 
> wireless networking key (Fn+F5) has been pressed, and broadcasts this on 
> the system D-BUS:
> 	platform_i8042_i8042_KBD_port_logicaldev_input condition
> 	  ButtonPressed = forward
> 	signal sender=:1.5 -> dest=(null destination)
> 	  path=/org/freedesktop/Hal/devices/computer;
> 	  interface=org.freedesktop.Hal.Device;
> 	  member=Condition
> 	    string "ButtonPressed"
> 	    string "wifi-power"

That key doesn't seem to say "disable bluetooth" but "disable wifi
power", which means that policy should be implemented in user-space for
it (making it a bit complicated to handle in just the one place).

> Great!  But after that ... nothing interesting happens.  Traditionally 
> this key has been used to enable/disable Bluetooth.  If I want that to 
> happen now, how should I hook that up?  I already know how to write a 
> small Python script that reacts to HAL ButtonPressed signals.  But this 
> script would need to run as root, since normal uses cannot write to 
> /proc/acpi/ibm/bluetooth.
> I'm loath to create new scripts running as root.  Is that really the 
> right approach here?  Or is there some other system component that 
> already ought to be listening for this signal but is either buggy or not 
> running?

There's already a killswitch mechanism in HAL, which will correctly
enable/disable Bluetooth on Dell and Sony (sonypi-supported) laptops.

You'd need to implement the same thing for IBM laptops, which would be a
matter of a couple of lines of fdi file and shell scripting.

There's a bug opened on the HAL bugzilla about that, but I don't have
access to it right now...

> (By the way, if I do enable/disable Bluetooth by writing to 
> /proc/acpi/ibm/bluetooth, everything else works perfectly.  The bluez 
> GNOME Bluetooth applet appears/disappears correctly, for example. 
> Hooray!  Go HAL!)

The bluetooth-applet from bluez-gnome doesn't actually use HAL to detect
the presence absence of Bluetooth devices, it uses hcid which uses the
kernel directly :)

After you've implemented the Bluetooth killswitch for the IBM laptops,
we can discuss implementing policy for that button on your laptop. Dell
and Sony laptops have the same problem of only one button to control
Bluetooth and Wifi power (and also EVDO/HSDPA modems as well), so the
best place for the policy would probably be NetworkManager).


More information about the hal mailing list