You are not logged in.

#1 2018-05-06 07:37:32

FREEZE_ball
Member
Registered: 2018-05-06
Posts: 9

Numpad is not working in certain application [KDE5/X11/Kwin]

Numbers on my numpad don't work specificaly in Unity Editor Beta 2018.2.0b2+20180501-1. Regardless of NumLock state they always produce their alternative output (PageUp, PageDown, arrow keys etc.), but [5] produces "5" when NumLock is on. Numpad works as intended in all other applications, including Unity (Beta) Home launcher, MonoDevelop and stable Unity Editor 2017.4.0f1+20180501-1. $ xev output is also fine. Changing layout (I have default US and RU layouts, also tried to install random FR layout) doesn't fix it. Literally everything else is working as intended.

Related specs: linux 4.16.6-1
xorg-server 1.19.6+13+gd0d1a694f-2
plasma-meta 5.12-1
kwin 5.12.5-1
xf86-input-libinput 0.27.1-1
Keyboard is Logitech G103 (although I tried to install another PS/2 and USB keyboards, both having the same problem)

$ setxkbmap -print -verbose 10
Setting verbose level to 10
locale is C
Trying to load rules file ./rules/evdev...
Trying to load rules file /usr/share/X11/xkb/rules/evdev...
Success.
Applied rules from evdev:
rules:      evdev
model:      logitech_base
layout:     ru,us
options:    grp:alt_shift_toggle,altwin:meta_win,kpdl:dot,terminate:ctrl_alt_bksp,numpad:mac
Trying to build keymap using the following components:
keycodes:   evdev+aliases(qwerty)
types:      complete+numpad(mac)
compat:     complete
symbols:    pc+ru+us:2+inet(evdev)+altwin(meta_win)+group(alt_shift_toggle)+kpdl(dot)+terminate(ctrl_alt_bksp)
geometry:   pc(pc104)
xkb_keymap {
        xkb_keycodes  { include "evdev+aliases(qwerty)" };
        xkb_types     { include "complete+numpad(mac)"  };
        xkb_compat    { include "complete"      };
        xkb_symbols   { include "pc+ru+us:2+inet(evdev)+altwin(meta_win)+group(alt_shift_toggle)+kpdl(dot)+terminate(ctrl_alt_bksp)"     };
        xkb_geometry  { include "pc(pc104)"     };
};

My keyboard looks like this.

What i did try that did not work:
In KDE system options:
* turning on/off controlling mouse from numpad (it was off) as it is apparently the most common problem;
* changing layout, even installing a new one (I randomly installed FR);
* changing keyboard model (between "Logitech|Logitech" and a few types of "Generic");
* turning on macOS numpad mode in accessibility settings (now it works everywhere else and it is an amazing feature);
* turning on legacy numpad layout.

$ setxkbmap -option numpad:mac

Running Unity3d as root.
Changing keypad settings file for XOrg. Although I don't have enough experience to figure out how to make xkb accept my changes and just rebooted the system. It didn't work.
Changing LOCALE to "en_US.UTF-8" and "en_GB.UTF-8".

What could the problem be and is there some dirty workaround to force numpad input for Unity Editor?

Last edited by FREEZE_ball (2018-05-06 07:39:57)

Offline

#2 2018-05-06 08:29:14

nesk
Member
Registered: 2011-03-31
Posts: 181

Re: Numpad is not working in certain application [KDE5/X11/Kwin]

Sounds like a problem with the program, like it processes scancodes instead of keycodes. Have you tried searching their forums or bugtracker?
As for dirty workarounds - https://wiki.archlinux.org/index.php/X_ … assignment

Offline

#3 2018-05-06 11:39:45

FREEZE_ball
Member
Registered: 2018-05-06
Posts: 9

Re: Numpad is not working in certain application [KDE5/X11/Kwin]

I have created a new issue on Unity bugtracker, waiting now.

Meanwhile, I have mapped every numpad key to output only KeyPad symbols:

$ xmodmap -pke

keycode  77 = Num_Lock NoSymbol Num_Lock
keycode  78 = Scroll_Lock NoSymbol Scroll_Lock
keycode  79 = KP_7 KP_7 KP_7 KP_7
keycode  80 = KP_8 KP_8 KP_8 KP_8
keycode  81 = KP_9 KP_9 KP_9 KP_9
keycode  82 = KP_Subtract KP_Subtract KP_Subtract KP_Subtract KP_Subtract KP_Subtract XF86Prev_VMode KP_Subtract KP_Subtract XF86Prev_VMode
keycode  83 = KP_4 KP_4 KP_4 KP_4
keycode  84 = KP_5 KP_5 KP_5 KP_5
keycode  85 = KP_6 KP_6 KP_6 KP_6
keycode  86 = KP_Add KP_Add KP_Add KP_Add KP_Add KP_Add XF86Next_VMode KP_Add KP_Add XF86Next_VMode
keycode  87 = KP_1 KP_1 KP_1 KP_1
keycode  88 = KP_2 KP_2 KP_2 KP_2
keycode  89 = KP_3 KP_3 KP_3 KP_3
keycode  90 = KP_0 KP_0 KP_0 KP_0
keycode  91 = KP_Delete KP_Decimal KP_Delete KP_Decimal

Where do I go from here? How can I force KP_X to output just X?

Edit: Have to say, that XKB wiki article is very confusing.

Last edited by FREEZE_ball (2018-05-06 11:48:23)

Offline

#4 2018-05-06 12:02:22

FREEZE_ball
Member
Registered: 2018-05-06
Posts: 9

Re: Numpad is not working in certain application [KDE5/X11/Kwin]

Ok, I feel stupid, how simple that was.

$ xmodmap -e "keycode 79 = 7 7 7 7"

$ xmodmap -pke

keycode  79 = 7 7 7 7

However it does not fix the issue. Unity still treats "NumPad_7" as "Home".

Offline

#5 2018-05-06 12:23:35

FREEZE_ball
Member
Registered: 2018-05-06
Posts: 9

Re: Numpad is not working in certain application [KDE5/X11/Kwin]

I went a level further and created an xkbcomp config file including this:

	xkb_symbols   {
        include "pc+us+ru:2+inet(evdev)+altwin(meta_win)+group(alt_shift_toggle)+kpdl(dot)+terminate(ctrl_alt_bksp)"
        
        key <KP7> { [ 7, 7 ] };
        key <KP8> { [ 8, 8 ] };
        key <TLDE> { [ asciitilde, grave ] }; //this one is to test if config works. It just swaps ` and ~
    };

After that I loaded that file using

$ xkbcomp $HOME/.config/xkb/my $DISPLAY

and tilde/grave key was swapped but Unity still only accepts KP7 as "Home".

Offline

#6 2018-05-06 14:08:44

FREEZE_ball
Member
Registered: 2018-05-06
Posts: 9

Re: Numpad is not working in certain application [KDE5/X11/Kwin]

I'm at the point where I've done everything I could:

$ xmodmap -pke

keycode  77 = Num_Lock NoSymbol Num_Lock
keycode  78 = Scroll_Lock NoSymbol Scroll_Lock
keycode  79 = 7 7 7 7
keycode  80 = 8 8 8 8
keycode  81 = 9 9 9 9
keycode  82 = KP_Subtract KP_Subtract KP_Subtract KP_Subtract KP_Subtract KP_Subtract XF86Prev_VMode KP_Subtract KP_Subtract XF86Prev_VMode
keycode  83 = 4 4 4 4
keycode  84 = 5 5 5 5
keycode  85 = 6 6 6 6
keycode  86 = KP_Add KP_Add KP_Add KP_Add KP_Add KP_Add XF86Next_VMode KP_Add KP_Add XF86Next_VMode
keycode  87 = 1 1 1 1
keycode  88 = 2 2 2 2
keycode  89 = 3 3 3 3
keycode  90 = 0 0 0 0
keycode  91 = period period KP_Delete KP_Separator

But that still doesn't work.

How can one safely reassign keyboard geometry to emulate different keys pressed, i.e. when I press [Numpad 1/End] system thinks I pressed [1/!] instead?

Offline

#7 2018-05-06 14:53:18

nesk
Member
Registered: 2011-03-31
Posts: 181

Re: Numpad is not working in certain application [KDE5/X11/Kwin]

Does the reassignment work in other apps?

Last edited by nesk (2018-05-06 14:53:29)

Offline

#8 2018-05-06 15:15:26

FREEZE_ball
Member
Registered: 2018-05-06
Posts: 9

Re: Numpad is not working in certain application [KDE5/X11/Kwin]

nesk wrote:

Does the reassignment work in other apps?

Yes. Everything within X-server is able to put numbers with NumLock disabled. It doesn't work in virtual console, as expected.

Using recommendations from this wiki page, I edited /usr/lib/udev/hwdb.d/60-keyboard.hwdb as follows:

# LOGITECH G103
evdev:input:b0003v046DpC24B*
KEYBOARD_KEY_4f=1
KEYBOARD_KEY_50=2
KEYBOARD_KEY_51=3
KEYBOARD_KEY_4b=4
KEYBOARD_KEY_4c=5
KEYBOARD_KEY_4d=6
KEYBOARD_KEY_47=7
KEYBOARD_KEY_48=8
KEYBOARD_KEY_49=9
KEYBOARD_KEY_52=0

and tried to update it using

$ sudo systemd-hwdb update
// and
$ sudo udevadm trigger

with no success: NumPad keys do not work in virtual console and don't input symbols when used with Shift in XOrg. What have I done wrong here? I've got scancodes from virtual console and device ID from:

$ lsusb
Bus 005 Device 002: ID 046d:c24b Logitech, Inc. 

Edit: System apparently does not see my changes:

$ sudo udevadm info /dev/input/by-path/*-usb-*-kbd

P: /devices/pci0000:00/0000:00:1d.0/usb5/5-1/5-1:1.0/0003:046D:C24B.0001/input/input2/event2
N: input/event2
S: input/by-id/usb-Logitech_Gaming_Keyboard_G103-event-kbd
S: input/by-path/pci-0000:00:1d.0-usb-0:1:1.0-event-kbd
E: DEVLINKS=/dev/input/by-id/usb-Logitech_Gaming_Keyboard_G103-event-kbd /dev/input/by-path/pci-0000:00:1d.0-usb-0:1:1.0-event-kbd
E: DEVNAME=/dev/input/event2
E: DEVPATH=/devices/pci0000:00/0000:00:1d.0/usb5/5-1/5-1:1.0/0003:046D:C24B.0001/input/input2/event2
E: ID_BUS=usb
E: ID_INPUT=1
E: ID_INPUT_KEY=1
E: ID_INPUT_KEYBOARD=1
E: ID_MODEL=Gaming_Keyboard_G103
E: ID_MODEL_ENC=Gaming\x20Keyboard\x20G103
E: ID_MODEL_ID=c24b
E: ID_PATH=pci-0000:00:1d.0-usb-0:1:1.0
E: ID_PATH_TAG=pci-0000_00_1d_0-usb-0_1_1_0
E: ID_REVISION=7320
E: ID_SERIAL=Logitech_Gaming_Keyboard_G103
E: ID_TYPE=hid
E: ID_USB_DRIVER=usbhid
E: ID_USB_INTERFACES=:030101:030000:
E: ID_USB_INTERFACE_NUM=00
E: ID_VENDOR=Logitech
E: ID_VENDOR_ENC=Logitech
E: ID_VENDOR_ID=046d
E: LIBINPUT_DEVICE_GROUP=3/46d/c24b:usb-0000:00:1d.0-1
E: MAJOR=13
E: MINOR=66
E: SUBSYSTEM=input
E: TAGS=:power-switch:
E: USEC_INITIALIZED=9362594

// and

$ sudo udevadm info /dev/input/by-id/usb-Logitech_Gaming_Keyboard_G103-event-kbd

P: /devices/pci0000:00/0000:00:1d.0/usb5/5-1/5-1:1.0/0003:046D:C24B.0001/input/input2/event2
N: input/event2
S: input/by-id/usb-Logitech_Gaming_Keyboard_G103-event-kbd
S: input/by-path/pci-0000:00:1d.0-usb-0:1:1.0-event-kbd
E: DEVLINKS=/dev/input/by-id/usb-Logitech_Gaming_Keyboard_G103-event-kbd /dev/input/by-path/pci-0000:00:1d.0-usb-0:1:1.0-event-kbd
E: DEVNAME=/dev/input/event2
E: DEVPATH=/devices/pci0000:00/0000:00:1d.0/usb5/5-1/5-1:1.0/0003:046D:C24B.0001/input/input2/event2
E: ID_BUS=usb
E: ID_INPUT=1
E: ID_INPUT_KEY=1
E: ID_INPUT_KEYBOARD=1
E: ID_MODEL=Gaming_Keyboard_G103
E: ID_MODEL_ENC=Gaming\x20Keyboard\x20G103
E: ID_MODEL_ID=c24b
E: ID_PATH=pci-0000:00:1d.0-usb-0:1:1.0
E: ID_PATH_TAG=pci-0000_00_1d_0-usb-0_1_1_0
E: ID_REVISION=7320
E: ID_SERIAL=Logitech_Gaming_Keyboard_G103
E: ID_TYPE=hid
E: ID_USB_DRIVER=usbhid
E: ID_USB_INTERFACES=:030101:030000:
E: ID_USB_INTERFACE_NUM=00
E: ID_VENDOR=Logitech
E: ID_VENDOR_ENC=Logitech
E: ID_VENDOR_ID=046d
E: LIBINPUT_DEVICE_GROUP=3/46d/c24b:usb-0000:00:1d.0-1
E: MAJOR=13
E: MINOR=66
E: SUBSYSTEM=input
E: TAGS=:power-switch:
E: USEC_INITIALIZED=9362594

Last edited by FREEZE_ball (2018-05-06 15:24:09)

Offline

#9 2018-05-06 15:24:03

nesk
Member
Registered: 2011-03-31
Posts: 181

Re: Numpad is not working in certain application [KDE5/X11/Kwin]

It sounds unlikely for a modern application to do this, but it really looks like that Unity app is reading raw scancodes. I'd wait for their feedback first.

Offline

#10 2018-05-06 16:22:46

FREEZE_ball
Member
Registered: 2018-05-06
Posts: 9

Re: Numpad is not working in certain application [KDE5/X11/Kwin]

I reworked my keymapping config, put it into it's own config file at /etc/udev/hwdb.d/10-keyboard.hwdb:

# LOGITECH G103
evdev:input:b0003v046DpC24B*
KEYBOARD_KEY_70059=1
KEYBOARD_KEY_7005a=2
KEYBOARD_KEY_7005b=3
KEYBOARD_KEY_7005c=4
KEYBOARD_KEY_7005d=5
KEYBOARD_KEY_7005e=6
KEYBOARD_KEY_7005f=7
KEYBOARD_KEY_70060=8
KEYBOARD_KEY_70061=9
KEYBOARD_KEY_70062=0

and updated it:

$ sudo systemd-hwdb update
// and
$ sudo udevadm trigger

Now my numpad translates into normal numeric keys and it works in Unity Editor and even in virtual console. Workaround is completed. Now we just have to wait for Unity developers to fix that behavior.

Offline

#11 2018-05-07 09:22:32

nesk
Member
Registered: 2011-03-31
Posts: 181

Re: Numpad is not working in certain application [KDE5/X11/Kwin]

Mark this thread as "solved".

Offline

Board footer

Powered by FluxBB