[ltp] Bluetooth hotkey problem with T41

Marius Gedminas linux-thinkpad@linux-thinkpad.org
Sat, 11 Aug 2007 00:06:57 +0300


--BXVAT5kNtrzKuDFl
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Aug 10, 2007 at 11:46:50PM +0300, Mlundgre wrote:
> Marius Gedminas wrote:
> >
> > I like to keep my Bluetooth off, and Wifi on.  As a consequence I don't
> > want a single hot key to toggle both, so I mapped Fn-F6 to toggling
> > bluetooth via a shell script in /etc/acpi and an event file in
> > /etc/acpi/events/.  I'd paste the config here, but I don't have it on
> > this laptop yet.
>=20
> This approach sounds good, so I'll be waiting your configs... =3DD

This is on Ubuntu systems, if you have a different distro, your mileage
may vary.

1. Create a file /etc/acpi/events/ibmbluetooth with the following
content:

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

    event=3Dibm/hotkey HKEY 00000080 00001006
    action=3D/etc/acpi/bluetooth.sh

2. Create a file /etc/acpi/bluetooth.sh with the following content, and mak=
e it
executable with chmod +x:

    #!/bin/bash
    # Enable/disable builtin Bluetooth on IBM Thinkpads

    if grep -q enabled /proc/acpi/ibm/bluetooth; then
        echo disable > /proc/acpi/ibm/bluetooth
    else
        echo enable > /proc/acpi/ibm/bluetooth
    fi

3. Make sure ibm-acpi does not mask Fn-F6 presses by editing
/etc/modprobe.d/ibm_acpi.modprobe and changing the hotkey mask so it
looks like this:

    options ibm_acpi hotkey=3Denable,0xffbf experimental=3D1

Ubuntu Gutsy has /etc/modprobe.d/thinkpad_acpi.modprobe instead.  Also,
Gutsy doesn't load it by default; I had to add 'thinkpad_acpi' to
/etc/modules.

4. Reboot.  Now Fn-F6 should toggle Bluetooth.

I just tested this on my new T61, and it works, with one caveat: the
Bluetooth LED stays off for some reason.

> Matthias Himber wrote:
> >
> >That's a subtlety of the shell: output redirection is not affected by
> >prepending "sudo". Either create a shellscript contining those commands =
and
> >call it with sudo, or use tee:
> >  echo enable | sudo tee /proc/acpi/ibm/bluetooth
> >  echo disable | sudo tee /proc/acpi/ibm/bluetooth
>=20
> These ones seems to be working quite nice, but working hotkey would be a
> little bit easier in a every day use. Is there any ways to analyse this
> problem, e.g. checking some logs or something like that?

The log to check is /var/log/acpid.  You should see something like this:

[Sat Aug 11 00:05:00 2007] received event "ibm/hotkey HKEY 00000080 0000100=
6"
[Sat Aug 11 00:05:00 2007] notifying client 6605[0:0]
[Sat Aug 11 00:05:00 2007] executing action "/etc/acpi/bluetooth.sh"
[Sat Aug 11 00:05:00 2007] BEGIN HANDLER MESSAGES
[Sat Aug 11 00:05:00 2007] END HANDLER MESSAGES
[Sat Aug 11 00:05:00 2007] action exited with status 0
[Sat Aug 11 00:05:00 2007] completed event "ibm/hotkey HKEY 00000080 000010=
06"

HTH,
Marius Gedminas
--=20
"Wipe Info uses hexadecimal values to wipe files. This provides more securi=
ty
than wiping with decimal values."
        -- Norton SystemWorks 2002 Manual

--BXVAT5kNtrzKuDFl
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFGvNNwkVdEXeem148RAqbPAJsF763qU/Nn52o1ItAY2S+t7/QyNwCeJqWM
/xB5rgbhgaxPf1leZlSHRtU=
=b5qJ
-----END PGP SIGNATURE-----

--BXVAT5kNtrzKuDFl--