You are not logged in.

#1 2013-06-24 19:34:48

vlsd
Member
Registered: 2013-06-24
Posts: 33
Website

Bluetooth headset workarounds in conflict with each ohther

I have this bluetooth headset (Sony DR-BT50) that I like using at work to listen to music. The way I had it set up for a very long time was using bluez, blueman and pulseaudio as described in https://wiki.archlinux.org/index.php/Bluetooth_Headset.

One of the things I had to do for it to work was to add

Enable=Socket

in

/etc/bluetooth/audio.conf

. A recent update broke my old setup and after intense fiddling I figure out the problem, but not really a robust solution. It seems like blueman/bluez4 requires the

Enable=Socket

line in order to correctly pair my headset in A2DP mode. If I do not that have that line in the configuration file I get a "Stream setup failed" error in blueman, and my headset does not get setup for A2DP. This wouldn't be a problem except recently pulseaudio stopped recognizing devices set up using the Socket flag. So, to get blueman to work, I need to enable Socket, while for pulseaudio to see my device I need to disable the socket option. Both of these workarounds are on the wiki, in the same page, only a few lines apart. I *have* been able, once, to get blueman to connect to my device using

Disable=Socket

which is how I know that pulseaudio likes that option. I was not able to reproduce this (desirable) behavior. Does anyone know what is going on and how I could get my headset working again?

Offline

#2 2013-06-24 22:43:38

vlsd
Member
Registered: 2013-06-24
Posts: 33
Website

Re: Bluetooth headset workarounds in conflict with each ohther

I've actually just found someone who managed to figure out the correct way to work this out, at the last answer to this question http://askubuntu.com/questions/287254/u … s-not-work

The solution is very weird and clearly an ugly hack. First kill pulseaudio and make sure it staying dead. Add the Enable=Socket option to /etc/bluetooth/audio.conf. Then, after restarting the bluetooth daemon, connect to the headset as an audio sink (a2dp) with blueman. Then change the config file again to remove what you just added, and restart the bluetooth daemon yet again, start pulseaudio and restart the bluetooth daemon for the last time. Mysteriously the headset connects and pulseaudio recognizes it. I could write a script that does this automatically, but doesn't it seem like something is not working right here?

Offline

#3 2013-06-25 15:34:53

HenriqueNunnes
Member
Registered: 2013-03-29
Posts: 41

Re: Bluetooth headset workarounds in conflict with each ohther

Hello @vlsd,

Thank you so much for your advice, helped me a lot. I'm trying changing my output sound since my speakers burned it... So I did this steps above and my sound works again smile

If is possible can you write some script to do it automatically?

Two questions: Is there a way to use a headset with ALSA without pass through by pulseaudio? 
                       My sounds works for every applications except to games in wine. Is there a specific configuration?

Thank you so much!

Offline

#4 2013-10-08 22:32:44

vlsd
Member
Registered: 2013-06-24
Posts: 33
Website

Re: Bluetooth headset workarounds in conflict with each ohther

I finally decided to switch away from pulseaudio. I was reticent since the wiki page for ALSA config with bluez says a lot of it is out of date. I tried it anyway, and got it working. This is what I did:

1. Installed bluez4 (NOT bluez), blueman and all the alsa stuff. I removed pulseaudio entirely
2. In /etc/bluetooth/audio.conf added

Enable=Sink,Socket

3. Paired my headphones using blueman
4. Used this .asoundrc in my home folder. Don't forget to change the mac address!

And that's it! No more dancing around pulseaudio bugs. The only problem is when the headphones die/get disconnected the media player might take a nose dive, but I'm willing to live with it.

Offline

#5 2014-05-18 20:40:10

HenriqueNunnes
Member
Registered: 2013-03-29
Posts: 41

Re: Bluetooth headset workarounds in conflict with each ohther

Thank you man for your contribution!

NO MORE DANCING AROUND PULSEAUDIO BUGS!

The best part! big_smile

So I have a question. Are you able to set alsa for all applications like in my case (clementine, smplayer, chromium, wine and steam etc...) Because for me is working one application per time if I'm listening to music I can't play a game on wine and things like that... So there is a way to all applications work simultaneously??

Thank you again!

Henrique

Last edited by HenriqueNunnes (2014-05-20 14:50:55)

Offline

#6 2014-05-18 22:32:12

emeres
Member
Registered: 2013-10-08
Posts: 1,570

Re: Bluetooth headset workarounds in conflict with each ohther

Try using a dmix in between, read the wiki and plugins page.

Offline

#7 2014-05-19 01:36:17

HenriqueNunnes
Member
Registered: 2013-03-29
Posts: 41

Re: Bluetooth headset workarounds in conflict with each ohther

@emeres

Thank you for your reply! I have to add this to my ~/.asoundrc?

Offline

#8 2014-05-19 09:36:46

emeres
Member
Registered: 2013-10-08
Posts: 1,570

Re: Bluetooth headset workarounds in conflict with each ohther

Yes, in between type plug an type bluetooth, if you are using asoundrc vlsd suggested.

Offline

#9 2014-05-22 01:00:54

HenriqueNunnes
Member
Registered: 2013-03-29
Posts: 41

Re: Bluetooth headset workarounds in conflict with each ohther

Hey guys

Could you help me with my ~/.asoundrc. I searched a lot of things I understood how it's work but I can't do it works. When a put the plugin for dmix alsa didn't start correctly or shared the sound with other applications. 

When I tried this configuration:

[henrique@archlinux ~]$ cat .asoundrc                                     21:59
pcm.!default {
   type plug
   slave {
       pcm {
           type bluetooth
           device 00:02:5B:01:01:60
           profile "auto"
       }   
   }   
   hint {
       show on
       description "BT Headset"

ctl.dmixer {
   type hw
   card 0
   device 0
}
pcm.dsp {
    type plug
    slave.pcm "dmixer"

   }   
}
ctl.!default {
  type bluetooth
}

I've this message after restore alsa.

screenshot-05212014-095834pm.php

Thanks

Offline

#10 2014-05-22 01:38:25

emeres
Member
Registered: 2013-10-08
Posts: 1,570

Re: Bluetooth headset workarounds in conflict with each ohther

Your syntax is wrong (you made ctl.dmixer part of pcm.default), and there is no point in creating a pcm if you do not use it (pcm.dmixer). Try something like this:

pcm.!default {	type plug;
		slave.pcm "bthp";	}

pcm.bthp {	type dmix;
		ipc_key 1024;
		ipc_key_add_uid false;
		ipc_perm 0666;
		slave.pcm {	type bluetooth;
				device 00:02:5B:01:01:60;
				profile "auto";	}
		hint {	show on;
			description "BT Headset";	}	}

#ctl.bthp {	type bluetooth;	}
ctl.!default {	type bluetooth;	}

The thing is that dmix usually works only when addressing hardware directly through raw communication with the ALSA kernel driver (type hw), so it may not accept type bluetooth as its slave. I have no way of testing this right now. If it does not work try switching dmix with plug part. Here is an interesting thread.

Last edited by emeres (2014-05-22 01:39:57)

Offline

#11 2014-05-22 02:05:50

HenriqueNunnes
Member
Registered: 2013-03-29
Posts: 41

Re: Bluetooth headset workarounds in conflict with each ohther

Thank you! Help me a lot!

Alsa recognize the new configuration for .asoundrc, but no sound.

Mplayer I got this error:

[henrique@archlinux ~]$ mplayer Music/Audioslave/Audioslave/01\ Cochise.mp3
MPlayer SVN-r37051 (C) 2000-2014 MPlayer Team
207 audio & 440 video codecs
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing Music/Audioslave/Audioslave/01 Cochise.mp3.
libavformat version 55.33.100 (internal)
Audio only file format detected.
Clip info:
 Title: Cochise
 Artist: Audioslave
 Album: Audioslave
 Year: 2002
 Comment: 00001B73 00001ABF 0000810A
 Track: 1
 Genre: Rock
Load subtitles in Music/Audioslave/Audioslave/
==========================================================================
Opening audio decoder: [mpg123] MPEG 1.0/2.0/2.5 layers I, II, III
AUDIO: 44100 Hz, 2 ch, s16le, 192.0 kbit/13.61% (ratio: 24000->176400)
Selected audio codec: [mpg123] afm: mpg123 (MPEG 1.0/2.0/2.5 layers I, II, III)
==========================================================================
[AO OSS] audio_setup: Can't open audio device /dev/dsp: No such file or directory
[AO_ALSA] alsa-lib: pcm_direct.c:1522:(_snd_pcm_direct_get_slave_ipc_offset) Invalid type 'bluetooth' for slave PCM

[AO_ALSA] Playback open error: Invalid argument
AO: [pulse] Init failed: Connection refused
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
[JACK] cannot open server
[AO SDL] Samplerate: 44100Hz Channels: Stereo Format s16le
[AO_ALSA] alsa-lib: pcm_direct.c:1522:(_snd_pcm_direct_get_slave_ipc_offset) Invalid type 'bluetooth' for slave PCM

[AO SDL] Unable to open audio: No available audio device
DVB card number must be between 1 and 4
AO: [null] 44100Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...
A:  14.6 (14.5) of 222.0 (03:42.0)  0.6% 


MPlayer interrupted by signal 2 in module: play_audio
A:  14.6 (14.5) of 222.0 (03:42.0)  0.6% 

Exiting... (Quit)

Clementine I got this error:

screenshot-05212014-105703pm.php

I'll searching how to put all together and make may sound work out of the box.

Offline

#12 2014-05-22 02:17:07

emeres
Member
Registered: 2013-10-08
Posts: 1,570

Re: Bluetooth headset workarounds in conflict with each ohther

Then try switching plug with dmix parts, but I doubt it will help. If I recall correctly dmix does not accept type plug with something else then hw behind it either. You would have to look for something mixing the sound together before using type bluetooth, which is exactly what pulseaudio does. But maybe there are other ways. If you get stuck, you may want to ask on alsa-user mailing list, they should know if it is possible with alsa only or not.

Offline

Board footer

Powered by FluxBB