stevegal
Posts: 8
Joined: Thu May 26, 2016 6:08 pm

Bluetooth - Headset/Handsfree

Sat May 28, 2016 7:38 am

I've got an EasyAcc-MC (speaker and mic) that I'm trying to connect to so I can stream and receive from the mic (aiming for an Alexa service really!). I've got a fully up to date image so bluez5 I think..

Code: Select all

[bluetooth]# version
Version 5.23
I can stream using the Audio Sink just fine (A2DP profile on bluetooth I think), but can't get anywhere with the microphone.

from bluetoothctl I see

Code: Select all

[bluetooth]# show
Controller B8:27:EB:D9:8E:58
	Name: raspberrypi
	Alias: raspberrypi
	Class: 0x0c0000
	Powered: yes
	Discoverable: no
	Pairable: yes
	UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
	UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)
	UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
	UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
	UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
	UUID: Audio Source              (0000110a-0000-1000-8000-00805f9b34fb)
	UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
	Modalias: usb:v1D6Bp0246d0517
	Discovering: no
and from the device info I see

Code: Select all

Name: EasyAcc-Mc
	Alias: EasyAcc-Mc
	Class: 0x240404
	Icon: audio-card
	Paired: yes
	Trusted: no
	Blocked: no
	Connected: no
	LegacyPairing: no
	UUID: Serial Port               (00001101-0000-1000-8000-00805f9b34fb)
	UUID: Headset                   (00001108-0000-1000-8000-00805f9b34fb)
	UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
	UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
	UUID: Advanced Audio Distribu.. (0000110d-0000-1000-8000-00805f9b34fb)
	UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
	UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)
So no HSP of HFP on the pi! so not surprised it's not allowing that connection mode. I've tried to install ofono (not even sure that is the right thing to do though?) but as you can see, I must not have that setup properly (no Handsfree on the pi!). Am I heading down the right path to record from the microphone from the device?

Advice please! I'm stuck!!!

User avatar
Douglas6
Posts: 4675
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Bluetooth - Headset/Handsfree

Sat May 28, 2016 2:43 pm

I do believe you'll need oFono on the Pi (or a later version of PulseAudio). I've never tried HFP, so can't help much.

stevegal
Posts: 8
Joined: Thu May 26, 2016 6:08 pm

Re: Bluetooth - Headset/Handsfree

Wed Jun 08, 2016 10:01 pm

think I'm starting to get somewhere. I installed pulseaudio 8 from source as well as bluez 5.40

Now in bluesman I see HSP/HFP and A2DP sink available, but can't switch to HSP/HFP profile

the result of pact list shows:

Code: Select all

Card #1
	Name: bluez_card.5A_5A_5A_A6_39_AE
	Driver: module-bluez5-device.c
	Owner Module: 22
	Properties:
		device.description = "EasyAcc-Mc"
		device.string = "5A:5A:5A:A6:39:AE"
		device.api = "bluez"
		device.class = "sound"
		device.bus = "bluetooth"
		device.form_factor = "headset"
		bluez.path = "/org/bluez/hci0/dev_5A_5A_5A_A6_39_AE"
		bluez.class = "0x240404"
		bluez.alias = "EasyAcc-Mc"
		device.icon_name = "audio-headset-bluetooth"
		device.intended_roles = "phone"
	Profiles:
		headset_head_unit: Headset Head Unit (HSP/HFP) (sinks: 1, sources: 1, priority: 20, available: no)
		a2dp_sink: High Fidelity Playback (A2DP Sink) (sinks: 1, sources: 0, priority: 10, available: yes)
		off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
	Active Profile: a2dp_sink
	Ports:
		headset-output: Headset (priority: 0, latency offset: 0 usec)
			Part of profile(s): headset_head_unit, a2dp_sink
		headset-input: Headset (priority: 0, latency offset: 0 usec, not available)
			Part of profile(s): headset_head_unit
but available is no :(.... getting closer... anyone got anything that may help?

Thanks

User avatar
Douglas6
Posts: 4675
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Bluetooth - Headset/Handsfree

Wed Jun 08, 2016 11:30 pm

Do you need to add the Hands Free Profile to the SDP database? Easiest way is to add the ' - C' compatibility flag to the bluetoothd line in /etc/systemd/system/dbus-org.bluez.service unit file. Reboot and do

Code: Select all

sudo sdptool add HF
That way, other devices will know the Pi has an HFP service available.

stevegal
Posts: 8
Joined: Thu May 26, 2016 6:08 pm

Re: Bluetooth - Headset/Handsfree

Thu Jun 09, 2016 8:07 pm

@Douglas6

Thanks for your help! I tried what you suggested, but still no luck. In addition I added

Code: Select all

sudo sdptool add HS
In the /etc/systemd/system/dbus-org.bluez.service I tried

Code: Select all

ExecStart=/usr/local/libexec/bluetooth/bluetoothd - C
and

Code: Select all

ExecStart=/usr/local/libexec/bluetooth/bluetoothd -C

but still not able to switch :(

because I wasn't sure which was/could be supported by pulse audio (I was assuming pulse audio 8 handles HSP without ofono - I don't want to pair with a phone (no need to make calls from the pi etc, just get audio from the pi to the speaker and record from the mic on the speaker) so no real need for HFP, so would HSP be sufficient?)

further ideas and help welcome!

User avatar
Douglas6
Posts: 4675
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Bluetooth - Headset/Handsfree

Thu Jun 09, 2016 8:36 pm

Bear in mind that I'm making stabs in the dark here. It should be '-C', no space between them. If you're in compatibility mode, you should get a 'X service registered' message from the sdptool commands. Double-check with

Code: Select all

sudo sdptool browse local
and check that the services are listed. After that, I would remove your device in bluetoothctl and re-pair with the services added. As I understand it, HFP or HSP should suffice.

stevegal
Posts: 8
Joined: Thu May 26, 2016 6:08 pm

Re: Bluetooth - Headset/Handsfree

Thu Jun 09, 2016 8:56 pm

output from browse

Code: Select all

Service Name: hfp_hf
Service RecHandle: 0x10005
Service Class ID List:
  "Handsfree" (0x111e)
  "Generic Audio" (0x1203)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 7
Profile Descriptor List:
  "Handsfree" (0x111e)
    Version: 0x0106

Service Name: Headset
Service RecHandle: 0x10006
Service Class ID List:
  "Headset" (0x1108)
  "Generic Audio" (0x1203)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 5
Profile Descriptor List:
  "Headset" (0x1108)
    Version: 0x0100
I also change the bluetooth command to '--compat' and that works! (compat required for sdptool right??)

User avatar
Douglas6
Posts: 4675
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Bluetooth - Headset/Handsfree

Thu Jun 09, 2016 9:06 pm

Right. Did you try re-pairing?

stevegal
Posts: 8
Joined: Thu May 26, 2016 6:08 pm

Re: Bluetooth - Headset/Handsfree

Thu Jun 09, 2016 9:32 pm

Sorry. I forgot :(.

Tried now though. Went to blueman and tried through that. also tried through bluetoothctl. removed the device and repaired and trusted.

No success.

Anything else I could try?(and thanks again for your help)

stevegal
Posts: 8
Joined: Thu May 26, 2016 6:08 pm

Re: Bluetooth - Headset/Handsfree

Thu Jun 09, 2016 9:47 pm

I've rebooted... and now sdptool browse local no longer has headset... I've re-added and re-moved the pair. Still no luck. But on reboot the headset profile is gone again. Weird right? Wonder if somehow it's not actually added, or if the HF presence is confusing things?

User avatar
Douglas6
Posts: 4675
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Bluetooth - Headset/Handsfree

Thu Jun 09, 2016 9:58 pm

sdptool add is not persistent across reboots, so it's interesting that HFP remains. I'm guessing PulseAudio adds that. I'm out of ideas, I'm sorry.

stevegal
Posts: 8
Joined: Thu May 26, 2016 6:08 pm

Re: Bluetooth - Headset/Handsfree

Fri Jun 10, 2016 8:58 am

Thanks for your help.

just for a bit of further information:
when I

Code: Select all

pacmd set-card-profile 1 headset_head_unit
then in the pulse audio debug logs I see

Code: Select all

I: [pulseaudio] client.c: Created 2 "UNIX socket client"
W: [pulseaudio] module-bluez5-device.c: Refused to switch profile to headset_head_unit: Not connected
D: [pulseaudio] cli.c: CLI got EOF from user.
I: [pulseaudio] client.c: Freed 2 "UNIX socket client"
does that provide any further clues?

jenhro
Posts: 1
Joined: Sat Jun 18, 2016 3:15 pm

Re: Bluetooth - Headset/Handsfree

Sat Jun 18, 2016 3:28 pm

I got the same problem. I bought a bluetooth earphone(with mic).
I want to make records from bluetooth mic.
but it only works on A2DP.
I update OS to ubuntu mate 16.04.
Then I connect my bluetooth earphone , I can see the HFP mode in menu in Blueman,but it does'nt work as I change the mode.
the system audio panel shows the mic and speaker. but it still can not work ! :cry:

I found a solution :
viewtopic.php?t=104579&p=725766
they said a fire firmware file need to update, but I haven't try.

youness
Posts: 34
Joined: Sat Sep 03, 2016 4:51 pm
Contact: Website

Re: Bluetooth - Headset/Handsfree

Mon Mar 27, 2017 11:24 pm

Hi,

Do not merge built-in Bluetooth chipset (in Raspberry Pi 3), and people using external Bluetooth USB device (in the above link).

BTW, Some information here if you still need it:
http://youness.net/raspberry-pi/bluetoo ... 3-ad2p-hsp

youness
Posts: 34
Joined: Sat Sep 03, 2016 4:51 pm
Contact: Website

Re: Bluetooth - Headset/Handsfree

Thu Feb 08, 2018 2:21 pm

There is a solution for A2DP and HSP with Raspberry Pi:
Check this post: https://youness.net/raspberry-pi/how-to ... berry-pi-3

nztech
Posts: 1
Joined: Sat Apr 28, 2018 9:49 am

Re: Bluetooth - Headset/Handsfree

Sat Apr 28, 2018 9:57 am

Hi,
Not sure is me but link is hard to follow....

I have a Bluetooth speaker and Mic in one. I have connected to my Raspberry PI 3 via BlueTooth and the speaker is working with a little bit of work. However the Mic is not working:

[email protected]:~ $ arecord -l
**** List of CAPTURE Hardware Devices ****

Has anyone come across this and resolutions?

Many thanks.

Return to “Troubleshooting”