More > JRiver Media Center 22 for Linux

Some remote control help, if you please.

<< < (2/4) > >>

bob:
The MCE remote I have works without changing anything for the play button. No more.
The show-key command doesn't exist on wheezy or jessie.

This is what I get:
 ir-keytable
Found /sys/class/rc/rc0/ (/dev/input/event0) with:
   Driver mceusb, table rc-rc6-mce
   Supported protocols: NEC RC-5 RC-6 JVC SONY SANYO LIRC other
   Enabled protocols: NEC RC-5 RC-6 JVC SONY SANYO LIRC other
   Repeat delay = 500 ms, repeat period = 125 ms

ir-keytable  --write /home/bob/keymap --device /dev/input/event0
Wrote 63 keycode(s) to driver

So now I should be able to use the remote for other things, like stop, etc but that doesn't seem to work. I'm assuming the key is getting eaten by the DE but I don't see where to configure that in XFCE.

BTW, looked at the MPRIS stuff a bit.
It would be nice to see example code showing how to integrate that in c++ app at the low level that we are using.

mwillems:

--- Quote from: bob on November 07, 2016, 01:26:48 pm ---The MCE remote I have works without changing anything for the play button. No more.
The show-key command doesn't exist on wheezy or jessie.

--- End quote ---

I think debian calls it showkey and it's part of the kbd package: https://packages.debian.org/jessie/kbd


--- Quote ---This is what I get:
 ir-keytable
Found /sys/class/rc/rc0/ (/dev/input/event0) with:
   Driver mceusb, table rc-rc6-mce
   Supported protocols: NEC RC-5 RC-6 JVC SONY SANYO LIRC other
   Enabled protocols: NEC RC-5 RC-6 JVC SONY SANYO LIRC other
   Repeat delay = 500 ms, repeat period = 125 ms

ir-keytable  --write /home/bob/keymap --device /dev/input/event0
Wrote 63 keycode(s) to driver

So now I should be able to use the remote for other things, like stop, etc but that doesn't seem to work. I'm assuming the key is getting eaten by the DE but I don't see where to configure that in XFCE.

--- End quote ---

Stop is the only major key I haven't been able to get working in Gnome (even after disabling gnome's handling of it), so I feel your pain.  There are a handful of other keys that I don't use that I haven't gotten working either, but I'm not in a hurry to deal with those.  All the other keys worked either after remapping (play, numbers, OK, the green button (sort of)) or once I figured out what the "real" key was in MC (i.e. space for play/pause, backspace for back, right for skip forward, left for skip backward, etc.).  Are there other keys you haven't been able to get working? 

If I were in control of the interface, I would be tempted to take the "easy way out" and associate a "standard" keyboard key with stop (as well as the other special media keys), and remap the remote to send those canonical keys.  So the same way play can be accomplished by sending the play command or pressing "space" with MC focused, stop could be accomplished by sending the stop command or pressing "s" if you take my point.  That way you could skip out on the media key question as it seems like it might be difficult to get those handled without DE integration.


--- Quote ---BTW, looked at the MPRIS stuff a bit.
It would be nice to see example code showing how to integrate that in c++ app at the low level that we are using.

--- End quote ---

I assume you took a look at the spec (https://specifications.freedesktop.org/mpris-spec/latest/), which has some function calls, etc.  If you're looking for actual code to get a sense of what's involved, most of the players that implement it are FOSS, so you can have a look at their code to get a general idea.  Rythymbox has a fairly vanilla implementation, and this looks like a big chunk of it: https://github.com/GNOME/rhythmbox/blob/master/plugins/mpris/rb-mpris-plugin.c

bob:

--- Quote from: mwillems on November 07, 2016, 05:16:49 pm ---I think debian calls it showkey and it's part of the kbd package: https://packages.debian.org/jessie/kbd

Stop is the only major key I haven't been able to get working in Gnome (even after disabling gnome's handling of it), so I feel your pain.  There are a handful of other keys that I don't use that I haven't gotten working either, but I'm not in a hurry to deal with those.  All the other keys worked either after remapping (play, numbers, OK, the green button (sort of)) or once I figured out what the "real" key was in MC (i.e. space for play/pause, backspace for back, right for skip forward, left for skip backward, etc.).  Are there other keys you haven't been able to get working? 

If I were in control of the interface, I would be tempted to take the "easy way out" and associate a "standard" keyboard key with stop (as well as the other special media keys), and remap the remote to send those canonical keys.  So the same way play can be accomplished by sending the play command or pressing "space" with MC focused, stop could be accomplished by sending the stop command or pressing "s" if you take my point.  That way you could skip out on the media key question as it seems like it might be difficult to get those handled without DE integration.

I assume you took a look at the spec (https://specifications.freedesktop.org/mpris-spec/latest/), which has some function calls, etc.  If you're looking for actual code to get a sense of what's involved, most of the players that implement it are FOSS, so you can have a look at their code to get a general idea.  Rythymbox has a fairly vanilla implementation, and this looks like a big chunk of it: https://github.com/GNOME/rhythmbox/blob/master/plugins/mpris/rb-mpris-plugin.c

--- End quote ---
I didn't think rhythmbox was working at all with the MCE remote. I just noticed it does control volume with the arrows (not the volume control).
It's the version on wheezy so it might be too old.

We are capturing the X media keys in our keyboard code which seems to work for keyboards that have media keys. Not sure why the remote shouldn't just emulate those.
Here is the relevant chunk of code that does that mapping...

      case VK_VOLUME_UP:
         bKeyPressed = XKeyPressed(aryKeyStates, XKeysymToKeycode(pDisplay, XF86XK_AudioRaiseVolume));
         break;
      case VK_VOLUME_DOWN:
         bKeyPressed = XKeyPressed(aryKeyStates, XKeysymToKeycode(pDisplay, XF86XK_AudioLowerVolume));
         break;
      case VK_VOLUME_MUTE:
         bKeyPressed = XKeyPressed(aryKeyStates, XKeysymToKeycode(pDisplay, XF86XK_AudioMute));
         break;
      case VK_MEDIA_NEXT_TRACK:
         bKeyPressed = XKeyPressed(aryKeyStates, XKeysymToKeycode(pDisplay, XF86XK_AudioNext));
         break;
      case VK_MEDIA_PREV_TRACK:
         bKeyPressed = XKeyPressed(aryKeyStates, XKeysymToKeycode(pDisplay, XF86XK_AudioPrev));
         break;
      case VK_MEDIA_PLAY_PAUSE:
         bKeyPressed = XKeyPressed(aryKeyStates, XKeysymToKeycode(pDisplay, XF86XK_AudioPlay)) || XKeyPressed(aryKeyStates, XKeysymToKeycode(pDisplay,XF86XK_AudioPause));
         break;
      case VK_MEDIA_STOP:
         bKeyPressed = XKeyPressed(aryKeyStates, XKeysymToKeycode(pDisplay, XF86XK_AudioStop));

mwillems:

--- Code: ---[quote author=bob link=topic=107766.msg748316#msg748316 date=1478621943]
I didn't think rhythmbox was working at all with the MCE remote. I just noticed it does control volume with the arrows (not the volume control).
It's the version on wheezy so it might be too old.

--- End code ---

MPRIS only reached it's modern form about three years ago, so it would be unlikely to be in the wheezy version (which is four years old now); it may not even be fully developed in the jessie version (two years old), but I haven't looked; my testing was with the current version.


--- Quote ---We are capturing the X media keys in our keyboard code which seems to work for keyboards that have media keys. Not sure why the remote shouldn't just emulate those.
Here is the relevant chunk of code that does that mapping...

      case VK_VOLUME_UP:
         bKeyPressed = XKeyPressed(aryKeyStates, XKeysymToKeycode(pDisplay, XF86XK_AudioRaiseVolume));
         break;
      case VK_VOLUME_DOWN:
         bKeyPressed = XKeyPressed(aryKeyStates, XKeysymToKeycode(pDisplay, XF86XK_AudioLowerVolume));
         break;
      case VK_VOLUME_MUTE:
         bKeyPressed = XKeyPressed(aryKeyStates, XKeysymToKeycode(pDisplay, XF86XK_AudioMute));
         break;
      case VK_MEDIA_NEXT_TRACK:
         bKeyPressed = XKeyPressed(aryKeyStates, XKeysymToKeycode(pDisplay, XF86XK_AudioNext));
         break;
      case VK_MEDIA_PREV_TRACK:
         bKeyPressed = XKeyPressed(aryKeyStates, XKeysymToKeycode(pDisplay, XF86XK_AudioPrev));
         break;
      case VK_MEDIA_PLAY_PAUSE:
         bKeyPressed = XKeyPressed(aryKeyStates, XKeysymToKeycode(pDisplay, XF86XK_AudioPlay)) || XKeyPressed(aryKeyStates, XKeysymToKeycode(pDisplay,XF86XK_AudioPause));
         break;
      case VK_MEDIA_STOP:
         bKeyPressed = XKeyPressed(aryKeyStates, XKeysymToKeycode(pDisplay, XF86XK_AudioStop));

--- End quote ---

It's interesting that your keyboard media keys work, the media keys on my keyboard do not work for me with JRiver and Gnome.  The volume keys do work, but they work because the DE (Gnome) is intercepting them and adjusting the system volume.  The volume buttons (keyboard or remote) don't change the MC volume at all, and none of the other keyboard media keys work.  I need to spend some more time testing various DE's to get a sense of what's eating the presses, but I can confirm that 1) Something is swallowing the media keys (probably Gnome in my case), and 2) they seem to get passed through just fine to MPRIS compatible players (i.e. rhythmbox, lollypop, banshee, etc.). 

That's probably because MPRIS is the main way that the "heavy" DEs (Gnome, KDE, Cinnamon) communicate with media players via dbus.  This makes sense as the DE's need to be able to handle (say) the volume keys outside of the mediaplayer context so they need them.  I think XFCE even uses MPRIS via dbus at this point, but I don't know for sure (e.g. it looks as though it might here: https://gist.github.com/jbonney/5743509).

So it seems like possible solutions are to:

1) To globally disable the DE's media key handling (which I haven't been able to do with Gnome, and would not be ideal for many users even if you could)
2) To expose an MPRIS control framework which would solve things for some major DEs, but I'm sure there are DEs that don't actually support MPRIS (LXDE, etc.), or
3) Pair media commands with "regular" keystrokes, which would require custom remote mapping, but would work in all DEs (no DE swallows the "s" key for example). I know this is how, for example, Myth TV handled a few troublesome media keys. 

Just thinking out loud.

bob:
Thanks, I appreciate your thoughts...

The code from Rhythmbox seems to need gtk.
We aren't a gtk app (though we use the file chooser in places, it's basically tacked on only there).

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version