laptop + external keyboard problem

n0nix n0nix at protonmail.com
Tue Dec 29 10:25:58 UTC 2020


Hello everyone

I'm on FreeBSD 12.1 and I've had this problem in 11.4 as well. My laptop's keyboard has a few broken keys so I have a USB keyboard attached to it. During installation I chose the standard US layout and all the regular keys on the USB keyboard work fine and xev recognizes them except for multimedia keys (vol up/down, mute). And I notice a strange behavior with x11/sxhkd: I tried to bind the PrintScreen key to a command so I looked at its value in xev ("Print") but when I put this keycode in my sxhkdrc, the PrintScreen key doesn't do anything, instead I get that command from the "UP" arrow key. I did see a difference in how xev reports the keycodes for regular alphabetical keys vs keys like PrintScreen, Scroll Lock, etc. For example, if I press the "W" key, I get something like this:

Code:

KeyPress event, serial 34, synthetic NO, window 0x2600002,
    root 0x47f, subw 0x0, time 5756771, (189,-199), root:(907,208),
    state 0x0, keycode 25 (keysym 0x77, w), same_screen YES,
    XLookupString gives 1 bytes: (77) "w"
    XmbLookupString gives 1 bytes: (77) "w"
    XFilterEvent returns: False

but with PrintScreen:

Code:

KeyPress event, serial 34, synthetic NO, window 0x2600002,
    root 0x47f, subw 0x0, time 5758611, (189,-199), root:(907,208),
    state 0x0, keycode 107 (keysym 0xff61, Print), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

Another weird thing is when I do xmodmap -pke, it shows me 255! keycodes and I think this is the number of keycodes for both laptop and external keyboard keys because I see keys that are exclusive to each keyboard which by the way include the multimedia keys from USB keyboard, so I don't know why xev doesn't show anything when I press them. I also see keys that don't exist on any of my keyboards ("Hiragana_Katakana", "Muhenkan", etc).

I don't plan on using my laptop's keyboard, so is there a way to remove all the keymappings and install a new one "only" for the external keyboard? (in case that's the easier route)

here's the complete output of  xmodmap -pk: https://ghostbin.com/paste/JrMCA


More information about the freebsd-hardware mailing list