# HELP!  They're messing up my bluetooth :-(

## Moriah

After literally weeks of fiddling because there are no *AUTHORITATIVE* docs, I finally got my Microsoft bluetooth mouse to work "fairly" well with my Gentoo laptop.  Now the developers are fiddling with bluetooth again.  PLEASE do not release any software, especially bluetooth, with old outdated inacurate and incomplete documentation.  It is just as much a bug to have a program that no one can get to work because the docs are wrong as it is to release a program that just plain doesn't work!

Now the developers are changing the way bluetooth works, and at least one poster:

https://forums.gentoo.org/viewtopic-t-830747-highlight-bluez.html

Has pointed out that the docs are still a peice of fecal matter.  DON'T DO IT !!!

Until someone other than just the developer can a configure bluetooth device solely by reading the docs, its not ready for prime time.  I normally do not gripe about free stuff, but the bluetooth support documentation is about the worst thing I have ever had to deal with in the Linux world.

If there is an up to date comprehensive and comprehensible set of docs on bluez-4, then fine, but apparently as of June 3, 2010, it was still as bad as it was last February when I originally configured my bluetooth mouse.

I at least now have something I can live with, even if it is not great.  I do not want to break the mouse for the laptop I depend upon to earn my living just because someone "improved" the code without improving the documentation.

It ain't ready for prime time until there is a correct man page to go with it, and the Gentoo powers that be should keep it masked as experimental until such docs are available and have been tested for a suitable length of time.

----------

## eccerr0r

Yes, <rant>

I second this... bluetooth is really buggy.

The 3.x series documentation simply does not apply to the 4.x bluez.

I think there's two Gnome bluetooth managers, gnome-bluetooth and blueman.  I think I have both installed but blueman seems to work better.  Blueman is also masked, where gnome-bluetooth seems not.   Pairing is the biggest problem as well as being able to actually see devices in the pairing tools.

Curious what other people used?

I'm not sure how/if there's documentation on how to pair devices via command line anymore with the 4.x series.  I struggled through *finally* getting bluez-4 rfcomm/GPRS working with my phone...  I was wondering why I got it working on my 3.x system faster (at least get rfcomm working) but my 3.x system is a server (my portable/laptops that actually could use wireless net are 4.x -- the reason why 3.x was easier to get working is because most documentation out there is for 3.x).  Surprisingly Networkmanager was less of a problem than getting /dev/rfcomm0 to actually work.

I feel everyone's pain on getting bluetooth working, and even worse, this is not Gentoo specific. My Ubuntu install seemed to work even more poorly than Gentoo.

</rant>

----------

## cwr

A few months back I tried to get gnome-bluetooth to work, and the general

impression seemed to be that it didn't, so I cleared it out and switched to

blueman.  Blueman seems to more-or-less work, but I've only used it for

pairing with a laptop, not for the mouse/keyboard/phone stuff it's meant for.

I understand that the architecture of the Bluetooth stack is pretty much

a nightmare, so getting it working smoothly may well take some time. 

Still, user-level documentation would certainly be a nice idea.

Will

----------

## SamuliSuominen

Yes, documentation for bluetooth is obsolete in Gentoo now[1]. It's all for bluez 2.x and bluez 3.x which doesn't apply anymore to bluez 4.x.

[1] https://bugs.gentoo.org/show_bug.cgi?id=286826

There's really not much to say except: Patches are accepted. This is open source, everyone is free to contribute!  :Smile: 

----------

## Voltago

Problem here is partly that there's not really any meaningful documentation upstream at bluez.org either...

----------

## SamuliSuominen

 *Voltago wrote:*   

> Problem here is partly that there's not really any meaningful documentation upstream at bluez.org either...

 

yep  :Sad: 

----------

## AllenJB

So write some!

----------

## eccerr0r

Main problem being, I don't feel like I understand how pairing works now (or actually, ever).  There's some interface that doesn't seem to make sense, plus the fact some things that should work...don't.

The only way I finally got pairing working is to use net-wireless/blueman as well, which doesn't necessarily help KDE users and doesn't explain why gnome-bluetooth doesn't work... plus the fact that it's ~x86.

----------

## Moriah

In order to write meaningful documentation, one must first know how it works.  The problem is that no one seems to know how it works but the developers, and they are having far too much fun writing code to be bothered writing documentation.  Without any docs, how can anyone else understand it well enough to write docs to teach it to another?

Yes <sigh>, I know: "Use the source, Luke, use the source."    :Confused: 

But it just seems like a shame to have to reverse engineer a component of Linux as though it were a chunk of malware that slipped past your firewall and antivirus...    :Evil or Very Mad: 

----------

## Moriah

So given that my *OLD* bluetooth setup "kind of" works with my mouse, and I don't want to break it, how do I tell portage and emerge *NOT* to try to install the new one, and *NOT* to bellyache about the old one?    :Twisted Evil: 

I have stopped in the middle of a "routine" update because of this bluetooth issue.  I would like to finish updating my system without messing up my bluetooth mouse.    :Smile: 

----------

## Scorpion265

Sorry to bring up an old thread...

Moriah, we have the same mouse, the microsoft bluetooth 5000 or whatever it is. I couldn't get it working either! I ended up installing blueman, searched for it, and was able to pair with it. After that I had to right click and add it to the input service. I've had no problems after that. I hope this helps!

----------

## eccerr0r

Is the best known method now to use blueman in gnome with BlueZ-4?

Maybe should move blueman from ~x86 to stable if enough people are having success with it?

----------

## Moriah

Not everybody uses gnome.  I certainly do not.  A bluetooth mouse should work with GPM at the boot console.  You should not need anything in the way of a graphical environment at all.  If a wired mouse works there, then so should a bluetooth mouse.  A bluetooth mouse is a replacement for a wired mouse, not just a gnome toy.  

Blueman is not a complete solution.  :Evil or Very Mad: 

----------

## eccerr0r

Unfortunately it seems to be the only thing that works with pairing in BlueZ-4.6...

I have yet to see any other piece of software properly pair for BlueZ-4.  Something just doesn't seem right, here...

----------

## dmpogo

I paired my phone by hand once with bluez-4.something, and it is still getting paired automatically since.

On the other note, since bluez is D-BUS based, I found very useful dev-util/d-feet  while debugging bluez setup. You can see which variables have been successfully set, which were not, which interfaces bluez think are available, etc.

----------

## Moriah

It would seem to me that if blueman works, then we ought to be able to look at *HOW* it works and figure out how to manually do the same thing.  After all, doesn't the configuration consist of writing to configuration files?  What does it write to what files?  Answer that, and you know how to configure bluetooth manually.    :Idea: 

----------

## dmpogo

 *Moriah wrote:*   

> It would seem to me that if blueman works, then we ought to be able to look at *HOW* it works and figure out how to manually do the same thing.  After all, doesn't the configuration consist of writing to configuration files?  What does it write to what files?  Answer that, and you know how to configure bluetooth manually.   

 

Not exactly it seems,  bluez makes some discoveries and stores variables in D-BUS and so does, probably, blueman.

----------

## eccerr0r

Appears some people were successful hand-pairing devices in BlueZ-4, could that be shared to the community?  :Very Happy: 

I was looking in some directory and found some files that seemed to be related to pairing but couldn't figure out the file format or the "key" it used, it's most certainly not the PIN but some hash, probably of the selected PIN and the bdaddr... but past that I have no clue...

This too and the fact all my bluetooth adaptors for computers have nonunique addresses... which makes me wary of auto-pairing too. *sigh*

Need to get some unique bdaddr devices...

----------

## dmpogo

 *eccerr0r wrote:*   

> Appears some people were successful hand-pairing devices in BlueZ-4, could that be shared to the community? 
> 
> I was looking in some directory and found some files that seemed to be related to pairing but couldn't figure out the file format or the "key" it used, it's most certainly not the PIN but some hash, probably of the selected PIN and the bdaddr... but past that I have no clue...
> 
> This too and the fact all my bluetooth adaptors for computers have nonunique addresses... which makes me wary of auto-pairing too. *sigh*
> ...

 

Does command-line procedure in http://en.gentoo-wiki.com/wiki/Bluetooth_mouse  work for you ?

----------

## eccerr0r

Ahh...that might do the trick...will need to try it when I get the chance.

Probably will have to upgrade the bluez-3 on my server to bluez-4 soon as it's been deprecated...

Thanks!

----------

## Uli Sing

 *dmpogo wrote:*   

> Does command-line procedure in http://en.gentoo-wiki.com/wiki/Bluetooth_mouse  work for you ?

 

At least it works for me (Keysonic ACK-340BT). Thank you!

What's not working is the bluetooth init script using baselayout-2.

Did I make any mistake or is it a case for this?

Attaching an usb keyboard to start /etc/init.d/bluetooth kills my inner joy.  :Sad: 

---Edit---

Upgrade to net-wireless/bluez-4.69 is working now.

I'm happy.  :Very Happy: 

----------

## mapr

I cannot help it, but bluetooth with linux is a mess.

I am running Bluez 4.99

http://en.gentoo-wiki.com/wiki/Bluetooth_mouse worked for my mouse - no problem so far. After that I spend hours (many) to get my keyboard Keysonic ACK-595BT to work the same way - to no avail.

The pin gets exchanged but then it gets stuck:

 ... simple-agent hci0 00:18:00:00:D0:88

RequestPinCode (/org/bluez/1644/hci0/dev_00_18_00_00_D0_88)

Enter PIN Code: 123456

Release exit: False <- this is my debug printf

Creating device failed: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

and the connection keeps pending:

< HCI Command: Authentication Requested (0x01|0x0011) plen 2

    handle 41

< ACL data: handle 41 flags 0x00 dlen 10

> HCI Event: Command Status (0x0f) plen 4

    Authentication Requested (0x01|0x0011) status 0x00 ncmd 1

> HCI Event: Number of Completed Packets (0x13) plen 5

    handle 41 packets 1

> HCI Event: Link Key Request (0x17) plen 6

    bdaddr 00:18:00:00:D0:88

< HCI Command: Link Key Request Reply (0x01|0x000b) plen 22

    bdaddr 00:18:00:00:D0:88 key 3F57B91B007ABEA1A12A849F3A164B4C

> HCI Event: Command Complete (0x0e) plen 10

    Link Key Request Reply (0x01|0x000b) ncmd 1

    status 0x00 bdaddr 00:18:00:00:D0:88

> ACL data: handle 41 flags 0x02 dlen 16

      Extended feature mask 0x0007

        Flow control mode

        Retransmission mode

        Bi-directional QoS

< ACL data: handle 41 flags 0x00 dlen 12

> HCI Event: Number of Completed Packets (0x13) plen 5

    handle 41 packets 1

> HCI Event: Auth Complete (0x06) plen 3

    status 0x00 handle 41

> ACL data: handle 41 flags 0x02 dlen 16

      Connection pending - Authorization pending

> ACL data: handle 41 flags 0x02 dlen 16

      Connection successful

< ACL data: handle 41 flags 0x00 dlen 12

This is what /var/log/messages says:

dbus[1631]: [system] Rejected send message, 1 matched rules; type="method_return", sender=":1.31" (uid=0 pid=3009 comm="/usr/bin/python2 /usr/bin/simple-agent hci0 00:18:") interface="(unset)" member="(unset)" error name="(unset)" requested_reply="0" destination=":1.0" (uid=0 pid=1644 comm="/usr/sbin/bluetoothd --udev ")

My policies at /etc/dbus-1/system.d/bluetooth.conf are:

  <policy user="root">

    <allow own="org.bluez"/>

    <allow send_destination="org.bluez"/>

    <allow send_interface="org.bluez.Agent"/>

    <allow send_interface="org.bluez.HandsfreeAgent"/>

    <allow send_interface="org.bluez.MediaEndpoint"/>

    <allow send_interface="org.bluez.MediaPlayer"/>

    <allow send_interface="org.bluez.Watcher"/>

    <allow send_interface="org.bluez.ThermometerWatcher"/>

    <allow send_type="method_call"/>

    <allow send_type="method_return"/>

  </policy>

I am fiddling around with the allowance for the send_types, but it always runs into the rejected message type as can be seen in the syslog.

I assume it has to do with the unset interface (see syslog), since I have (not surprisingly) no rule for this interface

interface="(unset)" member="(unset)" error name="(unset)"

May be this is something for the bluez list?

Thanks in advance

Mario

----------

