You are not logged in.

#1 2020-05-04 21:13:16

kubaxvx
Member
From: Warszawa, Poland
Registered: 2017-04-13
Posts: 7
Website

[SOLVED] Multiple keyboards, swapping esc & caps only to some of them

I use multiple keyboards and I want to swap Escape with CapsLock only when I cannot do this using keyboard's firmware. I've used the following Xorg configuration:

Section "InputClass"
  Identifier       "Defaults"
  MatchIsKeyboard  "on"
  NoMatchUSBID     "04d9:0293"
  Option           "XkbModel" "pc104"
  Option           "XkbLayout"  "pl,ru"
  Option           "XkbVariant" ",phonetic"
  Option           "XkbOptions" "grp:shifts_toggle,caps:swapescape"
EndSection

Section "InputClass"
  Identifier       "VortexCore"
  MatchUSBID       "04d9:0293"
  Option           "XkbModel" "pc104"
  Option           "XkbLayout"  "pl,ru"
  Option           "XkbVariant" ",phonetic"
  Option           "XkbOptions" "grp:shifts_toggle"
EndSection

I match the keyboard by USB ID, as reported by lsusb. For all other keyboards, Escape and CapsLock are swapped.

My main keyboard is VortexCore, so the one that should not have keys swapped. This configuration works as expected, when I connect some other keyboard it gets detected properly and the proper configuration is applied — Escape and CapsLock are swapped.

However, this somehow does not work for VortexCore keyboard. When I deattach and reattach it, the proper configuration is applied and Escape and CapsLock are NOT swapped (this is expected behaviour). After starting X the keyboard has the keys swapped (this is NOT the expected behaviour), so I have to manually reconnect the keyboard. What is weird, the logs look OK (xinput identifies this keyboard as "USB-HID"):

[    18.445] (**) Option "config_info" "udev:/sys/devices/pci0000:00/0000:00:14.0/usb1/1-9/1-9:1.2/0003:04D9:0293.0007/input/input13/event13"
[    18.445] (II) XINPUT: Adding extended input device "USB-HID Keyboard" (type: KEYBOARD, id 16)
[    18.445] (**) Option "xkb_model" "pc104"
[    18.445] (**) Option "xkb_layout" "pl,ru"
[    18.445] (**) Option "xkb_variant" ",phonetic"
[    18.445] (**) Option "xkb_options" "grp:shifts_toggle"
[    18.446] (II) event13 - USB-HID Keyboard: is tagged by udev as: Keyboard
[    18.446] (II) event13 - USB-HID Keyboard: device is a keyboard

The full log is available here: https://gist.github.com/jmatraszek/7f4a … bdde8e71aa

When I run query using setxkbmap, it shows that the caps:swapescape option is turned on. When I reconnect the keyboard, it is gone.

What may be the cause of this? Is my config file wrong?

Last edited by kubaxvx (2020-05-05 18:39:19)

Offline

#2 2020-05-05 06:35:58

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,697

Re: [SOLVED] Multiple keyboards, swapping esc & caps only to some of them

Some DE config, equivalent to "setxkbmap -option …" overriding the initial setup?
=> how do you startx X1? Take DM and DE out of the equation and startx xterm, see how your keyboards end up being configured.

Offline

#3 2020-05-05 18:38:57

kubaxvx
Member
From: Warszawa, Poland
Registered: 2017-04-13
Posts: 7
Website

Re: [SOLVED] Multiple keyboards, swapping esc & caps only to some of them

Thanks, that was it. It was silly of me, but I did not check `.xinitrc`, I had a leftover `setxkbmap` invocation there (used to use it, but than started using `qxkb` and now I just disabled `qxkb` and thought it was it). Anyway, now it works as expected. Thanks!

Offline

Board footer

Powered by FluxBB