How to read data from serial-connected Bluetooth headphones?












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.










share|improve this question

























  • 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
















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.










share|improve this question

























  • 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














1












1








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.










share|improve this question
















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.







windows usb audio bluetooth serial-port






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 days ago







András Geiszl

















asked Jan 24 at 16:48









András GeiszlAndrás Geiszl

63




63













  • 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



















  • 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

















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





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





@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





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







@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





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










0






active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1397998%2fhow-to-read-data-from-serial-connected-bluetooth-headphones%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1397998%2fhow-to-read-data-from-serial-connected-bluetooth-headphones%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

Mangá

 ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕