## Tuesday, November 5, 2013

### Bluetooth headphones on Arch: a new twist in the saga

As of a few days ago the official blueman build for Arch switched from depending on bluez4 to bluez (which is to say, bluez5). If you missed my previous post, I already had gotten my bluetooth headphones working pretty well with bluez4, ALSA and blueman. This new update broke my setup, and sent me on my way to new adventures in bluezland(TM).

I haven't gotten much to work yet. I'm sorry. But as I get things working I'll update this post. This is what I've done:

Tue Nov 5 11:51:07 CST 2013
I updated my system and everything was "broken". I sent a few bug reports, posted a few things on Arch forums, the usual. There are a few problems, and I'll describe them as best I can. First off, bluez5 dropped ALSA support, so I had to install pulseaudio-git from the AUR, since the official repo version of pulseaudio does not yet have bluez5 support. Then there's the issue that blueman-manager and blueman-applet won't work anymore, they just error out with a dbus error that seems to indicate (to my limited knowledge) that they were not properly updated to the new bluez5 API. So I turned to knowledge gleaned from recent edits of the Arch Wiki and tried to use the new command like tool that comes with bluez5, bluetoothctl. At first, this looks awesome. It has its own little shell, color output and everything. The main problem is that it doesn't really work. I can't use it to pair my headphones, and I can't use it to connect to them. The errors a terse, to say the least. So I looked for another alternative and tried using gnome-bluetooth, which is what most people use, I think. The problem with gnome-bluetooth is that, unless you're running gnome, it doesn't come with a system tray applet anymore, so there is no way to connect to your device. This is what I ended up doing: 1. install gnome-bluetooth; 2. run bluetoothctl and remove your device from the list, if it is there; 4. install and run pulseaudio; 3. run bluetooth-wizard and pair with your device, it will also autoconnect and it should now work (test with running speaker-test). The one issue I ran into is turning the headphones off and back on. They will not automatically reconnect they way they did under blueman. Instead, it seems to work to go into bluetoothctl and manually connect (see image).
The other problem is a lack of control over the bitpool rate (maybe there's a way, but I don't know it yet) so every once in a while the sound gets chopped up and dropped.

Mon Nov 18 13:26:28 CST 2013
I managed to figure out how to only use bluetoothctl for pairing and connecting, so that I don't have to rely on gnome-bluetooth any longer. The trick was to turn the agent on before trying to pair. Note that tab completion works inside bluetoothctl, so all these calls are pretty easy to make.
# bluetoothctl
[bluetooth]# power on
Changing power on succeeded
[bluetooth]# agent on
Agent registered
[bluetooth]# scan on
Discovery started
[CHG] Controller 00:13:46:4D:6A:C6 Discovering: yes
[NEW] Device 00:1D:BA:29:50:D3 DR-BT50
[bluetooth]# pair 00:1D:BA:29:50:D3
Attempting to pair with 00:1D:BA:29:50:D3
[CHG] Device 00:1D:BA:29:50:D3 Connected: yes
[CHG] Device 00:1D:BA:29:50:D3 Paired: yes
Pairing successful
[CHG] Device 00:1D:BA:29:50:D3 Connected: no
[bluetooth]# connect 00:1D:BA:29:50:D3
Attempting to connect to 00:1D:BA:29:50:D3
[CHG] Device 00:1D:BA:29:50:D3 Connected: yes
Connection successful
[bluetooth]# scan off
Discovery stopped
[CHG] Controller 00:13:46:4D:6A:C6 Discovering: no
[bluetooth]# exit

1. Thank you for these two bluetooth posts -- I've been struggling with it for the last few weeks and managed to hack together my own way of using bluetooth (mostly through bluetoothctl) that's been unsastisfactory. I've learned quite a bit from your experience!

2. Yeah, the whole bluetooth in linux could use with a little bit of extra documentation. I'm glad this helped you. My method seems to have broken already, I am not entirely sure why, a recent kernel update might have been the cause...

1. Silly me, the new version of bluez defaults to turning the power to the controller off at startup. All I had to do was run power on in bluetoothctl

3. Any idea how to type in the pin code using bluetoothctl?

[bluetooth]# agent on
Agent registered
[bluetooth]# default-agent
Default agent request successful
[bluetooth]# pair 00:00:00:00:00:00
Attempting to pair with 00:00:00:00:00:00
[agent] PIN code: 123456
... timeout ...
Failed to pair: org.bluez.Error.AuthenticationFailed

1. Figured this out. The agent in this case expected me to type in 123456 on the bluetooth keyboard (which is actually a barcode scanner emulating a keyboard device).

Found the manual for the bluetooth scanner, and followed the instructions to set a default pin (10010) on the scanner. bluetoothctl recognized this and provided me a prompt to type that default pin. Device paired successfully and works great.

2. Awesome! Don't you just love it when things work out?

4. This comment has been removed by a blog administrator.

5. all information related to bluetooth headset for us. it is very nice blog. i got that this is best and full satisfied with author.

6. Hey mate ! I just saw your web-site and all I can say is that is really nice.

Lots of beneficial tips on it. I additionally see that you don't rank very good in Google.
blog network. This specific service can take your website
higher in the search engines - http://alturl.com/7mz9z -.
If you need any assistance with this plugin send me an Email.

Review my blog Yahoo

7. These are the great blogs; I assure you that I really enjoyed a lot in readingwireless tv headphones

Spy Bluetooth earpiece dealers

9. I've been searching for a way to automate connecting devices using bluetoothctl, as well, and have come up empty, so I tried throwing together a quick bash script which works pretty well:

if [ ! "$(pgrep -f bluetooth)" ] ; then sudo systemctl start bluetooth fi echo 'power on' | bluetoothctl pulseaudio -k sleep 1 pulseaudio --start sleep 1 echo 'connect${DEV}' | bluetoothctl
sleep 5
echo 'info \${DEV}' | bluetoothctl

It does create some errors, but my headset connect every time.

10. Well, that was ugly... Maybe a pastebin link will be better: http://pastebin.com/FLBkyyFd

11. And for some reason that stopped working after a reboot. This one seems to have fixed it. http://pastebin.com/nc8uzR2R

Might take some trial and error.

12. Bluetooth Headset may seem unenchanting, however its study is a necessity for anyone wishing to intellectually advance beyond their childhood. Cited by many as the single most important influence on post modern micro eco compartmentalize, Bluetooth Headset is featuring more and more in the ideals of the young and upwardly mobile. Inevitably feelings run deep amongst the easily lead, who are yet to grow accustomed to its discombobulating nature. Keeping all of this in mind, in this essay I will examine the major issues.

13. These blogs are quite incredible that have provided the best knowledge. The ContinuedInnovation

14. nice blogs.
Home Remedies
Dial *500*195# for receiving information on Home Remedies at a monthly subscription of Rs 30
Charges
Rs. 30/30days.

15. Online shopping for Primed4U at Amazon.com you can get here different mobile accessories. we sale buy iphone cases, buy iphone accessories, mobile accessories, cell phone accessories, wireless headphones and bluetooth headphones.

16. Hey, Your post is very informative and helpful for us. In fact i am looking this type of article from some days. Thanks a lot to share this informative article.
You can also see this MicFlip: World's First Reversible Micro USB Cable .

Thanks

17. This comment has been removed by the author.

18. bluetooth has been taken over by storm in the market.The technology of Bluetooth is cheap for companies to implement, which results in lower costs for the company. These savings are then passed (or should be) from the company on to you.