Compose and Kana LEDs are swapped with the evdev driver
I tried to use the japan:kana_lock
XKB option to show the input language indicator on my keyboard (this keyboard is powered by the opensource QMK firmware, and advertises the Compose and Kana LEDs over HID). Because the libinput
driver apparently does not support any keyboard indicators except the standard {Caps,Num,Scroll}Lock set, I switched the driver for keyboard devices to evdev
:
Section "InputClass"
Identifier "system-keyboard"
MatchIsKeyboard "on"
Driver "evdev"
Option "XkbModel" "pc104"
Option "XkbLayout" "us,ru"
Option "XkbOptions" "grp:shift_caps_switch,lv3:ralt_switch,keypad:oss,compose:menu,misc:typo,nbsp:level3n,mod_led:compose,japan:kana_lock"
EndSection
After doing this I observed the Kana LED state changing as appropriate in the xset q
output, but the keyboard actually received events with the Compose LED turning on and off. However, trying to control the Compose led through xset
(mod_led:compose
did not work, which is a separate issue) resulted in changing the Kana LED state on the keyboard.
Looking at the xf86-input-evdev
driver code, I found these indicator bit definitions:
#define CAPSFLAG 1
#define NUMFLAG 2
#define SCROLLFLAG 4
#define MODEFLAG 8
#define COMPOSEFLAG 16
However, /usr/share/X11/xkb/keycodes/evdev
has these indicators in a different order:
indicator 1 = "Caps Lock";
indicator 2 = "Num Lock";
indicator 3 = "Scroll Lock";
indicator 4 = "Compose";
indicator 5 = "Kana";
I tried to swap the Compose and Kana indicator numbers:
indicator 4 = "Kana";
indicator 5 = "Compose";
After doing this the japan:kana_lock
option behaved as expected.
Should the indicator numbers in keycodes/evdev
be changed to match the xf86-input-evdev
driver behavior, or should the xf86-input-evdev
driver be changed to use the indicator numbers which are currently defined in keycodes/evdev
?
I suppose that indicators beyond 5, which are also defined in keycodes/evdev
, do not work at all, but I do not have a way to test them currently (QMK supports only 5 indicator bits in the HID report, and adding more bits would require major changes to the HID descriptors).