INTERACT FORUM

More => Old Versions => JRiver Media Center 23 for Linux => Topic started by: Rizlaw on June 22, 2017, 07:32:17 pm

Title: Dedicated media keys on Corsair and Logitech keyboards still don't work for Linu
Post by: Rizlaw on June 22, 2017, 07:32:17 pm
I had hoped, by now, that the dedicated media keys on my Logitech (and new Corsair) keyboards would work. They don't. Does this have something to do with total lack of MPRIS support.

Also, what is best way to transfer all my settings from MC22 to MC23.0.10 beta? The MC23 Restore Library function doesn't work for me. Tried to restore my latest MC22 backup zip file to MC23 and no zip files were displayed using MC23's restore library function. There are about a dozen backup zip files for MC22 in the folder in question, but they aren't visible under MC23..  MY BAD, it works. I apparently changed the location of the backup folder from the default location. Found it. Everything is hopefully now fully restored.

Finally, what is best way to upgrade my Master License from 22 to 23?
Title: Re: Dedicated media keys on Corsair and Logitech keyboards still don't work for Linu
Post by: bob on June 26, 2017, 12:03:36 pm
I had hoped, by now, that the dedicated media keys on my Logitech (and new Corsair) keyboards would work. They don't. Does this have something to do with total lack of MPRIS support.

Also, what is best way to transfer all my settings from MC22 to MC23.0.10 beta? The MC23 Restore Library function doesn't work for me. Tried to restore my latest MC22 backup zip file to MC23 and no zip files were displayed using MC23's restore library function. There are about a dozen backup zip files for MC22 in the folder in question, but they aren't visible under MC23..  MY BAD, it works. I apparently changed the location of the backup folder from the default location. Found it. Everything is hopefully now fully restored.

Finally, what is best way to upgrade my Master License from 22 to 23?
You are correct that MC doesn't support MPRIS at this time but it does support standard media keys that are part of the X protocol.

Master license upgrade:
https://jriver.com/purchase_23_master_as_upgrade.html
Title: Re: Dedicated media keys on Corsair and Logitech keyboards still don't work for Linu
Post by: Rizlaw on June 26, 2017, 09:09:37 pm
Thanks for the upgrade link Bob.

Both my Corsair and Logitech keyboards media keys work fine under Linux with several other Linux media players that support dedicated media keys (i.e., quod libet, gmusicbrowser, deadbeef and guayadeque). So, I'm not sure I understand what you mean by your statement that MC supports "standard media keys that are part of the X protocol".
Title: Re: Dedicated media keys on Corsair and Logitech keyboards still don't work for Linu
Post by: bob on June 27, 2017, 09:03:00 am
Thanks for the upgrade link Bob.

Both my Corsair and Logitech keyboards media keys work fine under Linux with several other Linux media players that support dedicated media keys (i.e., quod libet, gmusicbrowser, deadbeef and guayadeque). So, I'm not sure I understand what you mean by your statement that MC supports "standard media keys that are part of the X protocol".
MC is written to talk to the XServer at a very low level to allow us to do things like our own skinning. We do all of the interface without using any toolkits (unlike the players you mentioned above). The XServer supports several media keys without any add-ons such as MPRIS. We support those keys and so should any desktop/window manager.

Code: [Select]
#define XF86XK_AudioLowerVolume 0x1008FF11   /* Volume control down        */
#define XF86XK_AudioMute 0x1008FF12   /* Mute sound from the system */
#define XF86XK_AudioRaiseVolume 0x1008FF13   /* Volume control up          */
#define XF86XK_AudioPlay 0x1008FF14   /* Start playing of audio >   */
#define XF86XK_AudioStop 0x1008FF15   /* Stop playing audio         */
#define XF86XK_AudioPrev 0x1008FF16   /* Previous track             */
#define XF86XK_AudioNext 0x1008FF17   /* Next track                 */
#define XF86XK_AudioPause 0x1008FF31   /* Pause audio playing        */

Are the media keys we support.
If for some reason your system is messing with the mapping you can create a custom configuration thusly:

Run the `xev' program to determine the keycode for your media key (for example, Volume up)

    KeyPress event, serial 36, synthetic NO, window 0x1600001,
    root 0xd3, subw 0x0, time 487764, (115,96), root:(602,116),
    state 0x0, keycode 123 (keysym 0x1008ff13, XF86AudioRaiseVolume), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False


Yours will likely have something like: keysym 0x0, NoSymbol in place of the proper keysym 0x1008ff13, XF86AudioRaiseVolume seen above so you need to map it.

Create a file in your home directory. For example .Xmodmap with the following (adding any others you want to map in the same way):

keycode 123 = XF86AudioRaiseVolume

Invoke it by doing:

xmodmap ~/.Xmodmap

You can do that permanently by putting it in your .bash_profile or .profile so it gets run when you log in or in the Xstartup.


Title: Re: Dedicated media keys on Corsair and Logitech keyboards still don't work for Linu
Post by: Rizlaw on June 27, 2017, 11:42:44 am
Thanks Bob for the X server explanation. I tried what you suggested.
While I get something meaningful - that looks like what you typed out - with normal keyboard keys (i.e., up, down, left, right arrow keys, etc), when I tried the dedicated Corsair keyboard media keys I got info that looked nothing like your example and was more or less gibberish to me (mostly a lot of zeros). For example, when I pressed the dedicated media key "Stop" playing I got something like the following:

Code: [Select]
FocusIn event, serial 36, synthetic NO, window 0x5000001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 36, synthetic NO, window 0x0,
    keys:  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

I'm not certain I copied the correct lines because it looks nothing like you're suggesting.
Title: Re: Dedicated media keys on Corsair and Logitech keyboards still don't work for Linu
Post by: bob on June 27, 2017, 11:58:46 am
Thanks Bob for the X server explanation. I tried what you suggested.
While I get something meaningful - that looks like what you typed out - with normal keyboard keys (i.e., up, down, left, right arrow keys, etc), when I tried the dedicated Corsair keyboard media keys I got info that looked nothing like your example and was more or less gibberish to me (mostly a lot of zeros). For example, when I pressed the dedicated media key "Stop" playing I got something like the following:

Code: [Select]
FocusIn event, serial 36, synthetic NO, window 0x5000001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 36, synthetic NO, window 0x0,
    keys:  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

I'm not certain I copied the correct lines because it looks nothing like you're suggesting.
I'm not certain but it looks to me like something is intercepting those keys. Perhaps MPRIS? Seems to me that it should still generate the keypress and release events in addition to the keymap notify event....
Title: Re: Dedicated media keys on Corsair and Logitech keyboards still don't work for Linu
Post by: mwillems on June 29, 2017, 08:27:44 pm
IME, most big desktop environments (like Gnome, Unity. or KDE) completely swallow and redirect all media keys, so unless the X program is talking to the desktop environment via MPRIS or dbus the program will never see the keypresses.  This has been a fairly large roadblock in my own attempts to get remote control working on Gnome-based linux installs and I've never found a perfect answer (other than writing an MPRIS wrapper for MC via MCWS, but I'm nowhere close to done with that).

Stop has been one fo the keys I've had a particularly hard time with FWIW.
Title: Re: Dedicated media keys on Corsair and Logitech keyboards still don't work for Linu
Post by: bob on June 30, 2017, 01:55:51 pm
IME, most big desktop environments (like Gnome, Unity. or KDE) completely swallow and redirect all media keys, so unless the X program is talking to the desktop environment via MPRIS or dbus the program will never see the keypresses.  This has been a fairly large roadblock in my own attempts to get remote control working on Gnome-based linux installs and I've never found a perfect answer (other than writing an MPRIS wrapper for MC via MCWS, but I'm nowhere close to done with that).

Stop has been one fo the keys I've had a particularly hard time with FWIW.
Probably why I don't notice it. It works fine in XFCE.
This might be possible some day but there are lots of things more import in front of it.

Title: Re: Dedicated media keys on Corsair and Logitech keyboards still don't work for Linu
Post by: mwillems on July 09, 2017, 06:54:04 pm
Probably why I don't notice it. It works fine in XFCE.
This might be possible some day but there are lots of things more import in front of it.

Hey bob, can you confirm that it's working for you on xfce4 on debian stretch?  I just did a test install of stretch with xfce4 to see if I could resolve my remote control woes, and it seems to swallow the same keys that Gnome did (which makes sense as I think xfce now uses MPRIS as well).  There may be an easy way to turn it off as I haven't used Xfce4 in a few years, but I just wanted to confirm we weren't talking about entirely different xfce4 versions before I spent more time on it.
Title: Re: Dedicated media keys on Corsair and Logitech keyboards still don't work for Linu
Post by: bob on July 11, 2017, 09:02:00 am
Hey bob, can you confirm that it's working for you on xfce4 on debian stretch?  I just did a test install of stretch with xfce4 to see if I could resolve my remote control woes, and it seems to swallow the same keys that Gnome did (which makes sense as I think xfce now uses MPRIS as well).  There may be an easy way to turn it off as I haven't used Xfce4 in a few years, but I just wanted to confirm we weren't talking about entirely different xfce4 versions before I spent more time on it.
Will do, I've not installed stretch yet but it's on the list.
Title: Re: Dedicated media keys on Corsair and Logitech keyboards still don't work for Linu
Post by: mwillems on August 26, 2017, 06:29:10 pm
Will do, I've not installed stretch yet but it's on the list.

Hey bob any update on this?  I still can't get MC on stretch to receive certain remote keypresses ("Stop" in particular always fails, but some others do too).  You had mentioned that all media keys were working normally for you on xfce4 on jessie, but I was curious if things were any different for you on stretch.
Title: Re: Dedicated media keys on Corsair and Logitech keyboards still don't work for Linu
Post by: bob on August 28, 2017, 04:14:06 pm
Hey bob any update on this?  I still can't get MC on stretch to receive certain remote keypresses ("Stop" in particular always fails, but some others do too).  You had mentioned that all media keys were working normally for you on xfce4 on jessie, but I was curious if things were any different for you on stretch.
Play/Pause, Stop, Previous Track, Next Track all work for me, Stretch and XFCE4.
Volume up/down and mute all get intercepted by the DM.
Title: Re: Dedicated media keys on Corsair and Logitech keyboards still don't work for Linu
Post by: imeric on August 17, 2018, 03:49:49 pm
Playing with this in Kubuntu and it's not working. I have a Dell Keyboard and I see the proper codes as per above in xev.  Media Keys work with VLC...How do I fix this?

thx