zsszatmari / MagicKeys

This is a preference pane for Mac OS X 10.7+ that enables hardware media keys (prev, play, next) to be routed to 3rd-party sandboxed applications in a nice way, without unwanted side effects. This has been specifically created with G-Ear, a native Google Music player for Mac in mind, but any suggestion or patch is welcome!
http://www.treasurebox.hu/magickeys
109 stars 15 forks source link

Bluetooth headphone controls not working? #3

Open rameshdharan opened 10 years ago

rameshdharan commented 10 years ago

Hi, wasn't sure if the new headphone controls commit applied to bluetooth headsets as well. At any rate I tried the latest version (1.4) and pressing the play/pause button on my bluetooth headset still starts iTunes.

zsszatmari commented 9 years ago

Hi, I wasn't sure either, since I have no such headset. So in this case, I will need your help. Thank You for getting back to me!

Does your headset work with iTunes? Did it work out of the box, or you had to install something? (a driver, or an utility?) Could you please try this test app? http://treasurebox-gear.s3.amazonaws.com/HIDDeviceTest.zip Question is, on the Mikeys pane, do you have an option in the pulldown menu for your headset? What is it's name? If you select it then try tampering with the controls, what do you see in the box below the pulldown? If you don't have an option for your headset, try selecting Apple Mikey HID Driver instead, again, what do you see in the box?

Thanks again!

petermnt commented 9 years ago

Hi, I'm not the original poster but I'd like to give my input because I just got my new bluetooth headphones and I really miss my G-Ear media buttons. (Thanks for the inline headphones remote in the previous release though, sadly I was only able to use it for a couple of weeks until I got new headphones :))

I checked the app and in the Mikeys pane there is no option for the device nor an Apple Mikey HID Driver option (when I plug in my wired headset there is an Apple Mikey HID Driver)

In general Bluetooth media buttons all use the same system. They do work in iTunes and there is no need to install any driver or utility.

While searching for a solution I found a small utility that fixes it for Spotify. I'm no Objective-C hero but looking at the code it seems fairly straight forward and it should be possible to implement a similar solution in MagicKeys. This is the relevant file: https://github.com/jguice/mac-bt-headset-fix/blob/master/Spotify%20Bluetooth%20Headset%20Listener/KDMAppDelegate.m

Sadly I can't help with the actual implementation, but I hope this puts you on the right track. You can always contact me if you want me to test a 'beta' version of MagicKeys to see if the bluetooth functionality works.

rameshdharan commented 9 years ago

Hi, sorry for the delay in responding.

I tried the HIDDeviceTest app but it crashes immediately on startup. It appears to be due to requesting exclusive access to the device? Not sure if there's something else I can/should be doing to stop that? See below. I tried pausing all music playing and also even just disconnecting the bluetooth headphones but it always crashes.

Meanwhile as @frus noted above, I don't have any device option shown when my bluetooth headset is connected. Let me know if there's anything else I can help with!

Application Specific Information: ** Terminating app due to uncaught exception 'NSXError', reason: 'Error Domain=NSMachErrorDomain Code=-536870203 "The operation couldn’t be completed. (Mach error -536870203 - (iokit/common) exclusive access and device already open)" UserInfo=0x6080002e3c80 {reportingLine=219, reportingMethod=-[DDHidDevice openWithOptions:], reportingFile=/Users/zsszatmari/projects/DDHidLib/lib/DDHidDevice.m, origin=(mDeviceInterface)->open(mDeviceInterface, options)}' terminating with uncaught exception of type NSException abort() called

smarek commented 9 years ago

I can confirm this issue with 1.4.2 version, is it worth anything to try posted HIDDeviceTest or not?

zsszatmari commented 9 years ago

Yes, sure, there are many kinds of BT devices, more data is better! Thank You!

smarek commented 9 years ago

@treasurebox so I've tried, Mikeys doesn't show anything for my Philips SHB7150FB will trigger iTunes on Play/Pause button, and even if I unload /System/Library/LaunchAgents/com.apple.rcd.plist service it shows nothing.

I've tried to integrate https://github.com/jguice/mac-bt-headset-fix/ But the NSKeyDownMask global listener returns nothing. You can see my effort here: https://github.com/smarek/MagicKeys/commit/1fd2694c66371be839bd6d2e25bc355f634213fb

zsszatmari commented 9 years ago

Thanks! It might be that it does not work with your BT headphones, but works with @frus 's one. @frus : Does mac-bt-headset-fix still work with Yosemite? (I assume @smarek you've tried with Yosemite now)