Author Topic: Sending Sound to and From a Bluetooth Headset/Earpiece (mono)  (Read 9557 times)

CtrlAltDel

  • Guest
Re: Sending Sound to and From a Bluetooth Headset
« Reply #15 on: July 06, 2009, 06:14:30 AM »
Quote
If it worked here after a couple of attempts I would be ecstatic!
I tried in root account also with no go, so it is not a permissions problem it seems.

Until I can find a reliable way to get this thing connected to the PC I cannot do much with it.

Did you say whether or not you started the sco module? If not, it might make a difference to you.

regards.

Hmmm..

It's strange all these inconsistencies..  We have nearly the same earpiece..

I'm using the sco module that comes with bluetooth-alsa..  Or at least i think i am..  Is there a way of checking?

I've found though that rebooting the machine after a few failed attempts at pairing the earpiece helps..  In Mythbuntu I can't get the earpiece to pair as I have in PCLOS as an input device..

Cheers,


CtrlAltDel

Offline Was_Just19

  • Hero Member
  • *****
  • Posts: 6852
  • MLU
Re: Sending Sound to and From a Bluetooth Headset
« Reply #16 on: July 06, 2009, 07:33:46 AM »
lsmod | grep sco

If nothing then
modprobe sco

and check again.

It is not loaded by default here as far as I can tell.

CtrlAltDel

  • Guest
Re: Sending Sound to and From a Bluetooth Headset
« Reply #17 on: July 06, 2009, 09:03:58 AM »
Hi again JohnBoy..

OK, today upon reboot I cannot make my earpiece active as an input device..  ???

Skype still shows no bluetooth in sound devices..  ???

I checked the stock kernel to see if SCO voice was enabled..  It is..

I'm in the process of compiling 2.6.28.10 to see if that changes anything..

The modprobe sco command seemed to work ok but still no signs of life..

Should HIDD be enabled at boot or even running?


Cheers,


CtrlAltDel

CtrlAltDel

  • Guest
Re: Sending Sound to and From a Bluetooth Headset
« Reply #18 on: July 06, 2009, 09:05:32 AM »
Quote
[test@localhost ~]$ lsmod | grep sco
sco                     9536  0
bluetooth              51812  10 bnep,sco,hidp,rfcomm,l2cap,hci_usb
[test@localhost ~]$

I've got this now though..


CtrlAltDel

Offline Was_Just19

  • Hero Member
  • *****
  • Posts: 6852
  • MLU
Re: Sending Sound to and From a Bluetooth Headset
« Reply #19 on: July 06, 2009, 11:21:18 AM »
Quote
[test@localhost ~]$ lsmod | grep sco
sco                     9536  0
bluetooth              51812  10 bnep,sco,hidp,rfcomm,l2cap,hci_usb
[test@localhost ~]$

I've got this now though..


CtrlAltDel

Yeah that's after modprobing the sco module.
I added it into modprobe.preload to ensure it loads at each boot ..... in case I ever get to the point of needing it!

Quote
OK, today upon reboot I cannot make my earpiece active as an input device..

So now you begin to ask yourself "what did I do to change things"?
Been there, done that, have the t-shirt!  ;D

The whole bally mess is not making sense ........

CtrlAltDel

  • Guest
Re: Sending Sound to and From a Bluetooth Headset
« Reply #20 on: July 06, 2009, 11:29:57 AM »
OK progress report!!

I followed some of the stuff here.. http://bluetooth-alsa.sourceforge.net/build.html

The a2dpd stuff looks like it's the one we want..

Skype now sees a2dpd in sound devices but still no sound..

Kaffeine gives no errors when i set it to use a2dpd but no sound..

FYI -- I had to remove the existing pairing of my earpiece before I could set it up as an input device..  It worked first time then..

Cheers,


CtrlAltDel

CtrlAltDel

  • Guest
Re: Sending Sound to and From a Bluetooth Headset
« Reply #21 on: July 06, 2009, 11:42:12 AM »
a2dpd running from the console gives the following when i try to play audio..
Quote
A2DPD[17:37:36.246]: stream_client_state_streamingsetup: PLAYBACK thread client_                                                             index=0, socket=9, id=0 started (44100 Hz, 2 channels, 16 bits, ring 65536, thre                                                             shold 65536)
A2DPD[17:38:11.539]: stream_client_send_pointer_resp: (errno=32:Broken pipe)Error while sending data
A2DPD[17:38:11.539]: disconnect_client:
A2DPD[17:38:26.464]: a2dp_reset_encoding_buffer:
A2DPD[17:38:26.464]: pollfd_cb_sockfd: Client 9 got index 0
A2DPD[17:38:26.485]: stream_client_send_pointer_resp: (errno=32:Broken pipe)Error while sending data
A2DPD[17:38:26.485]: disconnect_client:
A2DPD[17:38:26.485]: a2dp_reset_encoding_buffer:
A2DPD[17:38:26.485]: pollfd_cb_sockfd: Client 9 got index 0
A2DPD[17:38:26.485]: pollfd_cb_clients: Client 0: Error detected (err=1, toc=1, err=0, hup=1)
A2DPD[17:38:26.485]: disconnect_client:
A2DPD[17:38:26.519]: a2dp_reset_encoding_buffer:
A2DPD[17:38:26.519]: pollfd_cb_sockfd: Client 9 got index 0
A2DPD[17:38:26.540]: stream_client_state_streamingsetup: PLAYBACK thread client_index=0, socket=9, id=0 started (44100 Hz, 2 channels, 16 bits, ring 65536, threshold 65536)
^CA2DPD[17:39:27.657]: sigint_handler: handling SIGINT
A2DPD[17:39:27.657]: alsa_destroy:
A2DPD[17:39:27.657]: alsa_state_disconnect: State ALSA_STATE_DISCONNECTED
A2DPD[17:39:27.657]: alsa_destroy: OK
A2DPD[17:39:27.657]: a2dp_destroy: a2dp = 0xbfab8b20
A2DPD[17:39:27.658]: a2dp_free: Disconnecting
A2DPD[17:39:27.658]: a2dp_disconnect:
A2DPD[17:39:27.658]: a2dp_stream_stop: Closing stream socket 0
A2DPD[17:39:27.658]: a2dp_stream_stop: Closed
A2DPD[17:39:27.658]: a2dp_stream_stop: State AVDTP_STATE_IDLE
A2DPD[17:39:27.658]: a2dp_disconnect: Closing ctl socket 0
A2DPD[17:39:27.658]: a2dp_disconnect: Closed
A2DPD[17:39:27.658]: a2dp_disconnect: State AVDTP_STATE_DISCONNECTED
A2DPD[17:39:27.659]: a2dp_free: Freeing sbc
A2DPD[17:39:27.659]: a2dp_free: (a2dp = 0x80b2368)
A2DPD[17:39:27.659]: a2dp_free: OK
A2DPD[17:39:27.659]: sco_destroy: sco = 0xbfab8b24
A2DPD[17:39:27.659]: sco_free: Disconnecting
A2DPD[17:39:27.659]: sco_free: (sco = 0x80b10a0)
A2DPD[17:39:27.659]: avrcp_destroy: 0x80b4610
A2DPD[17:39:27.660]: a2dpd_signal_set_socket: Signal socket set to -1
A2DPD[17:39:27.660]: a2dpd_unregister_sdp: Start
A2DPD[17:39:27.660]: a2dpd_unregister_sdp: OK
A2DPD[17:39:27.660]: a2dpd_signal_kill: OK
A2DPD[17:39:27.660]: main: Terminated succesfully
[test@localhost ~]$           
                             


I killed it with Ctrl C to end..



CtrlAltDel

Offline Was_Just19

  • Hero Member
  • *****
  • Posts: 6852
  • MLU
Re: Sending Sound to and From a Bluetooth Headset
« Reply #22 on: July 06, 2009, 12:50:55 PM »
a2dpd
a2dpd_ctl
headsetd

Three new commands for me today!  headsetd seems to be the package for mono two way sound, which is what my Earpiece falls under ...

In addition, located in /etc/dbus-1/system.d/  the files

a2dpd.conf
bluetooth.conf
bluez.conf

and I have no idea if any of those are in play .....

regards.

CtrlAltDel

  • Guest
Re: Sending Sound to and From a Bluetooth Headset
« Reply #23 on: July 06, 2009, 01:43:19 PM »
Here are my files:

/home/me/.a2dprc

Code: [Select]
[a2dpd]
#
# Rate
# use 32000 if your headset seems to not support 44100 (HP/Logitech works well at 44100, Sonorix at 32000)
# However, 44100 is mandatory
# If using SCO, then 8000hz is the value needed.
# if the plugin do not give the 8000hz stream, then the conversion will be done by the daemon
# Until we use a real resample library, we won't get a good quality, this is prototype software.
#
rate=44100
#rate=32000

# buggy if I remember well
channels=2

#
# plugin-rate default is the rate used between the plugin and the daemon
# if this value is not 0 then alsa will convert all stream to the specified rate and then send it to the daemon
# if this value is 0, then alsa will do no conversion at all, the daemon will do it's own resampling.
# This "features" is disabled because of the crappy quality of the daemon resampler
# For example, to test a2dpd resampling from 32000 to 44100 use plugin-rate=32000 and rate=44100
#plugin-rate=32000

# Allows to specify the sbc bitpool, this can help reducing bandwith
# 8 Allows to run on a 115200 bauds with corresponding quality ;)
# 64 needs USB or 921600 bauds
# Recommended value from Bluetooth spec. is 53
sbcbitpool=32

# flags that will later be combinable
# 1: display bandwith each seconds.
# 3: current state
flags=0

# Recommended
enablereversestereo=1

# Automatically connect to selected headset if a stream if started
# not recommended if running on battery ;)
enableautoconnect=1

# Automatically disconnect after a timeout (seconds)
timeout=20

#
# AVRCP Commands to run
# If these entries are emptied, then some keyboard entry will be sent to /dev/uinput
#
cmdplay=xmms --play
cmdpause=xmms --pause
cmdprev=xmms --rew
cmdnext=xmms --fwd
cmdnew=xmms --play
cmdstop=xmms --stop
#cmdplay=dcop amarok player play
#cmdpause=dcop amarok player pause
#cmdprev=dcop amarok player prev
#cmdnext=dcop amarok player next
#cmdnew=dcop amarok player play
#cmdstop=dcop amarok player stop

# Put to 0 to ignore AVRCP (if your computer freezes when commands are received)
enableavrcp=1

#
# Audio routing
#
# If set to 1 (at a2dp startup only) a2dp will reread configuration file
# for audio routing changes each second
enablerereadconfig=1

# Display debug traces or not
enabledebug=1

# Redirect stdout to this file
#logfile=/dev/null

# Poll stdin for control commands ('c'onnect/'s'tart/'p'ause/'d'isconnect/'a'utoconnect)
# Use a2dpd_ctl instead
enablestdin=0

# 0 => Bluetooth A2DP Sink
# 1 => Alsa
enableredirectalsa=0

# Your bluetooth headset address
address=00:0D:FD:17:3A:E8

# Address of your alsa output (default : plughw:0,0) you have to know what to do
alsaoutput=plughw:0,0


and the second file..

/home/me/.asoundrc

Code: [Select]
pcm.bluetooth {
type bluetooth
        device 00:0D:FD:17:3A:E8 #optional, connects to specific device instead the default one
        profile "auto"             #optional, supported profiles are: auto, hifi and voice
}


These are needed hidden files in your /home..  They don't work, as yet, on my system but I think we're close..

Good luck,


CtrlALtDel

Offline Was_Just19

  • Hero Member
  • *****
  • Posts: 6852
  • MLU
Re: Sending Sound to and From a Bluetooth Headset
« Reply #24 on: July 06, 2009, 03:19:27 PM »
I don't have the .a2dpc  file, but do have the .asoundrc file which did not have the 'profile' line.

I have spent some time rooting around in these locations ..

/usr/share/mimelnk/bluetooth/ -- handsfree & headset profile Desktop files.
/usr/share/apps/kdebluetooth/
/usr/share/doc/HTML/en/kdebluetooth
/etc/bluetooth

man:a2dpd_ctl
man:a2dpd
man:headsetd(1)
man:rfcomm

The more I have read, the more confused I have become ... OK I admit easy to do  ;) ..... but I am getting the impression that for mono audio and Mic set up, as for my Earpiece, the a2dpd may not be the way to go, as that seems concentrated on stereo sound and mixer functions etc.

I don't yet have an overview of how all these packages etc connect together so if you have any link to something that might help in that regard please post ... I could do with it  ;)

Even using the CLi I cannot get the Earpiece to connect although I can confirm that bind is working. Maybe there is some option in the rfcomm.conf file that is incorrect .....

regards.

CtrlAltDel

  • Guest
Re: Sending Sound to and From a Bluetooth Headset
« Reply #25 on: July 06, 2009, 04:08:21 PM »
I've spent all day on this and making little headway..

In Mythbuntu I finally got Skype to "Make a Test Call"..

The earpiece connects and I can hear a little hiss but nothing else..  When the test call ends the earpiece makes it's disconnected sound..

So it, in theory, does work..  I am of the same opinion as your good self though..  It's only really for stereo devices..  Bummer!!

I'm not buying a stereo one to find out though as I have a perfectly good set of can earphones with boom mike..  ;D

Do let me know how you get on..

Cheers..


CtrlAltDel


PS: I created that .a2dpc file which I assume was needed to tell a2dpd what the device address etc is..

Offline Was_Just19

  • Hero Member
  • *****
  • Posts: 6852
  • MLU
Re: Sending Sound to and From a Bluetooth Headset
« Reply #26 on: July 06, 2009, 04:59:19 PM »
Well you have succeeded in getting connected which I have not.
So Skype is willing to use it also, if it works.

What does it show up as, in the Skype devices list?

Because you have got so far maybe the answer is somewhere amongst this

hciconfig hci0 voice

which should set up a mono type connection.
The a2dpd is for stereo IIUC.

Maybe using

rfcomm connect <address>   would then make the connection and allow Skype to use it.

All of this is just speculation as I have failed to get my Earpiece to connect at all.

When I try I get
Code: [Select]
rfcomm connect  00:0D:44:02:E1:80
Can't connect RFCOMM socket: Host is down


Even more frustrated than ever!

regards.

CtrlAltDel

  • Guest
Re: Sending Sound to and From a Bluetooth Headset/Earpiece (mono)
« Reply #27 on: July 06, 2009, 05:25:25 PM »
Quote
rfcomm connect 00:0D:FD:17:3A:E8
Can't find a config entry for rfcomm0

OK..  I get a different error..  Missing config file?  Gonna look into this further now..

Skype shows bluetooth in the sound devices list now btw..


Cheers..


CtrlAltDel

CtrlAltDel

  • Guest
Re: Sending Sound to and From a Bluetooth Headset/Earpiece (mono)
« Reply #28 on: July 06, 2009, 05:52:34 PM »
And further progress..

I had to edit /etc/bluetooth/rfcomm.conf

I added my bluetooth mac address then ran your command..

Quote
rfcomm connect 00:0D:FD:17:3A:E8
Connected /dev/rfcomm0 to 00:0D:FD:17:3A:E8 on channel 1
Press CTRL-C for hangup

So result?  My bluetooth earpiece needs charged again   :P

Thanks for that JohnBoy..  I think we're on the right track now..

Here's my /etc/bluetooth/rfcomm.conf

Code: [Select]
#
# RFCOMM configuration file.
#

rfcomm0 {
# # Automatically bind the device at startup
bind no;
#
# # Bluetooth address of the device
device 00:0D:FD:17:3A:E8;
#
# # RFCOMM channel for the connection
channel 1;
#
# # Description of the connection
comment "Logitec Earpiece";
}


Cheers,


CtrlAltDel

Offline travisN000

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1758
Re: Sending Sound to and From a Bluetooth Headset/Earpiece (mono)
« Reply #29 on: July 06, 2009, 06:34:22 PM »
It looks like I'm a little late to the game again..  here are the commands to do essentially what you just worked out:

http://www.pclinuxos.com/index.php?option=com_smf&Itemid=58&topic=56758.msg469897#msg469897
 :o ::) :P

I got stuck at the same place you are; some connection noise, but nothing else...   I'll be checking back to see how progress goes. :-\