The key in my keyboard that's supposed to works as XF86AudioMedia —through an Fn key combination— doesn't open the default music player in Linux, but in Windows it works, opening the Windows media player.

As far as I can see xev output doesn't show nothing, evtest and showkey identifies it as 171 but remapping that code with xmodmap doesn't nothing.

If it's useful, my keyboard is a Blackweb BWK2T (MOSART Semi. 2.4G Wireless Keyboard according to evtest).

xev output:

MappingNotify event, serial 37, synthetic NO, window 0x0,
    request MappingKeyboard, first_keycode 8, count 248

FocusOut event, serial 37, synthetic NO, window 0x4e00001,
    mode NotifyGrab, detail NotifyAncestor

FocusIn event, serial 38, synthetic NO, window 0x4e00001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 38, synthetic NO, window 0x0,
    keys:  123 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  

evtest output:

Event: time 1512613277.517833, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0183
Event: time 1512613277.517833, type 1 (EV_KEY), code 171 (KEY_CONFIG), value 1
Event: time 1512613277.517833, -------------- SYN_REPORT ------------
Event: time 1512613277.725803, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0183
Event: time 1512613277.725803, type 1 (EV_KEY), code 171 (KEY_CONFIG), value 0
Event: time 1512613277.725803, -------------- SYN_REPORT ------------

Partial answer:

The FocusOut and FocusIn events mean that some other application, possibly your window manager, is grabbing the event because it wants to react on it (e.g. launch some action associated with this key).

KEY_CONFIG looks like the kernel input level mapping is wrong for your keyboard, so trying to remap it is the right idea. Note that xmodmap won't work if you are using Wayland, and not an X server. Also note that there's an offset (IIRC 8) between the input level key codes, and the key codes X uses.

Suggestion: Try to remap some other key first (e.g. a to b) to see how it works, then map your 171 to XF86AudioMedia. You'll still need to make sure that your desktop, your window manager or whoever is responsible on your system launches a media player, possibly by configuring it.

  • I thought xmodmap uses different values, I didn't know it was just an offset. With the "corrected" keycode (179 for KEY_CONFIG / XF86Tools) I remap it with xmodmap to XF86AudioMedia and now works as expected. I'll try to do with setkeycodes and then edit the question to add this and mark it as solved. – Lupo Dec 7 '17 at 23:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.