1

My Bluetooth headphones' (connected using a USB dongle) play/pause button doesn't work with Windows 10 (the volume changers work just fine), so I tried to remap the key, it gets, to the media play/pause button.

First I tried with AHKHID, and used the examples to find out what HID device is connected. That just showed the keyboard and mouse. So I looked more into Bluetooth devices and wrote a program to get the available Bluetooth services running on the headphones. The 3 services it could find was SPP, HSP and HFP. From these, SPP looked like the most promising, as Wikipedia states

It emulates a serial cable to provide a simple substitute for existing RS-232, including the familiar control signals. It is the basis for DUN, FAX, HSP and AVRCP.

I knew that AVRCP should be the one the controls are sent with, so this must be the one the play/pause signal is coming from. I looked at the serial COM ports available on my computer and found that it uses COM3 for incoming and COM4 for outgoing communication with the headphones.

Now this is where I got stuck. I tried to connect to the SPP service running on the headphones programatically, which worked (didn't throw any errors), but the input data event didn't fire and the stream read timed out.

I also tried to inspect the serial data with Serial Port Monitor (the trial version), but it doesn't show anything except when I click open or close, it shows a bunch of setup messages.

What can the problem be? Is Windows using it and so it prevents other programs from accessing it (or empties the stream before others could see it)? Or am I doing something completely wrong?

Any ideas?

Edit:

Meanwhile I installed the native Spotify app for Windows and it detects the button presses just fine. As this was my main goal with this research, I won't look more into it, but it would be interesting to know where it gets the button presses from and why it doesn't work for other apps.

  • You are correct abolut AVRCP. Unfortunately without AVRCP it is not possoble to control anything. SPP on your device is probably for firmware updates or something like that. It doe snot look possible to transfer control from your device. However try to check it using any application that connects to your device using SPP without any COM poirts (directly). – Mike Petrichenko Jan 24 at 17:43
  • @MikePetrichenko My device supports AVRCP (on both ends) and the volume control works, so there must be something being sent. I just don't know where and how to access it. Is it possible to connect to SPP directly? Do you know any example of an application that does that? – András Geiszl Jan 24 at 17:55
  • You wrote that there is onlt HFP, HSP and SPP. No AVRCP. Volume control is supported by HFP and HSP without any problem. AVRCP is designed for other media control (play/pause and others). So even your device can control volume it does not mean that it supports AVRCP. Any SPP application on Android should be good for testing. – Mike Petrichenko Jan 24 at 18:30
  • @MikePetrichenko I don't understand. My headphones are Jaybird X4 and the Bluetooth dongle is ASUS USB-BT400. Both support AVRCP. How can it be that they don't use it then? Is Microsoft Bluetooth stack messing things up? I could imagine that the SDP request I sent somehow doesn't return the AVRCP service, but the controls work with mobile devices, so it definitely has AVRCP. – András Geiszl Jan 25 at 9:34
  • You wrote: "The 3 services it could find was SPP, HSP and HFP.". As you wrote there is no AVRCP. Easy to check. Download any Android app that allows to show Bluetooth services (there are tons on Google Play) and check which services it supports. About SPP: I should repeat, you can nopt control your PC using SPP profile. The SPP there probably for firmware update. Or for something else, but not for control. – Mike Petrichenko Jan 25 at 10:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.