Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Use headsets with Bluez 5 mini HowTo
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1555
Location: Montréal

PostPosted: Wed Apr 30, 2014 12:19 pm    Post subject: Use headsets with Bluez 5 mini HowTo Reply with quote

I play presently with Bluetooth headsets and Bluez 5. It work. However, I see at least one confusing situation that must be tell. I will do all the process to use them step by step.

I put that line in the general section of the /etc/bluetooth/audio.conf file to modify the Bluetooth service configuration
Code:
[General]
Enable=Control,Gateway,Headset,Media,Sink,Socket,Source

Some enabled services of the line and the line itself may not be mandatory, but it work with. So, after this change the Bluetooth service must be start or restart.
Code:
rc-service bluetooth start

For the communication with Dbus, a normal user must be in the plugdev or lp group. See /etc/dbus-1/system.d/bluetooth.conf. Than, as a normal user, I open Bluetoothctl and execute all those commands
Code:
$ bluetoothctl

[bluetooth]# power on
[bluetooth]# pairable on
[bluetooth]# discoverable on
[bluetooth]# agent on
[bluetooth]# default-agent
[bluetooth]# scan on

At this point, I put my headsets in discoverable mode and they are detected fast by Bluetoothctl. I can see them with the devices command. Then I am ready to pair the host and remote headsets devices.
Code:
[bluetooth]# devices
Device A0:E9:DB:41:4F:B7 HeadRush 8003763
[bluetooth]# pair A0:E9:DB:41:4F:B7

The pairing is successfull, but I cannot see my headsets as paired device when I execute the paired-devices command. I cannot connect to my headsets too. I have been blocked for some time, trying unsuccessfull ideas that can make the whole process abort, making me tired and think things do not work with Bluez 5.

I finally realised that I have to restart Bluetoothctl to make it considere that my headsets are paired with my host Bluetooth device. This is the point of the confusion I encounter. I cannot say why, but restarting Bluetoothctl seem's to be mandatory to complete the pairing process of a remote Bluetooth device.
Code:
[bluetooth]# paired-devices
[bluetooth]# exit

$ bluetoothctl

[bluetooth]# paired-devices
Device A0:E9:DB:41:4F:B7 HeadRush 8003763

Now that my headsets are officially paired, I can connect to them. It's mandatory if I want ot use them. The connexion can be initiated by the headsets or by the host.
Code:
[bluetooth]# connect A0:E9:DB:41:4F:B7

The configuration of the Bluetooth host and remote devices can be see at any time with the show and info commands.
Code:
[bluetooth]# show
[bluetooth]# info A0:E9:DB:41:4F:B7

From the moment that the headsets are paired and connected with the host, Pulseaudio see them (A2DP sink profile). I can use my headsets for Gentoo audio output with Pavucontrol. I just have to use Pulseaudio as the default Alsa output device. Most of the audio applications use Alsa by default. In /etc/asound.conf (system) and/or in $HOME/.asoundrc (user) I write
Code:
pcm.pulse {
    type pulse
}

ctl.pulse {
    type pulse
}

pcm.!default {
    type pulse
}

ctl.!default {
    type pulse
}


Because Alsa do not support Bluez version 5 for the moment, Pulseaudio is mandatory for Bluetooth audio with Bluez 5.
_________________
Paul
Back to top
View user's profile Send private message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1555
Location: Montréal

PostPosted: Sat May 10, 2014 9:54 pm    Post subject: Reply with quote

For the moment, Pavucontrol cannot connect to the Pulseaudio server. It have problem with the root X11 window. I tried pax11publish with no change. So I tried the Gnome Control Center. It's Bluetooth utility can pair and connect to the headsets with Bluez 5. It replace well Blueman.

The sound utility of the Gnome Control Center can control which audio output will be use and the headsets volume. It need Pulseaudio server, but replace Pavucontrol well.

So, it should be always possible to use Bluetooth with headsets.
_________________
Paul
Back to top
View user's profile Send private message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1555
Location: Montréal

PostPosted: Thu May 29, 2014 5:30 pm    Post subject: Reply with quote

Logicien wrote:
For the moment, Pavucontrol cannot connect to the Pulseaudio server. It have problem with the root X11 window. I tried pax11publish with no change.

This problem was caused by the fact that my users where in the audio group. This was not preventing Pavucontrol to work before. Removing my users (including the pulse user) from the audio group made Pavucontrol able to communicate with the Pulseaudio server and work again. So, just follow the PulseAudio - Gentoo Wiki should be Ok to use Bluetooth headsets with Bluez 5 and the Pulseaudio sound server.

Shame on me to have bypass the Gentoo wiki recommandations. :oops:

Removing my users from the audio group in Debian also resolv the communication problem of Pavucontrol with Pulseaudio. Debian use Bluez 4 again. To be able to use my headsets in Debian/Bluez 4/Pulseaudio, I have to edit the /etc/pulse/default.pa file to uncomment and edit the line
Code:
load-module module-alsa-sink device=cabps

to force the alsa-sink module to be load by Pulseaudio and use the device cabps who is an entry for my headsets in /etc/asound.conf:
Code:
pcm.cabps {
   type plug
         slave {
           pcm {
           type bluetooth
           device 00:1E:7C:22:14:4C
      profile "auto"
      }
   }
   hint {
      show on
      description "Casque Audio Bluetooth Philips SHB4000"
   }
}



The tricky thing of removing users from the audio group is that now permissions of the users for the audio group are managed by Consolekit or Systemd. If a user is not under Systemd and use for exemple the startx command to go in graphic mode, no Consolekit session for this user will be created and therefore, the audio devices in the audio group will not be available to him.

In that case, the user may have to create his own Consolekit session, here for Xfce4, in his $HOME/.xinitrc to access audio devices.
Code:
exec ck-launch-session dbus-launch --exit-with-session --sh-syntax startxfce4

Some display managers manage permissions using Consolekit when users open a graphic session, but, because Systemd supersede Consolekit, it's not garanteed if you use Openrc.

At the end, Bluetooth headsets have the tendancy to desynchronise if the data transfert suffer from lag. For video with voice it's pretty annoying.
_________________
Paul
Back to top
View user's profile Send private message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1555
Location: Montréal

PostPosted: Sun Jul 13, 2014 2:31 pm    Post subject: Reply with quote

I understand more precisely why Bluetooth headsets can give choppy sound, desynchronise and disconnect from their remote connexions.

Each Bluetooth device have a maximum operating distance from other remote Bluetooth devices. In plus, this maximum distance explicitly apply only in an open area for some devices. If the distance is longer and/or not open, the connexion can be lost. Simple and known.

This maximum distance vary from a Bluetooth device to an other. It's written in the specifications of the device, but not all show it. For example, I have not been able to find it for the integrated Bluetooth device of my HP Pavillion g6 2040ca Notebook. I can guest it by moving with my headset.

The specifications of my HeadRush 8003763 headset say that it can operate approximately inside 10 meters. It do not talk about open area.

I have an ASUS MINI BLUETOOTH USB-BT400 DONGLE USB. The specifications say that it can operate over 10 meters in free space. But, when I come in a close space within those 10 meters with my HeadRush headset, the sound become choppy and desynchonised with the video.

I have to reconnect the HeadRush headset and the Asus Bluetooth device to resynchronise the audio with the video.

This experience make my look for an Usb Bluetooth device that can operate inside a longer distance. I found two:

IOGEAR BLUETOOTH GBU321 CLASS1 100M USB that can operate inside a maximum of 100 meters in an open space and

TRENDNET BLUETOOTH TBW-106UB USB that can operate inside a maximum of 100 meters in an open space.

I bought the IOGEAR. Now, I can move in a close space with my HeadRush headset. The sound stay stable all the time. It never become choppy and do not desynchronise or disconnect from the Iogear Usb Bluetooth dongle.

For the moment, I have not make the test at a longer distance than 10 meters with this Iogear, but it's Transmission/Reception power is enough strong to pass through walls within this area.

So, integrated Bluetooth devices in laptops can be cheap. Bluetooth Usb dongles and headsets too. The specifications of Bluetooth devices must be read and understood to help to explain some sound behaviors with Bluetooth.

:D
_________________
Paul
Back to top
View user's profile Send private message
Kalin
Tux's lil' helper
Tux's lil' helper


Joined: 22 Dec 2002
Posts: 130
Location: Germany

PostPosted: Wed Oct 12, 2016 4:46 pm    Post subject: Reply with quote

Apparently there are sane people that prefer a world without pulseaudio :-)

I need to try that soon.

https://github.com/Arkq/bluez-alsa
Back to top
View user's profile Send private message
jlm
n00b
n00b


Joined: 27 May 2018
Posts: 52

PostPosted: Fri Dec 10, 2021 6:48 pm    Post subject: Reply with quote

diging up this topic, since I can pair, connect, and have my headset automatically connected in bluetoothctl, but not listed on pavucontrol

pacmd ls shows me :
Code:

    index: 7
        name: <module-bluetooth-policy>
        argument: <>
        used: -1
        load once: yes
        properties:
                module.author = "Frédéric Dalleau, Pali Rohár"
                module.description = "Policy module to make using bluetooth devices out-of-the-box easier"
                module.version = "15.0"
    index: 8
        name: <module-bluetooth-discover>
        argument: <>
        used: -1
        load once: yes
        properties:
                module.author = "João Paulo Rechi Vita"
                module.description = "Detect available Bluetooth daemon and load the corresponding discovery module"
                module.version = "15.0"


Code:

*  media-sound/pulseaudio-modules-bt
      Latest version available: 1.4-r1
      Latest version installed: 1.4-r1
      Size of files: 1,572 KiB
      Homepage:      https://github.com/EHfive/pulseaudio-modules-bt
      Description:   PulseAudio modules for LDAC, aptX, aptX HD, and AAC for Bluetooth
      License:       GPL-3


*  media-sound/pulseaudio
      Latest version available: 15.0-r1
      Latest version installed: 15.0-r1
      Size of files: 1,487 KiB
      Homepage:      https://www.freedesktop.org/wiki/Software/PulseAudio/
      Description:   A networked sound server with an advanced plugin system
      License:       !gdbm? ( LGPL-2.1 ) gdbm? ( GPL-2 )
Back to top
View user's profile Send private message
jlm
n00b
n00b


Joined: 27 May 2018
Posts: 52

PostPosted: Fri Dec 10, 2021 7:06 pm    Post subject: Reply with quote

ok solved my issue

pulseaudio on my bluetooth headset. I needed to create a file /etc/bluetooth/audio.conf with contents:
Code:

[General]
Enable=Control,Gateway,Headset,Media,Sink,Socket,Source

And then restart the bluetooth service, re-pair your bluetooth headset
Back to top
View user's profile Send private message
jlm
n00b
n00b


Joined: 27 May 2018
Posts: 52

PostPosted: Sat Dec 11, 2021 7:23 pm    Post subject: Reply with quote

ok, not quite solved my issue...
repairing works once...
if I switch off my bluetooth headset and switch on, it connect to bluez but does not appears again in pulse...
Back to top
View user's profile Send private message
psycho
Guru
Guru


Joined: 22 Jun 2007
Posts: 544
Location: New Zealand

PostPosted: Sat Dec 11, 2021 10:34 pm    Post subject: Reply with quote

Kalin wrote:
Apparently there are sane people that prefer a world without pulseaudio :-)

Bluetooth was, in fact, the incentive for me to go back to pure ALSA on my entertainment boxes. I couldn't get pulseaudio to work with multiple sets of (simultaneously paired) headphones (directing audio to one or another pair as desired, rather than always to both at once). ALSA does the job reliably. As with so much tech these days, the endless "improvements" in the direction of making the tech smarter so that nobody has to think for themselves, makes it steadily more complex, less reliable and harder to configure for any purpose other than what the smart tech decides to do. Still, howtos for pulseaudio are very useful...arguably much more so than howtos for ALSA (there seem to be lots of pure ALSA folks in these forums, but among the people I know personally, I can't think of any Linux users who *aren't* using pulseaudio).

Jlm, have you tried restarting pulse, as soon as bluez can see your headphones?
Back to top
View user's profile Send private message
garrison
Apprentice
Apprentice


Joined: 18 Mar 2003
Posts: 265

PostPosted: Sun Dec 12, 2021 11:40 am    Post subject: Reply with quote

jlm wrote:
ok, not quite solved my issue...
repairing works once...
if I switch off my bluetooth headset and switch on, it connect to bluez but does not appears again in pulse...

Make sure you do 'pair' and then 'trust' the headset.
Also check if you have both pipewire audio and pulseaudio daemon enabled, you only need one and running both simultaneously will cause issues.
Back to top
View user's profile Send private message
jlm
n00b
n00b


Joined: 27 May 2018
Posts: 52

PostPosted: Mon Dec 20, 2021 11:06 pm    Post subject: Reply with quote

headset was paired then trusted, I only have pluseaudio daemon.... but still no luck, bluez automatically connect but pulse don't list the headset...
Back to top
View user's profile Send private message
garrison
Apprentice
Apprentice


Joined: 18 Mar 2003
Posts: 265

PostPosted: Tue Dec 21, 2021 7:41 am    Post subject: Reply with quote

pulseaudio-modules-bt is not likely to work with pulseaudio-15.0 anyway so worth removing those

Currently there is a lot moving around linux bluetooth stack, many bugs fixed and added during last year. If you have intel bluetooth adapter these could be problematic without proper firmware, there is an extensive tracking issue in pulseaudio (#1155) and also similar one in pipewire tracker. It may be worth checking with different bluetooth adapter - if you could borrow any cheap usb bluetooth dongle.

Also make sure you have latest bluez version, if you were on <=bluez-5.56 one day it is worth clearing bluetooth cache in /var/lib/bluetooth and restarting bluetoothd, then pairing/trusting headset again.

Further investigation would require knowing your exact bluetooth hardware model, kernel version and output of pa-info - if you would like to share that, please collect it from your normal user account (not from root account.)

EDIT: bluetooth cache here /var/lib/bluetooth
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54615
Location: 56N 3W

PostPosted: Tue Dec 21, 2021 12:03 pm    Post subject: Reply with quote

Moved from Multimedia to Documentation, Tips & Tricks.

Its one of these.
This topic would get more exposure if it were to become a Wiki page.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
jlm
n00b
n00b


Joined: 27 May 2018
Posts: 52

PostPosted: Mon Jan 03, 2022 10:49 pm    Post subject: Reply with quote

garrison wrote:
pulseaudio-modules-bt is not likely to work with pulseaudio-15.0 anyway so worth removing those

Currently there is a lot moving around linux bluetooth stack, many bugs fixed and added during last year. If you have intel bluetooth adapter these could be problematic without proper firmware, there is an extensive tracking issue in pulseaudio (#1155) and also similar one in pipewire tracker. It may be worth checking with different bluetooth adapter - if you could borrow any cheap usb bluetooth dongle.

Also make sure you have latest bluez version, if you were on <=bluez-5.56 one day it is worth clearing bluetooth cache in /var/lib/bluetooth and restarting bluetoothd, then pairing/trusting headset again.

Further investigation would require knowing your exact bluetooth hardware model, kernel version and output of pa-info - if you would like to share that, please collect it from your normal user account (not from root account.)

EDIT: bluetooth cache here /var/lib/bluetooth


ok I

- removed pulseaudio-modules-bt

- media-sound/pulseaudio
Latest version available: 15.0-r1
Latest version installed: 15.0-r1
- /etc/init.d/bluetooth stop
- rm -r /var/lib/bluetooth/8
- /etc/init.d/bluetooth start
- re do pairing and trusting
still no luck....
- pulseaudio -k
still no luck

would like to share output of pa-info, but too big as inline... is there any way to attach it as a file?
Back to top
View user's profile Send private message
garrison
Apprentice
Apprentice


Joined: 18 Mar 2003
Posts: 265

PostPosted: Tue Jan 04, 2022 7:05 am    Post subject: Reply with quote

jlm wrote:
would like to share output of pa-info, but too big as inline... is there any way to attach it as a file?

suggest opening a bug, files can be attached there
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum