You are not logged in.

#1 2016-03-26 21:14:56

soapy
Member
Registered: 2016-03-26
Posts: 3

[SOLVED] Multimedia Keys

I've been trying to get some multimedia keys to work but I'm failing and am currently lost.
Volume down/up and mute work, but pause/stop next/previous don't.
I used evtest to see what keycode my keys are and i got this output:

 Event: time 1459024006.197503, -------------- SYN_REPORT ------------
Event: time 1459024009.589460, type 4 (EV_MSC), code 4 (MSC_SCAN), value c00cd
Event: time 1459024009.589460, type 1 (EV_KEY), code 164 (KEY_PLAYPAUSE), value 1
Event: time 1459024009.589460, -------------- SYN_REPORT ------------
Event: time 1459024009.676465, type 4 (EV_MSC), code 4 (MSC_SCAN), value c00cd
Event: time 1459024009.676465, type 1 (EV_KEY), code 164 (KEY_PLAYPAUSE), value 0
Event: time 1459024009.676465, -------------- SYN_REPORT ------------
Event: time 1459024010.873461, type 4 (EV_MSC), code 4 (MSC_SCAN), value c00b7
Event: time 1459024010.873461, type 1 (EV_KEY), code 166 (KEY_STOPCD), value 1
Event: time 1459024010.873461, -------------- SYN_REPORT ------------
Event: time 1459024010.952457, type 4 (EV_MSC), code 4 (MSC_SCAN), value c00b7
Event: time 1459024010.952457, type 1 (EV_KEY), code 166 (KEY_STOPCD), value 0
Event: time 1459024010.952457, -------------- SYN_REPORT ------------
Event: time 1459024011.841457, type 4 (EV_MSC), code 4 (MSC_SCAN), value c00b6
Event: time 1459024011.841457, type 1 (EV_KEY), code 165 (KEY_PREVIOUSSONG), value 1
Event: time 1459024011.841457, -------------- SYN_REPORT ------------
Event: time 1459024011.919449, type 4 (EV_MSC), code 4 (MSC_SCAN), value c00b6
Event: time 1459024011.919449, type 1 (EV_KEY), code 165 (KEY_PREVIOUSSONG), value 0
Event: time 1459024011.919449, -------------- SYN_REPORT ------------
Event: time 1459024012.832448, type 4 (EV_MSC), code 4 (MSC_SCAN), value c00b5
Event: time 1459024012.832448, type 1 (EV_KEY), code 163 (KEY_NEXTSONG), value 1
Event: time 1459024012.832448, -------------- SYN_REPORT ------------
Event: time 1459024012.929442, type 4 (EV_MSC), code 4 (MSC_SCAN), value c00b5
Event: time 1459024012.929442, type 1 (EV_KEY), code 163 (KEY_NEXTSONG), value 0 

So I figured, keycode 163 was for next, 164 for pause, 165 for previous, and 166 for stop.
Following this I got the idea I could edit the map file I was using and add the entries for those keycodes like this

keycode 163 = nextsong
keycode 164 = playpause
keycode 165 = previoussong
keycode 166 = stopcd 

But I get an error whenever I try to load that keymap

 $ sudo loadkeys pt-custom
unknown keysym 'nextsong'

syntax error, unexpected ERROR, expecting EOL

So to what exactly should I change nextsong/playpause/etc... to?
I can't find that anywhere and that link about the Dell XPS 15 was the closest I got.

Last edited by soapy (2016-03-28 19:42:56)

Offline

#2 2016-03-26 23:51:32

Ziusudra
Member
Registered: 2014-04-19
Posts: 120

Re: [SOLVED] Multimedia Keys

You would need to use setkeycodes, not loadkeys.

Except you don't need to use anything as those key's scancodes are already mapped to the correct keycodes. The scancodes are the c00cd, c00b7, c00b6, c00b5 and the 163-166 are the keycodes.

So, what software are you trying to control with those keys? Is that software capable of/ configured to accept those keys?

Offline

#3 2016-03-27 11:41:21

soapy
Member
Registered: 2016-03-26
Posts: 3

Re: [SOLVED] Multimedia Keys

Oh, that makes sense, I'm trying to use spotify so if everything is already mapped I should just follow this , right?


edit:
Using D-Bus it works fine so i installed Xbindkeys, it seems there is a conflict with another program, i can capture the keys fine using 'xbindkeys -k'

 $ xbindkeys -k
Press combination of keys or/and click under the window.
You can use one of the two lines after "NoCommand"
in $HOME/.xbindkeysrc to bind a key.
"(Scheme function)"
    m:0x0 + c:174
    XF86AudioStop 
 $ xbindkeys -n

*** Warning ***
Please verify that there is not another program running
which captures one of the keys captured by xbindkeys.
It seems that there is a conflict, and xbindkeys can't
grab all the keys defined in its configuration file.

edit2:
changed the keys on the '.xbindkeysrc' file to something other than 'XF86AudioPlay' and it works, so it's just those media keys that aren't being captured.

Last edited by soapy (2016-03-27 13:07:32)

Offline

#4 2016-03-27 23:38:40

Ziusudra
Member
Registered: 2014-04-19
Posts: 120

Re: [SOLVED] Multimedia Keys

Well, they are being captured by something but not being sent to spotify.

Is there already an instance of xbindkeys running? (ps -ef | grep xbindkeys)

What desktop environment are you running?

Offline

#5 2016-03-27 23:55:15

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,846
Website

Re: [SOLVED] Multimedia Keys

Mod note: moving to Kernel and Hardware.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#6 2016-03-28 19:24:02

soapy
Member
Registered: 2016-03-26
Posts: 3

Re: [SOLVED] Multimedia Keys

I'm using plasma 5, got it working now, not sure what did it exactly.

I added the xbindkeys entry on the xinitrc file as said in the wiki for making changes permanent , rebooted and the keys I was using still worked (from my 2nd edit). so I changed the keys back (to 'XF86AudioPlay', 'XF86AudioNext', etc...) did the 'xbindkeys -p' command and those keys still weren't working so I decided to call it a day and change the keys back again to the same as my 2nd edit from last post.

Today I saw your post and did the 'ps -ef | grep xbindkeys' command and noticed one was running (because of that xinitrc entry I presume), so decided to give it a shot and changed to the media keys, run the 'xbindkeys -p' and it somehow worked.

Thanks for the help.   o/

Last edited by soapy (2016-03-28 19:25:24)

Offline

Board footer

Powered by FluxBB