0

When I type on the built-in keyboard of my MSI laptop GS75 Stealth 9SF, it seems that the mapping of the backslash key (\|) and the Right alt key are swapped.

This issue persists no matter what keyboard layout or language I choose.

Here is what xev outputs when I push right Alt:

keycode 94 (keysym 0x5c, backslash)
XKeysymToKeycode returns keycode: 51
XLookupString gives 1 bytes: (5c) "\"

And this is the output of me pushing the backslash key:

keycode 108 (keysym 0xfe03, ISO_Level3_Shift)
XKeysymToKeycode returns keycode: 92
XLookupString gives 0 bytes:

When I use external USB keyboard, all works properly as expected, so it seems like the SteelSeries keyboard manufacturer messed up key codes? That's what I've thought at first, but then I've realised that it works properly on Windows.


And here is an image of the keyboard layout from LaptopMag's review:


(source: purch.com)

It's those two keys that are on the right side of the spacebar.

6
  • Hi.. you can easily swap them using xmodmap are you looking for a work around or you want to notice this to MSI? if they have official support for Ubuntu.. they may give you a patch like in this link. askubuntu.com/q/1103370/739431
    – PRATAP
    Oct 8, 2019 at 1:26
  • askubuntu.com/q/1175072/739431 may be useful
    – PRATAP
    Oct 8, 2019 at 1:31
  • Hi, I've already tried to use xmodmap, but the thing is that I cannot use Shift + backslash combination to create a bar (|). I'm issuing this command: xmodmap -e "keycode 108 = backslash bar". But when I look at the output of xmodmap -pke, it shows keycode 108 = backslash NoSymbol. Do you have any idea, how could I fix this?
    – jirislav
    Oct 8, 2019 at 18:26
  • Btw I've done some basic google search for MSI keyboard patch, but found nothing, so I guess I would have to describe the issue to the MSI support, right? The thing is that according to my experience, their response time is more than 7 days, so I'd prefer faster solution.
    – jirislav
    Oct 8, 2019 at 18:31
  • Hi.. 0k.. when you are online let's do some trails to fix this.. its 5:40am here
    – PRATAP
    Oct 9, 2019 at 0:10

3 Answers 3

3

On my MSI laptop there's a "backslash/alt key swap" option on the BIOS/UEFI setup under the "Advanced" tab. You should have it on "Disabled".

1
  • This is an excellent point, I wouldn't find it myself, thank you!
    – jirislav
    Mar 2, 2020 at 8:46
1

I have tried it in my laptop with Right Alt key, which is also 108 keycode for me..

The point I understood from your output is, your Right Alt key with keycode 108 is having modifier ISO_Level3_Shift you can check this to confirm by running simply xmodmap

Exmaple:

pratap@pratap:~$ xmodmap
xmodmap:  up to 4 keys per modifier, (keycodes in parentheses):

shift       Shift_L (0x32),  Shift_R (0x3e)
lock        Caps_Lock (0x42)
control     Control_L (0x25),  Control_R (0x69)
mod1        Alt_L (0x40),  Meta_L (0xcd)
mod2        Num_Lock (0x4d)
mod3      
mod4        Super_L (0x85),  Super_R (0x86),  Super_L (0xce),  Hyper_L (0xcf)
mod5        ISO_Level3_Shift (0x5c),  Mode_switch (0xcb)

pratap@pratap:~$

This means when you combine Right Alt with Shift it should print 4th keysym

So you need to remove the modifier from Right Alt before running

xmodmap -e "keycode 108 = backslash bar"

To remove the modifier from Right Alt, the best way is to use either gnome-tweaks or gsettings

Gnome-Tweaks: enter image description here

gsettings:

gsettings get org.gnome.desktop.input-sources xkb-options

to set the value to none run below command. [Be careful if you get multiple options from above command]

gsettings set org.gnome.desktop.input-sources xkb-options "[]"

enter image description here

1
  • Thank you for your thorough explanation how to swap the keys using GNOME. The thing is that it turned out to be an issue of wrong BIOS settings, which is hardware related, thus better solution was to disable the swap of those keys in BIOS.
    – jirislav
    Mar 2, 2020 at 8:45
1

Try selecting for "Polish(legacy)" keyboard layout it worked for me

1
  • Polish (legacy) is a keyboard layout Feb 27, 2020 at 21:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .