You are not logged in.

#1 2019-07-24 21:07:26

Brocellous
Member
Registered: 2017-11-27
Posts: 145

[SOLVED] Connecting volume buttons on bluetooth headphones

So I've had a pair of Bose QC35 headphones for a while and they generally work well. These headphones have 3 buttons on device itself, a '-', a '+', and a larger middle button. On some supported devices, like my android phone and windows 10 machines, when these headphones connect, the +/- volume buttons can be used to remotely control the volume of the source. I would like to remotely control Pulseaudio with these volume buttons, but I am unsure how.

When I connect my headphones with the A2DP profile, the middle button gets mapped, but the others do not.

My bluetooth headphones:

$ bluetoothctl info
Device 04:52:C7:0C:D4:A7 (public)
	Name: Bose QuietComfort 35
	Alias: Bose QuietComfort 35
	Class: 0x00240418
	Icon: audio-card
	Paired: yes
	Trusted: yes
	Blocked: no
	Connected: yes
	LegacyPairing: no
	UUID: Vendor specific           (00000000-deca-fade-deca-deafdecacaff)
	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)
	UUID: Phonebook Access Server   (0000112f-0000-1000-8000-00805f9b34fb)
	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: Device Information        (0000180a-0000-1000-8000-00805f9b34fb)
	UUID: Bose Corporation          (0000febe-0000-1000-8000-00805f9b34fb)
	Modalias: bluetooth:v009Ep400Cd0255

The new libinput device:

# libinput list-devices | sed -n '/04:52:C7:0C:D4:A7/,/^$/ p'
Device:           04:52:C7:0C:D4:A7
Kernel:           /dev/input/event22
Group:            14
Seat:             seat0, default
Capabilities:     keyboard 
Tap-to-click:     n/a
Tap-and-drag:     n/a
Tap drag lock:    n/a
Left-handed:      n/a
Nat.scrolling:    n/a
Middle emulation: n/a
Calibration:      n/a
Scroll methods:   none
Click methods:    none
Disable-w-typing: n/a
Accel profiles:   n/a
Rotation:         n/a

Libinput events from my device after pressing all the buttons. KEY_PLAYCD corresponds to the middle button. The +/- volume keys are absent.

# libinput debug-events --show-keycodes
[...]
-event22  DEVICE_ADDED     04:52:C7:0C:D4:A7                 seat0 default group14 cap:k
 event22  KEYBOARD_KEY      +4.45s	KEY_PLAYCD (200) pressed
 event22  KEYBOARD_KEY      +4.46s	KEY_PLAYCD (200) released

Instead the +/- buttons serve to change the _internal_ volume level on the headphones as if they were unconnected.

I imagine there is some sort of AVRCP profile I can use, but I couldn't find anything on the wiki or elsewhere. Does anyone know if it is possible to get the headphones to forward these button presses?

EDIT:

I've searched around but cannot find any evidence of anyone getting avrcp profile working at all in linux. Does anyone have any experience using avrcp with _any_ device?

I've tried changing the MultiProfile setting in /etc/bluetooth/main.conf to both single and multiple, but they have no obvious effect.

I tried creating the following drop-in service file:

# /etc/systemd/systemd/bluetooth.service.d/override.conf

[Service]
ExecStart=
ExecStart=/usr/lib/bluetooth/bluetoothd --profile=a2dp,avrcp

But it had no obvious efffect.

By monitoring blueoothctl's DBus calls I see that it uses 'org.bluez.Device1.Connect' to initiate connection to my headset. I tried

$ busctl call org.bluez /org/bluez/hci0/dev_04_52_C7_0C_D4_A7 org.bluez.Device1 ConnectProfile s avrcp

but my headset instead connects with only a2dp profile.

$ busctl call org.bluez /org/bluez/hci0/dev_04_52_C7_0C_D4_A7 org.bluez.Device1 ConnectProfile s hsp

does appear to connect with hsp though. The same results when using UUIDs as the argument (which is described in /usr/share/doc/bluez/dbus-apis/device-api.txt)

Last edited by Brocellous (2021-06-29 06:58:48)

Offline

#2 2020-01-22 23:19:01

clydedroid
Member
Registered: 2020-01-22
Posts: 5

Re: [SOLVED] Connecting volume buttons on bluetooth headphones

Hey @Brocellous, I'm having a similar issue as you, cannot for the life of me to get AVRCP controls to work. Did you ever end up finding a solution?

Offline

#3 2020-01-23 19:58:01

Brocellous
Member
Registered: 2017-11-27
Posts: 145

Re: [SOLVED] Connecting volume buttons on bluetooth headphones

@cycledroid I don't have a solution, no.

Offline

#4 2020-02-25 21:01:35

LagradOst
Member
Registered: 2019-07-14
Posts: 4

Re: [SOLVED] Connecting volume buttons on bluetooth headphones

@cycledroid the controls using the middle button or the volume buttons? If the former, use sxhkd and the following config (provided you have playerctl installed)

XF86Audio{Play,Prev,Next}
        playerctl {play-pause,previous,next}

Offline

#5 2021-06-29 06:57:48

Brocellous
Member
Registered: 2017-11-27
Posts: 145

Re: [SOLVED] Connecting volume buttons on bluetooth headphones

Hardware volume now works by default with pipewire + pipewire-media-session 0.31. Marking this solved.

Last edited by Brocellous (2021-06-29 06:59:40)

Offline

Board footer

Powered by FluxBB