keymap confusion: Modifiers are being processed as separate key presses?
#1
I'm using the Ortek MCE remote with the Amazon FireTV and the Gotham release, and the basics are working fine but when I try to add additional control for the "extra" buttons the commands seem to be ignored. When I turn on xbmc debug I see it processing the ctrl/shift as separate keystrokes rather than as modifiers. If I use an actual keyboard I'm seeing the same behavior. Am I misunderstanding this or is there a bug here?

For example, if I hit the remote key that sends ctrl+m, or if I type an actual ctrl+m on a keyboard it is processed as follows. It seems to be doing the action for "m" rather than the one defined for ctrl+m. This is the same result I get if I just type "m" by itself.

00:12:54 T:1525594024 DEBUG: Keyboard: scancode: 0x71, sym: 0x0132, unicode: 0x0000, modifier: 0x0
00:12:54 T:1525594024 DEBUG: bool CApplication::OnKey(const CKey&): leftctrl (0xf0d0) pressed, action is
00:12:54 T:1525594024 DEBUG: Keyboard: scancode: 0x29, sym: 0x006d, unicode: 0x0000, modifier: 0x0
00:12:54 T:1525594024 DEBUG: bool CApplication::OnKey(const CKey&): m (0xf04d) pressed, action is ActivateWindow(PlayerControls)
00:12:54 T:1525594024 DEBUG: Activating window ID: 10114

For reference in case it matters, I'm trying to add commands like this to my keymap in keyboard.xml:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<keymap>
    <global>
        <keyboard>
            <t mod="ctrl,shift">XBMC.ActivateWindow(MyPrograms)</t>
            <m mod="ctrl">XBMC.ActivateWindow(MyMusic)</m>
            <i mod="ctrl">XBMC.ActivateWindow(MyPictures)</i>
            <e mod="ctrl">XBMC.ActivateWindow(MyVideos)</e>
            <o mod="ctrl">ContextMenu</o>
            <g mod="ctrl">Info</g>
            <t mod="ctrl">OSD</t>
            <m mod="ctrl,shift">PreviousMenu</m>
            etc...

Any ideas what is going wrong here? Is this normal?
Reply
#2
Looks like CTRL handling was overlooked.
Could you try with ALT to see if it works ok in that situation?
Reply
#3
Thanks Koying! Yes, I've just tested using a keyboard and I see that ALT is working correctly, and SHIFT is basically working as well. An interesting exception is that shift+d (for example) is recognized correctly as shift+d, but shift+ctrl+d is recognized as d. Using "d" as an example:

alt+d => alt+d
alt+shift+d => alt+shift+d
alt+shift+ctrl+d => alt+shift+d
ctrl+d => d
shift+d => shift+d
shift+ctrl+d => d
Reply
#4
Strange. Mind providing a log snippet?
Reply
#5
Sure, glad to help in any way. Here's what I get when I press the tv and music icons on the MCE remote (shft+ctrl+t, and ctrl+m). Looking at that I notice it is "leftshift" and "leftctrl". Maybe the "left" part is confusing things?

14:42:30 T:1545825664 DEBUG: Keyboard: scancode: 0x71, sym: 0x0132, unicode: 0x0000, modifier: 0x0
14:42:30 T:1545825664 DEBUG: bool CApplication::OnKey(const CKey&): leftctrl (0xf0d0) pressed, action is
14:42:30 T:1545825664 DEBUG: Keyboard: scancode: 0x3b, sym: 0x0130, unicode: 0x0000, modifier: 0x1
14:42:30 T:1545825664 DEBUG: bool CApplication::OnKey(const CKey&): leftshift (0xf0d2) pressed, action is
14:42:30 T:1545825664 DEBUG: Keyboard: scancode: 0x30, sym: 0x0074, unicode: 0x0000, modifier: 0x1
14:42:30 T:1545825664 DEBUG: bool CApplication::OnKey(const CKey&): t (0xf054) pressed, action is

14:42:31 T:1545825664 DEBUG: Keyboard: scancode: 0x71, sym: 0x0132, unicode: 0x0000, modifier: 0x0
14:42:31 T:1545825664 DEBUG: bool CApplication::OnKey(const CKey&): leftctrl (0xf0d0) pressed, action is
14:42:31 T:1545825664 DEBUG: Keyboard: scancode: 0x29, sym: 0x006d, unicode: 0x0000, modifier: 0x0
14:42:31 T:1545825664 DEBUG: bool CApplication::OnKey(const CKey&): m (0xf04d) pressed, action is ActivateWindow(PlayerControls)

Here's what I get when I press those same two sequences on a keyboard:

14:45:56 T:1545825664 DEBUG: Keyboard: scancode: 0x3b, sym: 0x0130, unicode: 0x0000, modifier: 0x1
14:45:56 T:1545825664 DEBUG: bool CApplication::OnKey(const CKey&): leftshift (0xf0d2) pressed, action is
14:45:56 T:1545825664 DEBUG: Keyboard: scancode: 0x71, sym: 0x0132, unicode: 0x0000, modifier: 0x1
14:45:56 T:1545825664 DEBUG: bool CApplication::OnKey(const CKey&): leftctrl (0xf0d0) pressed, action is
14:45:56 T:1545825664 DEBUG: Keyboard: scancode: 0x30, sym: 0x0074, unicode: 0x0000, modifier: 0x1
14:45:56 T:1545825664 DEBUG: bool CApplication::OnKey(const CKey&): t (0xf054) pressed, action is

14:45:58 T:1545825664 DEBUG: Keyboard: scancode: 0x71, sym: 0x0132, unicode: 0x0000, modifier: 0x0
14:45:58 T:1545825664 DEBUG: bool CApplication::OnKey(const CKey&): leftctrl (0xf0d0) pressed, action is
14:45:59 T:1545825664 DEBUG: Keyboard: scancode: 0x29, sym: 0x006d, unicode: 0x0000, modifier: 0x0
14:45:59 T:1545825664 DEBUG: bool CApplication::OnKey(const CKey&): m (0xf04d) pressed, action is ActivateWindow(PlayerControls)
Reply
#6
I should add the working "alt+shift+d" example:

15:10:52 T:1545825664 DEBUG: Keyboard: scancode: 0x3b, sym: 0x0130, unicode: 0x0000, modifier: 0x1
15:10:52 T:1545825664 DEBUG: bool CApplication::OnKey(const CKey&): leftshift (0xf0d2) pressed, action is
15:10:52 T:1545825664 DEBUG: Keyboard: scancode: 0x39, sym: 0x0134, unicode: 0x0000, modifier: 0x101
15:10:52 T:1545825664 DEBUG: bool CApplication::OnKey(const CKey&): shift-alt-leftalt (0x6f0d4) pressed, action is
15:10:53 T:1545825664 DEBUG: Keyboard: scancode: 0x39, sym: 0x0134, unicode: 0x0000, modifier: 0x101
15:10:53 T:1545825664 DEBUG: bool CApplication::OnKey(const CKey&): shift-alt-leftalt (0x6f0d4) pressed, action is
15:10:53 T:1545825664 DEBUG: Keyboard: scancode: 0x39, sym: 0x0134, unicode: 0x0000, modifier: 0x101
15:10:53 T:1545825664 DEBUG: bool CApplication::OnKey(const CKey&): shift-alt-leftalt (0x6f0d4) pressed, action is
15:10:53 T:1545825664 DEBUG: Keyboard: scancode: 0x20, sym: 0x0064, unicode: 0x0000, modifier: 0x101
15:10:53 T:1545825664 DEBUG: bool CApplication::OnKey(const CKey&): shift-alt-d (0x6f044) pressed, action is
Reply
#7
I started poking around the XBMC source code (hey, never tried that before!), and I found this suspicious section of xbmc/android/activity/AndroidKey.cpp:

Code:
uint16_t modifiers = 0;
  if (state & AMETA_ALT_LEFT_ON)
    modifiers |= XBMCKMOD_LALT;
  if (state & AMETA_ALT_RIGHT_ON)
    modifiers |= XBMCKMOD_RALT;
  if (state & AMETA_SHIFT_LEFT_ON)
    modifiers |= XBMCKMOD_LSHIFT;
  if (state & AMETA_SHIFT_RIGHT_ON)
    modifiers |= XBMCKMOD_RSHIFT;

Looks like ctrl was overlooked in this bit. Is it relevant?
Reply
#8
Well yes, the ctrl problem is quite clear ( https://github.com/xbmc/xbmc/pull/4834 ) Wink

It's the shift+ctrl+d = d rather than = shift+d which was strange.
But I see that ctrl+shift+t properly returns shift+t, so that might have been a testing issue.
Reply
#9
Sweet! Thanks a lot for that prompt fix! Also nice to know I was looking in the right place.

On the shift+ctrl+d thing, maybe I'm just not understanding what it was supposed to show there. I saw output like "shift-alt-d (0x6f044) pressed", so I assumed that my shift+ctrl+d example would have said something like "shift-d pressed" and it only said "d pressed". But I do see that it shows the modifier value correctly so perhaps that is a non-issue.
Reply
#10
I loaded the latest nightly build, and indeed the control key is working great now! Actually I tried every combination of alt/shift/ctrl and everything looked correct. And now using my MCE remote I have access to additional keys, so I'm off to work on my keymap...

Thanks again Koying!
Reply
#11
I'm also using the Ortek VRC1100 MCE remote with an Amazon FireTV with Gotham 13.1. I have successfully remapped most of the buttons using KeyMap Editor to obtain the 61xxx numbers & insert them into my keyboard.xml.

However, when doing this with the extra keys, the 61xxx number changes & does not remain the same. I've used the mapping from post 1 but does not seem to have any effect, regardless if they are remapped in the keyboard.xml or not.

I would like to remap the number keys on the Ortek also. KeyMap Editor doesn't register anything when pressing the number keys. I've obtained the correct commands for these keys by hooking the Ortek to a Win7 PC running ShowKey, and then used these in my keyboard.xml, but am not getting any response.

I notice that you have mentioned something about CTRL being overlooked? I also see that ALT worked? Do I need to change CTRL to ALT in my keyboard.xml, or is the fix deeper than that? Short of installing a nightly (which seemed to fix for toddsay), is there something I could do to my current configuration?. What I have noticed is the keyboard.xml works great with 61xxx numbers, when I can get them.

I've been reading myself stupid with key id's, key codes, decimal, hex, etc, and could really use some help in understanding whats going on here, & how to fix.

Also, Koying, I want to say thanks to you for all your hard work. I've read a lot of posts from you, which were paramount in helping me with Ouya and its passthrough/handshaking issues.
Reply

Logout Mark Read Team Forum Stats Members Help
keymap confusion: Modifiers are being processed as separate key presses?0