# Bluetooth Nightmare - No Info, Outdated Wiki

## Holysword

Its been now at least 8 years since I tried to get anything bluetooth related to work on a Linux machine, and yet once again it crumbled apart and failed. I got this awesome bluetooth headset; I opened the box and turned on my android cellphone, who recognized immediately, paired and boom, started playing songs. After 2h on my laptop, I still haven't figured this out!! I am trying to use bluedevil. The device is detected sometimes; when it does, I try to pair, without any success. No error message, no feedback, it just doesn't connect. The headset speaks something when someone is trying to pair, but I couldn't hear a thing. In some few rare occasions, I managed to get the device to connect, which lasts for one second or less. It then just disconnects without an error again.

I tried to use commandline applications, but the information on Gentoo wiki (http://wiki.gentoo.org/wiki/Bluetooth) is outdated (or at least I couldn't find the packages with those utilities). Also, bluez does not have the test-programs option anymore.

Could anyone point me out to an uptodate guide and/or alternatives to bluedevil that possibly work out of the box? Thanks in advance!

----------

## Holysword

Just tried to follow ArchWiki's guide (https://wiki.archlinux.org/index.php/bluetooth) and this time at least I got some commandline output:

```
◢ jarvis ◣ ~ $  bluetoothctl 

[NEW] Controller 68:17:29:62:66:04 %h-BlueZ [default]

[NEW] Device B4:67:E9:F2:55:8B S11-FLEX HD

[bluetooth]# power on

Changing power on succeeded

[bluetooth]# devices

Device B4:67:E9:F2:55:8B S11-FLEX HD

[bluetooth]# agent on

Agent registered

[bluetooth]# pair B4:67:E9:F2:55:8B

Attempting to pair with B4:67:E9:F2:55:8B

Failed to pair: org.bluez.Error.AlreadyExists

[CHG] Device B4:67:E9:F2:55:8B Connected: yes

[CHG] Device B4:67:E9:F2:55:8B Connected: no

[CHG] Device B4:67:E9:F2:55:8B Connected: yes

[CHG] Device B4:67:E9:F2:55:8B Connected: no

[CHG] Device B4:67:E9:F2:55:8B Connected: yes

[CHG] Device B4:67:E9:F2:55:8B Connected: no

[CHG] Device B4:67:E9:F2:55:8B Connected: yes

[CHG] Device B4:67:E9:F2:55:8B Connected: no

[bluetooth]# 

```

It keeps changing from "connected:yes" to "no" randomly, even after I restart the bluetooth daemon and/or turn on/off the device itself. Any ideas?

----------

## Holysword

Seriously guys... the Gentoo Wiki on Bluetooth is massively outdated. Installing Bluez doesn't give me half of the commands that are used there and I can't find where are these commands. Am I forced to use an overlay to try bluetooth on Gentoo?

----------

## Logicien

According to your bluetoothctl output, you need to execute

```
pairable on

default-agent
```

before to try to pair. The device B4:67:E9:F2:55:8B is already pair

```
Failed to pair: org.bluez.Error.AlreadyExists
```

Check with

```
paired-devices
```

If you want to pair it again, do

```
remove B4:67:E9:F2:55:8B
```

and then do

```
pair B4:67:E9:F2:55:8B
```

Sometimes use the remote device to pair have better result. The bluetoothctl agent prompt you accept the pincode use by the remote device. The help command of bluetoothctl give you minimal information.

----------

## 666threesixes666

moral of the story, mask bluez 5 & emerge blueman.  never trust a wiki ive not worked on.

----------

## Holysword

 *Logicien wrote:*   

> According to your bluetoothctl output, you need to execute
> 
> ```
> pairable on
> 
> ...

 

Well, that's after using hciconfig hci0 up, right?

But then

```

[bluetooth]# pairable on

No default controller available

[bluetooth]# default-agent

No agent is registered

[bluetooth]# 

```

 *666threesixes666 wrote:*   

> moral of the story, mask bluez 5 & emerge blueman.  never trust a wiki ive not worked on.

 

And can you kindly point me out to a working wiki using blueman?

----------

## Holysword

 *Holysword wrote:*   

> Well, that's after using hciconfig hci0 up, right?
> 
> But then
> 
> ```
> ...

 

Sorry, now I managed to get it to the previous state. This is what I get:

```
[bluetooth]# pair B4:67:E9:F2:55:8B

Device B4:67:E9:F2:55:8B not available

[NEW] Device B4:67:E9:F2:55:8B S11-FLEX HD

[CHG] Device B4:67:E9:F2:55:8B Connected: no

[DEL] Device B4:67:E9:F2:55:8B S11-FLEX HD

[NEW] Device B4:67:E9:F2:55:8B S11-FLEX HD

[CHG] Device B4:67:E9:F2:55:8B Connected: no

[DEL] Device B4:67:E9:F2:55:8B S11-FLEX HD

[NEW] Device B4:67:E9:F2:55:8B S11-FLEX HD

[CHG] Device B4:67:E9:F2:55:8B Connected: no

[DEL] Device B4:67:E9:F2:55:8B S11-FLEX HD

[bluetooth]# discoverable yes

Changing discoverable on succeeded

[NEW] Device B4:67:E9:F2:55:8B S11-FLEX HD

[bluetooth]# connect B4:67:E9:F2:55:8B

Attempting to connect to B4:67:E9:F2:55:8B

[CHG] Device B4:67:E9:F2:55:8B UUIDs has unsupported type

Failed to connect: org.bluez.Error.Failed

[CHG] Device B4:67:E9:F2:55:8B Connected: no

[bluetooth]# pair B4:67:E9:F2:55:8B

Attempting to pair with B4:67:E9:F2:55:8B

[CHG] Device B4:67:E9:F2:55:8B Connected: yes

Pairing successful

[CHG] Device B4:67:E9:F2:55:8B Connected: no

[bluetooth]# connect B4:67:E9:F2:55:8B

Attempting to connect to B4:67:E9:F2:55:8B

Failed to connect: org.bluez.Error.Failed

[bluetooth]# pair B4:67:E9:F2:55:8B

Attempting to pair with B4:67:E9:F2:55:8B

Failed to pair: org.bluez.Error.AlreadyExists

[bluetooth]# pair B4:67:E9:F2:55:8B

[bluetooth]# pair

Missing device address argument

[bluetooth]# paired-devices

[bluetooth]# pair B4:67:E9:F2:55:8B

Attempting to pair with B4:67:E9:F2:55:8B

Failed to pair: org.bluez.Error.AlreadyExists

[bluetooth]# 

```

----------

## Holysword

I have heard from someone in bluez IRC channel that headsets are only supposed to work with pulseaudio, and that bluez-5 does not support ALSA.

Now, excuse me the direct approach here: why would you support ONLY something which is BROKEN for years? I have tried (sincerely) to get pulseaudio to work on several machines, without the slightest success. Either my mic doesn't work, or the audio skips, or some specific applications (something running under wine, for instance) does not work, or the CPU consumption is just absurd, or pulseaudio decides that its a good idea to downsample everything to the worst samplerate possible and I can't seem to find a way to tell it to stop being so intrusive. I wouldn't be so strongly against pulseaudio if it had any noticeable feature, but the main selling point of pulseaudio is "it works out of the box", which it DOESN'T - therefore, it is as of now a failure of a project! ALSA works out of the box, completely, and I have ever had to mess with alsa.conf if I have multiple boards or something like that.

But okay, just to be fair, I decided to try again pulseaudio, perhaps I was being unfair. I wasn't. Skype fails to use pulseaudio both for input or output, it redirects my playback as input (monitor, I guess?) in several applications, audacious is smarter and works alright, but after a few minutes the speakers start making a noise which does not seem to be associated with audacious whatsoever and only killing pulseaudio solves the problem. But... perhaps the headset works now? 

Absolutely not. It pairs but does not connect (returns a generic error without any information) and pavucontrol does not show anything there. There is no sign of an option to redirect audio to the headset, and neither bluetoothctl nor pulseaudio tell anything about it.

So no, I will exorcise this thing from my machine again, hopefully for the last time. Any chance to get this thing working without pulseaudio? I considered downgrading it to bluez-4, but then it gives me several conflicts.

----------

## Logicien

Bluez 5 may not support Alsa, but Pulseaudio support Alsa and Bluetooth. So here, Pulseaudio is some kind of middleware between Bluez 5 and Alsa, thank's to the fact that Alsa can support Pulseaudio.

My headsets have been working with Bluez 4, the only drawback was that the data transfert between the Linux source Debian/Gentoo and the headsets slow sometimes. Now I use a non bluetooth wireless headsets. It's more stable. Both have to sink with the computer source.

What I did, was to change the /etc/pulse/default.pa file to make Pulseaudio detect a wireless link between my bluetooth device and the headsets. Than I was able to use the bluetooth headsets using Pulseaudio. My source here is a search on the Internet.

For that to work, obviously, the bluetooth device of Gentoo and the headsets must be paired, first and before or after. You may have to try both pairing times to make it work.

With Bluez 4, I was able to use audio bluetooth without Pulsaudio, with only Alsa. With Bluez 5, it seem's to not be possible. Pulseaudio is the main and maybe the only interface with the Bluez 5 audio stack at least, for the moment.

----------

## Logicien

I succeed to pair and use my Bluetooth headsets with Bluez 5 and bluetoothctl. Pulseaudio do not need any specific configuration to detect the headsets and make it available as an output device. If Alsa and multimedia programs are set to use Pulseaudio, it work, but I have to set the headsets as the output device with pavucontrol.

I have some feelings that the speed of the music is moving up and down slowly randomly. Is it the quality of the material and/or the bluetooth stack, this is a question I have to make clear.

----------

## Holysword

 *Logicien wrote:*   

> I succeed to pair and use my Bluetooth headsets with Bluez 5 and bluetoothctl. Pulseaudio do not need any specific configuration to detect the headsets and make it available as an output device. If Alsa and multimedia programs are set to use Pulseaudio, it work, but I have to set the headsets as the output device with pavucontrol.
> 
> I have some feelings that the speed of the music is moving up and down slowly randomly. Is it the quality of the material and/or the bluetooth stack, this is a question I have to make clear.

 

I have never managed to have success with Pulseaudio in any aspect. I installed recently and it simply didn't work. I am not even working with a fancy configuration at this point, this is just a regular installation with an onboard audio card, only one onboard card!!!. I'd rather buy a bluetooth transmitter to plug to the output of my laptop than trying Pulseaudio again - I have learned the lesson already. But thanks for your suggestion.

----------

