bluez and hci's which initially come up as hid (was Re: Some days it just doesn't pay to update)

Hans de Goede hdegoede at redhat.com
Fri Sep 2 07:18:31 UTC 2011


<please keep the CC list intact, not all are subscribed to fedora-test>

<resend with the fedora-devel list added to the to list, something
  which I intended to do from the start sorry for the double mail>

Hi Jonathan, Adam, et all,

Wed Aug 31 Jonathan Corbet wrote:

> So, I thought...LWN writing is almost done for the day, why not do an
> update and see what happens?
>
> What happened:
>
>  - My Logitech bluetooth keyboard, which has Just Worked for years,
>    doesn't work anymore.  Grub still sees it fine, but the running system
>    does not.  Sometimes unplugging and replugging the USB receiver makes
>    it come back.  Usually not.

That would be caused by a bluez update I pushed, this is actually something
I knew which would happen (and once you know what is going on the fix is
simple), but I didn't think it would be a big deal since AFAIK we've had
this issue for years already, so I'm really really surprised about the
"has Just Worked for years" bit.

I started looking into this when I upgraded my Dell laptop to F-16 alpha
and my bluetooth mouse stopped working. It turns out that there are some
bluetooth adapters (technically speaking hci-s), which for compatibility
reasons do not initially identify themselves in their usb descriptors as
a bluetooth hci, but instead as 2 hid devices (a keyboard and a mouse).

I know of 2 vendors shipping with these Dell has them in almost all their
bluetooth enabled laptops, and logitech uses them for the bluetooth dongle
shipped with their bluetooth wireless desktop (keyb + mouse) sets.

The idea behind these adapters is that they come pre-programmed to
automatically pair with the mouse and/or keyboard they ship with, and
will pass through events from these through to 2 emulated HID devices,
as if the keyb + mouse are regular USB models, so that they will also
work in for example the BIOS and the bootloader.

Logitech actually ships them like this, no idea why Dell has chosen
this adapter model, since AFAIK they never use this feature (as they
typically don't ship their laptops with a bluetooth keyboard and/or
mouse).

So Linux has this tool called hid2hci, to turn the bluetooth HCI into
an actual HCI. This has been shipping with udev for a while up to the
udev in F-15, the udev in F-16 no longer has this, causing my dell
bluetooth to stay in HID emulation mode and thus not work.

The reason F-16 udev no longer has it, is because udev + bluez
upstream have decided to move it to bluez. And to avoid conflicts
when using an older udev with a new bluez, bluez needs to be
passed --enable-hid2hci when running ./configure to actually get it.
So F-16 alpha was shipping without hid2hci (and the matching udev
rules) where as F-15 was shipping with hid2hci.

After tracking this down I talked to Bastien (the bluez maintainer)
and did a new build of bluez with --enable-hid2hci. Note that to
me this was restoring the default F-15 behavior, so I went ahead
with this despite knowing that for some people it causes problems,
something which I accidentally found out while searching bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=635244

Which is in essence the problem you are seeing here Jonathan, after
my bluez update, your bluetooth dongle is actually being out into
HCI mode, so that it can for example also be used to sync with your
phone, use a bluetooth headset, etc. IOW this is a feature not a bug
but this does mean that in order to use your bluetooth mouse /
keyboard, you need to explicitly pair them with the bluetooth HCI once,
which will require the use of a regular usb keyboard, which is, erm,
not so good, one could even argue this is a bug after all.

This also brings us back to my: "I'm really really surprised about the
"has Just Worked for years" bit", since we've been shipping hid2hci
+ udev rules for years (and this issue has been reported by others long
before).

The questions is how do we want to handle this? At least we should
release note this I guess, but perhaps we can do something smarter?

Under Windows Logitech has its own bluetooth stack, which I guess
not only does the hid2hci thing, but also auto-pairs with the keyboard
+ mouse, hopefully by reading some data from the bluetooth dongle, or
maybe it just autopairs with any logitech keyb + mouse?

Regards,

Hans


More information about the devel mailing list