I have an LG Tone (HBS 700) Bluetooth stereo headset, and am using it with OS X Lion.

The headset has a play/pause toggle button, but unlike my keyboard's play button, which will toggle play/pause for, say, VLC media player if it is running, the headset's play button will launch iTunes if it is not already open, or toggle play/pause in iTunes if it is already open. It will not toggle play/pause in any other media player.

Can someone explain what system event is likely being triggered when I press play? It's clear that some system daemon is listening for something, since iTunes gets launched and can interpret the play/pause/next/prev controls just fine... Is there a way I can intercept the keypress event and remap its function? I would like it to have the same behavior as the keyboard's play button.

Thanks for your help!

up vote 7 down vote accepted

You are looking for the Remote Control Daemon located in:

/System/Library/CoreServices/rcd.app

It can be disabled with the command

sudo chmod a-x /System/Library/CoreServices/rcd.app/Contents/MacOS/rcd
killall -9 rcd

(If you just kill it, launchd will restart it again). To re-enable it,

sudo chmod a+x /System/Library/CoreServices/rcd.app/Contents/MacOS/rcd

Then log out and back in to make launchd start it.

If you are ambitions enough, you may try editing it with a hex editor. This is outside of my realm of knowledge, but I do have two suggestions.

  1. Opening up quicktime (just blank, nothing in it) in the background may prevent the daemon from using iTunes. It depends on whether your device uses the same system event.

  2. Alternatively, there is a free utility located at the following link which patches the daemon for you. After running it, the daemon will use the active program, instead of iTunes. However, this will not remap VLC as the program to be opened when you press play. It is designed for the keyboard media keys, but I believe the OS sees your LG Tone's button as the same system event. That link: http://lifehacker.com/5651055/free-your-macs-media-keys-from-itunes-no-manual-hacking-required

Finally, I can tell you that Apple has not yet provided a simple way to change remote control settings. This is unfortunate, as this is a common question regarding the media keys on keyboards and other controls on devices such as yours. Rather than provide a solution, it seems that they have made changes to the OS in the past to ensure iTunes is the program used by this daemon. Unfortunately, there is unlikely to be a better fix than these soon.

  • 3
    In my experience, bluetooth devices sending play/pause signals are not interpreted in the same way keyboard media keys are interpreted. Using the mentioned patch, my keyboard behaves as expected, yet my bluetooth headset continues to launch iTunes. Just thought I'd not this for posterity's sake. – Wilco Aug 20 '13 at 22:26
  • Any advise how to make this change in OS X Sierra? They have os protection system, and it's quite hard to make such changes. – A B Jun 22 '17 at 23:07

First you will need a third party keyboard-remapping application called Karabiner (formerly KeyRemap4MacBook). The application is a bit user unfriendly but in theory you only need to do this once. Also it currently doesn't work on MacOS Sierra...so keep that in mind.

Here we go...

Install Karabiner

https://pqrs.org/osx/karabiner/index.html.en

Run Karabiner

You should give it some accessibility permissions if you want all the features.

Use the Helper Application "EventViewer" to get keycodes

Open the EventViewer to get keycodes/application/device ids:

enter image description here

Go to the Main tab and then press the key(s) on your keyboard, bluetooth remote, etc you want to re-map. In this case you can see keycodes for Media-Forward and Media-Back on my Satechi bluetooth remote (which I want to re-map to arrow keys left/right).

enter image description here

Go ahead and "copy to pasteboard" and paste it in a text document for later. Now depending on your use case you may go to the App or the Devices tab.

If you want to limit your key remapping to specific applications, then you will want to create a mapping rule that is for a specific application ID (e.g. google chrome). So you would go to the app tab and get the application ID for your application of interest (to be used later when we create the rule).

enter image description here

In my case I ONLY want to remap these keys on my Satechi bluetooth remote and don't want to mess up how my existing keyboard keys work...so I want to make a device specific rule. So I go to the Devices tab.

enter image description here

Note!!! For apps and devices, you should also copy and paste into a text file so you have the complete device/app id strings for use in our rule.

Building the rules

Now that you have keycodes, app and/or device ids copied and pasted into a text file for reference later, you can close the EventViewer and go back to the main app.

The default rules aren't very interesting to us, so we need to create a custom rule but editing private.xml

enter image description here

This will just launch a finder window showing private.xml. Go ahead and open private.xml in your favorite text editor.

Now you are ready to build rules...

Documentation on the format of this file is here: https://pqrs.org/osx/karabiner/xml.html.en

For each <item> you need minimum <name> <identifier> and <autogen>. Name is just a name for you. Identifier is also made up by you but should be unique. autogen is where you specify the rule/mapping (ie key of interest should send keys foo bar).

Of further interest you can specify the rule only runs for specific active applications (I think this is where the MacOS Accessibility permissions come into play...so Karabiner can determine the active window). This is done with <only>.

Also of interest (to me) is <device_only> which allows me to make a rule only for a specific keyboard (ie my satechi bluetooth remote). See the link above for more details.

Anyway. Use the keycode IDs, device IDs and application ids you got from the EventViewer to construct your custom rules.

Mine looks like this:

<?xml version="1.0"?>
<root>
    <item>
        <name>Satechi Right</name>
        <identifier>private.satechi.right</identifier>
        <device_only>DeviceVendor::RawValue::0x05ac,DeviceProduct::RawValue::0x023c</device_only>
        <autogen>__KeyToKey__ ConsumerKeyCode::MUSIC_NEXT_17, KeyCode::CURSOR_RIGHT</autogen>
    </item>
    <item>
        <name>Satechi Left</name>
        <identifier>private.satechi.left</identifier>
        <device_only>DeviceVendor::RawValue::0x05ac,DeviceProduct::RawValue::0x023c</device_only>
        <autogen>__KeyToKey__ ConsumerKeyCode::MUSIC_PREV_18, KeyCode::CURSOR_LEFT</autogen>
    </item>
</root>

Summary: 2 rules. Satechi bluetooth remote device only. "next" media button maps to right arrow, "prev" media button to left arrow. Applies to all applications.

Load the rules

Save your XML file. Go back to the Karabiner app. Go to the "Change Key" tab. Click "Reload XML" in the top left. Your new rules should now show up. Check the boxes to enable the rules. Test that your new key mappings work as expected.

enter image description here

The app is definitely not user friendly but enabled me to setup exactly what I wanted pretty easily once I understood the options. Karabiner is a bit buggy...I had some events stop showing up in the event viewer even though the remapping rules were still working... restart helps.

  • It appears that the successor to Karabiner, Karabiner-Elements, which is a required upgrade for more recent versions of MacOS, doesn't see Bluetooth media device controls. The new EventViewer doesn't register such button presses at all, but iTunes still starts anyway. :( – wfaulk Sep 5 at 21:02

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.