You are not logged in.

#1 2012-05-18 15:00:16

keen90
Member
From: Europe
Registered: 2010-04-07
Posts: 106

[SOLVED] bluetooth paired but not connected?

Hi

in a recent thread had problems pairing to a bluetooth headset. Thats working now.
https://bbs.archlinux.org/viewtopic.php?id=141698


I followed the wiki but I cant capture/send audio streams to the headset - i get connection refused, so i asume that I am not connected.

$ aplay -D btheadset mymp3.mp3 
bt_audio_service_open: connect() failed: Connection refused (111)
aplay: main:682: audio open error: Connection refused

(I tried that with root permissions, too.)

How does this work, do I need to connect to the headset although I am already paired. If so, how can I do this?
I tried bluez-manager and after a while i got this connection attemt (which I cannot reproduce now)
but when i entered "yes" nothing happened

bluez-simple-agent
Agent registered
Authorize (/org/bluez/719/hci0/dev_00_23_78_5C_00_A8, 0000111f-0000-1000-8000-00805f9b34fb)
Authorize connection (yes/no): 

So is there another way to connect?

Thanks in advance,
Keen

Last edited by keen90 (2012-05-19 07:17:59)

Offline

#2 2012-05-18 19:28:00

pigiron
Member
From: USA
Registered: 2009-07-14
Posts: 150

Re: [SOLVED] bluetooth paired but not connected?

First of all, aplay will only produce noise with a MP3 file. It wants a WAV file. But that's not the reason for the error.

Bluetooth is a complicated beast, and the Bluez implementation is much more complicated... and using it without a GUI is even more difficult... so I admire your courage and tenacity... plus you try to provide details when asking for help. So good job all around.

But...

I was able to duplicate your "Connection refused (111)" error by reverting to the original /etc/bluetooth/audio.conf file.

Did you miss the portion of the Arch Wiki on Bluetooth where it talked about the Enable flag for audio streams?

https://wiki.archlinux.org/index.php/Bl … _streaming

Not mentioned in the wiki is that you can enable all the Bluetooth audio services by using the following:

Enable=Source,Sink,Headset,Gateway,Control,Socket,Media

But it depends on how paranoid you are about security on which ones you enable. Also, anything on a non-commented Disable line in that config file will override the Enable line.

Here's a debugging tip if you're feeling very adventurous. Stop the bluetooth daemon (/etc/rc.d/bluetooth stop), then fire up a terminal and start it again from the command line (with root authority) while also sending all (debug) text input/output to a file:

# script /tmp/bluetooth.txt
# bluetoothd -d -n

A ton of stuff will be displayed/written, but pay special attention (using the text file if need be) to the lines containing mostly capital letters. Those are some of the main stages in bringing up/down a Bluetooth device and will perhaps provide some clue about what's going on "under the covers".

Here's a small snippet showing just a portion of those lines successfully bringing up my Bluetooth stereo headphones (that also has a microphone and audio controls... pause, play, etc):

  • HEADSET_STATE_DISCONNECTED -> HEADSET_STATE_CONNECTING

  • HEADSET_STATE_CONNECTING -> HEADSET_STATE_CONNECTED

  • SINK_STATE_DISCONNECTED -> SINK_STATE_CONNECTING

  • IDLE -> CONFIGURED

  • CONFIGURED -> OPEN

  • SINK_STATE_CONNECTING -> SINK_STATE_CONNECTED

  • OPEN -> STREAMING

  • SINK_STATE_CONNECTED -> SINK_STATE_PLAYING

  • STREAMING -> OPEN

  • SINK_STATE_PLAYING -> SINK_STATE_CONNECTED

All that's just before I even attempted to play some music. Depending upon your headset capabilities (or if your device is "trusted"), yours may be different.

Press Ctrl- c to stop the bluetooth daemon.
Press Ctrl- d to exit the script utility.

Also,.. check out the files in the /var/lib/bluetooth/<baddr> directory for fun and amusement. Hopefully there's a pincodes file containing the PIN code for your headset... along with a bunch of other files.

Good luck.

Last edited by pigiron (2012-05-18 22:23:17)

Offline

#3 2012-05-19 06:54:14

keen90
Member
From: Europe
Registered: 2010-04-07
Posts: 106

Re: [SOLVED] bluetooth paired but not connected?

wow thanks for the long post!

first of all, you were right, I forgot to edit
/etc/bluetooth/audio.conf

I now added this to the [General section]

Enable=Control,Source
Enable=Socket

Bad news is I still get the same error when I use aplay (now with a WAV) :-(

then I tried your debugging suggestion, and it looks like the connection is not established:

bluetoothd[1094]: audio/headset.c:headset_set_state() State changed /org/bluez/1094/hci0/dev_00_23_78_5C_00_A8: HEADSET_STATE_DISCONNECTED -> HEADSET_STATE_CONNECTING
bluetoothd[1094]: audio/manager.c:ag_confirm() Authorization denied: Operation not permitted
bluetoothd[1094]: audio/headset.c:headset_set_state() State changed /org/bluez/1094/hci0/dev_00_23_78_5C_00_A8: HEADSET_STATE_CONNECTING -> HEADSET_STATE_DISCONNECTED
bluetoothd[1094]: plugins/hciops.c:disconn_complete() handle 11 status 0x00
bluetoothd[1094]: src/event.c:btd_event_disconn_complete() 
bluetoothd[1094]: src/adapter.c:adapter_remove_connection() 

I asume the problem is the "Operation not permitted" message. But I really dont know what to do now :-?

Offline

#4 2012-05-19 07:07:32

keen90
Member
From: Europe
Registered: 2010-04-07
Posts: 106

Re: [SOLVED] bluetooth paired but not connected?

wait a second a reboot helped, because now it works!!!
(debug also looks very like you described it now, too)

big_smile

ok one last question. I dont't see any controls for the headset in alsamixer - is there a way to declare the bluetooth headset itself to a alsa device?
Usually when i have multiple soundcards i can chose between them by using the F6 key in alsamixer. As far as I understood the changes I made to  /etc/alsa.conf I now  dont't declare an extra soundcard, but an extra element for the default card.
(I can see that the headset is not listed in /proc/asound/cards)

Anyway thanks for all the help I got so far!

Last edited by keen90 (2012-05-19 07:33:05)

Offline

Board footer

Powered by FluxBB