PDA

View Full Version : P&H Play on Apple Remote


mmmfishies
2008-12-31, 23:32
I apologize if I've missed something, but I'm not able to get XBMC to recognize and map P&H Play on the Apple remote. I'm using the latest released XBMC Atlantis on OS 10.5.6 and it looks like P&H Play is sending a "35_" keycode (from XBMCHelper's output). Here's the output when XBMCHelper starts up:


XBOX360: Registering for notifications.
initializing apple remote
uninitializing apple remote
deleting commands map
udp socket (3) opened
Using key code for OSX 10.5
Registering command 21_
Registering command 22_
Registering command 23_
Registering command 29_
Registering command 30_
Registering command 4_
Registering command 3_
Registering command 18_
Registering command 20_
Registering command 20_30_
Registering command 20_21_22_
Registering command 20_21_23_
Registering command 20_21_29_
Registering command 20_21_30_
Registering command 20_21_21_
Registering command 20_29_21_
Registering command 20_29_23_
Registering command 20_29_22_
Registering command 20_29_29_
Registering command 20_29_30_
universal mode off.
key down: 35_
key down: 30_
Sending command for Key (30_)
key up: 30_
sending key-up event


The first "key down' line is where I pressed and held the Play button, and the second is from hitting the "-"/down button. All of the other buttons (including the P&H variants) work fine. I tried to modify Keymap.xml to reference some additional button IDs (11 & 12), but it doesn't seem to have made any difference. The XBMC log indicates that it's successfully loading my Keymap.xml file, so I assume that my changes are active. The mapping for button ID 7 (which the comments indicate is P&H Play) is still in the keymap. The same thing happens on a new MBP and an older Mac Mini.

With only 12 combinations, I'm really missing this one :)

Thanks,
Rob

mmmfishies
2009-01-01, 03:19
I fixed this, but I'll let you guys determine whether it's "right" or not. Here's the diff:


Index: AppleRemote.cpp
================================================== =================
--- AppleRemote.cpp (revision 16801)
+++ AppleRemote.cpp (working copy)
@@ -42,7 +42,8 @@
IR_RightHold,
IR_LeftHold,
IR_Menu,
- IR_MenuHold
+ IR_MenuHold,
+ IR_PlayHold
};
enum {
IR_Event_Term_ATV1X = 5,
@@ -62,7 +63,8 @@
"4_",
"3_",
"5_",
- "7_"
+ "7_",
+ "18_"
};
// magic HID key cookies AppleTV running r2.0x
static std::string key_cookiesATV20X[] =
@@ -76,6 +78,7 @@
"3_",
"7_",
"5_",
+ "18_"
};
"4_",
"8_",
- "6_"
+ "6_",
+ "19_"
};
// magic HID key cookies for 10.4
static std::string key_cookies10_4[] =
@@ -101,7 +105,8 @@
"4_",
"3_",
"5_",
- "7_"
+ "7_",
+ "18_"
};

// magic HID key cookies for 10.5
@@ -115,7 +120,8 @@
"4_",
"3_",
"18_",
- "20_"
+ "20_",
+ "35_"
};

AppleRemote::AppleRemote() :m_bVerbose(false),
@@ -264,8 +270,8 @@
RegisterCommand(key[IR_Left], new CPacketBUTTON(3, "JS0:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE));
RegisterCommand(key[IR_Up], new CPacketBUTTON(1, "JS0:AppleRemote", BTN_DOWN));
RegisterCommand(key[IR_Down], new CPacketBUTTON(2, "JS0:AppleRemote", BTN_DOWN));
- RegisterCommand(key[IR_RightHold], new CPacketBUTTON(4, "JS0:AppleRemote", BTN_DOWN));
- RegisterCommand(key[IR_LeftHold], new CPacketBUTTON(3, "JS0:AppleRemote", BTN_DOWN));
+ RegisterCommand(key[IR_RightHold], new CPacketBUTTON(10, "JS0:AppleRemote", BTN_DOWN));
+ RegisterCommand(key[IR_LeftHold], new CPacketBUTTON(9, "JS0:AppleRemote", BTN_DOWN));

// looks like this is what triggers when menu is held down (?)
RegisterCommand(key[IR_Menu], new CPacketBUTTON(8, "JS0:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE));
@@ -273,6 +279,9 @@
// Menu Hold will be used both for sending "Back" and for starting universal remote combinations (if universal mode is on)
RegisterCommand(key[IR_MenuHold], new CPacketBUTTON(6, "JS0:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE));

+ // Press and Hold the Play button
+ RegisterCommand(key[IR_PlayHold], new CPacketBUTTON(7, "JS0:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE));
+
// Universal commmands:
RegisterCommand(key[IR_MenuHold] + key[IR_Down], new CPacketBUTTON("Back", "R1", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE));


And here are my keymap settings for full-screen video:


<keymap>
<global>
<joystick name="AppleRemote">
<!-- plus --> <button id="1">Up</button>
<!-- minus --> <button id="2">Down</button>
<!-- left --> <button id="3">Left</button>
<!-- right --> <button id="4">Right</button>
<!-- play/pause --> <button id="5">Select</button>
<!-- menu --> <button id="6">PreviousMenu</button>
<!-- hold play --> <button id="7">Stop</button>
<!-- hold menu --> <button id="8">ContextMenu</button>
</joystick>
</global>

<FullscreenVideo>
<joystick name="AppleRemote">
<button id="1">CodecInfo</button>
<button id="2">SmallStepBack</button>
<button id="3">BigStepBack</button>
<button id="4">BigStepForward</button>
<button id="5">Pause</button>
<button id="6">OSD</button>
<button id="8">Info</button>
<button id="9">Rewind</button>
<button id="10">FastForward</button>
</joystick>
</FullscreenVideo>
</keymap>


It looked like P&H left and right weren't given unique button IDs, so I changed that, too. I only tested it with 10.5, but I followed what I took the comments to mean and added the "SelectHold" values to the other tables, too.

Rob

jmarshall
2009-01-05, 08:27
Thanks - I've created a trac ticket and assigned it to Scott for review.

http://xbmc.org/trac/ticket/5593

Cheers,
Jonathan

davilla
2009-01-05, 18:20
I'll look into this when I get a chance.