On an Acer laptop, I have never had working support for the built-in Bluetooth adapter — https://bugs.launchpad.net/ubuntu/+source/linux-firmware/+bug/1643455 — and finally threw in the towel and bought a cheap USB Bluetooth dongle:
# lsusb -v -d 0a12:0001
Bus 002 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 224 Wireless
bDeviceSubClass 1 Radio Frequency
bDeviceProtocol 1 Bluetooth
bMaxPacketSize0 64
idVendor 0x0a12 Cambridge Silicon Radio, Ltd
idProduct 0x0001 Bluetooth Dongle (HCI mode)
bcdDevice 88.91
iManufacturer 0
iProduct 2 CSR8510 A10
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 177
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xe0
Self Powered
Remote Wakeup
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 3
bInterfaceClass 224 Wireless
bInterfaceSubClass 1 Radio Frequency
bInterfaceProtocol 1 Bluetooth
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0010 1x 16 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 224 Wireless
bInterfaceSubClass 1 Radio Frequency
bInterfaceProtocol 1 Bluetooth
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0000 1x 0 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0000 1x 0 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 1
bNumEndpoints 2
bInterfaceClass 224 Wireless
bInterfaceSubClass 1 Radio Frequency
bInterfaceProtocol 1 Bluetooth
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0009 1x 9 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0009 1x 9 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 2
bNumEndpoints 2
bInterfaceClass 224 Wireless
bInterfaceSubClass 1 Radio Frequency
bInterfaceProtocol 1 Bluetooth
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0011 1x 17 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0011 1x 17 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 3
bNumEndpoints 2
bInterfaceClass 224 Wireless
bInterfaceSubClass 1 Radio Frequency
bInterfaceProtocol 1 Bluetooth
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0019 1x 25 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0019 1x 25 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 4
bNumEndpoints 2
bInterfaceClass 224 Wireless
bInterfaceSubClass 1 Radio Frequency
bInterfaceProtocol 1 Bluetooth
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0021 1x 33 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0021 1x 33 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 5
bNumEndpoints 2
bInterfaceClass 224 Wireless
bInterfaceSubClass 1 Radio Frequency
bInterfaceProtocol 1 Bluetooth
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0031 1x 49 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0031 1x 49 bytes
bInterval 1
Device Status: 0x0001
Self Powered
Under Windows 10 (dual-boot) everything works, including the built-in Bluetooth adapter and the USB dongle Bluetooth adapter. I have a bunch of headsets that support both A2DP (high-quality audio output only) and HFP/HSP (low-quality bidirectional input and output). Under Windows 10, the correct Bluetooth profile is chosen automatically to be consistent with the application.
Note that I am running Gnome 3, not Unity, currently at version 3.26.2-0ubuntu0.1 (which is stock with Ubuntu 17.10).
Under Ubuntu before 17.04, I could manually switch a headset between A2DP and HFP/HSP easily from gnome-control-center. Bluetooth headsets that had been paired under earlier versions of Ubuntu, such as 16.04, continue to work correctly under later versions as Ubuntu was upgraded.
I had some modifications in /etc/pulse/default.pa that allowed my main headset to become the default audio device (replacing the built-in speakers and microphone on the laptop case) when it was connected. I did this by uncommenting and therefore enabling the loading of module "module-switch-on-connect" and manually specifying the headset by unique device identifier as the default source and default sink:
set-default-sink bluez_sink.16_07_12_21_09_4B.headset_head_unit
set-default-source bluez_sink.16_07_12_21_09_4B.headset_head_unit
What does not work is that Bluetooth headsets newly paired since 17.04 was released are locked to A2DP and cannot be switched. Both profiles show up in the appropriate pulldown in gnome-control-center, but selecting HFP/HSP has no effect and is not retained. In fact, selecting HFP/HSP and then using "Test speakers" shows a left and a right channel, proving that the device is still in A2DP mode (which is stereo) rather than HFP/HSP mode (which is mono).
Here is an example of output from "pactl list cards" showing the relevant Bluetooth headset:
Name: bluez_card.FB_60_AD_59_5B_9E
Driver: module-bluez5-device.c
Owner Module: 33
Properties:
device.description = "Premium Earbuds"
device.string = "FB:60:AD:59:5B:9E"
device.api = "bluez"
device.class = "sound"
device.bus = "bluetooth"
device.form_factor = "hands-free"
bluez.path = "/org/bluez/hci0/dev_FB_60_AD_59_5B_9E"
bluez.class = "0x240408"
bluez.alias = "Premium Earbuds"
device.icon_name = "audio-handsfree-bluetooth"
device.intended_roles = "phone"
Profiles:
a2dp_sink: High Fidelity Playback (A2DP Sink) (sinks: 1, sources: 0, priority: 10, available: yes)
headset_head_unit: Headset Head Unit (HSP/HFP) (sinks: 1, sources: 1, priority: 20, available: no)
off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
Active Profile: a2dp_sink
Ports:
handsfree-output: Handsfree (priority: 0, latency offset: 0 usec)
Part of profile(s): a2dp_sink, headset_head_unit
handsfree-input: Handsfree (priority: 0, latency offset: 0 usec, not available)
Part of profile(s): headset_head_unit
Note especially the "Profiles" block where "a2dp_sink" is listed with "available: yes" and "headset_head_unit" is listed with "available: no". Remember, this cannot be coming directly from the device because (1) these headsets work as expected under Windows 10 and (2) the same model headset works correctly if and only if it was paired under an older version of Ubuntu. Identically results are experienced with four or five different headsets, so I'm confident they are not defective.
Trying to set the profile manually succeeds for A2DP but fails for HFP/HSP with an error:
# pactl set-card-profile 8 a2dp_sink
# pactl set-card-profile 8 headset_head_unit
Failure: Input/Output error
I would be satisfied with getting these headsets permanently locked to HFP/HSP and never using A2DP if necessary, but I can't figure out even how to do that.
Best Answer
EDIT: also try connecting using Blueman. I don't know why PulseAudio has so much trouble but simply opening Blueman, right-clicking on my headphones in the overview, and selecting Audio Profile > Headset Head Unit (HSP/HFP) fixed it for me. I have since stopped and removed oFono and it still seems to work.
I had a similar (the same?) problem with my Bose QC35 II and fixed it by following these instructions ("Using HFP with oFono").
I'm on Debian buster so things might be a little bit different for you.
Install
ofono
andofono-phonesim
:Clone the oFono Git repository (currently at cf850de632):
List the available modems you have:
It'll probably have no modems, which is not surprising on a modern Linux desktop. But for reasons I don't really understand you really do need to have some sort of modem to get headphones to work, so we're going to simulate one now.
Start by simulating one (you can probably pick a different port if you want):
Modify /etc/ofono/phonesim.conf to use this simulated modem. My Debian version was so kind to put something in there already but commented it out. This is what it looks like for me now (without the comments):
Restart oFono:
Check that the device is now listed:
Enable the device:
If you get an error like this, make sure your phonesim is up and running:
Check that the device is now powered on using
./test/list-modems
.Hopefully it works now! You may need to restart other services too (bluez, pulseaudio).
I can now pick my headphone as an input device. It will cause the device to use very low quality audio but at least it works. Make sure to switch back to "High Fidelity Playback (A2DP Sink)" when you're done with the microphone as you'll otherwise get very low quality audio output.