Public bug reported:

 Steps to reproduce:
 - add custom hwdb rules for remapping keys (see the attach of my `cat 
/etc/udev/hwdb.d/61-ThinkPad-X240-keyboard.hwdb" for example)
 - run:
$ sudo udevadm hwdb --update && sudo udevadm control --reload-rules && sudo 
udevadm trigger
 - and reboot PC to make sure that changes have took place
 
 What should happen:
 - changes should take place at TTY and in GUI session as well

 What happens:
 - changes take place in TTY session only while in GUI session something 
overrides these udev-based hwdb rules

----

 Now, a little bit more details. Here is my 
/etc/udev/hwdb.d/61-ThinkPad-X240-keyboard.hwdb:
```
# ThinkPad X240:
# - switch End and Insert keys (so that when Fn-Lock is enabled, End works 
without Fn).
# - switch Home/End <> PgUp/PgDn
evdev:atkbd:dmi:bvn*:bvr*:bd*:svnLENOVO:pn*:pvrThinkPadX240:*
 KEYBOARD_KEY_c7=pageup
 KEYBOARD_KEY_cf=insert
 KEYBOARD_KEY_c9=home
 KEYBOARD_KEY_d1=end
 KEYBOARD_KEY_d2=pagedown

# http://fliplinux.com/udev-hwdb-numlock-0.html
```

 TL;DR: it did work recently, but after packages' update it did stop to
work in X session (but in TTY session it still works according to custom
configuration). I'm ready to provide any other detailed information.

 I use Ubuntu MATE 18.04 with the latest updates. It took a lot of time
for me to make that keyboard configuration work properly because without
that text processing (such as coding) is unbearable. And it was really
great when I did manage to make it finally work by turning a few
contradictory HOWTOs and advises from here and there into working
solution. Until the recent packages' update. The most interesting part
is that `evtest' shows logs according to hwdb settings while `xev'
doesn't. So I have my hwdb configuration working at any TTY but not
during X session. I tried even to downgrade a few packages manually such
as udev and systemd (because they have been updated as well) but it
didn't make it to work again.

$ sudo evtest /dev/input/by-path/platform-i8042-serio-0-event-kbd

===> [pressing PgUp above LeftArrow]

Event: time 1576021876.063189, -------------- SYN_REPORT ------------
^[[5~Event: time 1576021876.524882, type 4 (EV_MSC), code 4 (MSC_SCAN), value c9
Event: time 1576021876.524882, type 1 (EV_KEY), code 102 (KEY_HOME), value 1
Event: time 1576021876.524882, -------------- SYN_REPORT ------------
Event: time 1576021876.587770, type 4 (EV_MSC), code 4 (MSC_SCAN), value c9
Event: time 1576021876.587770, type 1 (EV_KEY), code 102 (KEY_HOME), value 0
Event: time 1576021876.587770, -------------- SYN_REPORT ------------
^[[5~Event: time 1576021876.857851, type 4 (EV_MSC), code 4 (MSC_SCAN), value c9
Event: time 1576021876.857851, type 1 (EV_KEY), code 102 (KEY_HOME), value 1
Event: time 1576021876.857851, -------------- SYN_REPORT ------------
Event: time 1576021876.920816, type 4 (EV_MSC), code 4 (MSC_SCAN), value c9
Event: time 1576021876.920816, type 1 (EV_KEY), code 102 (KEY_HOME), value 0
Event: time 1576021876.920816, -------------- SYN_REPORT ------------

# Yes, it's registrating KEY_HOME as it should

===> [pressing PgDn above RightArrow]

Event: time 1576021931.761434, -------------- SYN_REPORT ------------
^[[6~Event: time 1576021931.880086, type 4 (EV_MSC), code 4 (MSC_SCAN), value d1
Event: time 1576021931.880086, type 1 (EV_KEY), code 107 (KEY_END), value 1
Event: time 1576021931.880086, -------------- SYN_REPORT ------------
Event: time 1576021931.926910, type 4 (EV_MSC), code 4 (MSC_SCAN), value d1
Event: time 1576021931.926910, type 1 (EV_KEY), code 107 (KEY_END), value 0
Event: time 1576021931.926910, -------------- SYN_REPORT ------------
^[[6~Event: time 1576021932.037671, type 4 (EV_MSC), code 4 (MSC_SCAN), value d1
Event: time 1576021932.037671, type 1 (EV_KEY), code 107 (KEY_END), value 1
Event: time 1576021932.037671, -------------- SYN_REPORT ------------
Event: time 1576021932.092536, type 4 (EV_MSC), code 4 (MSC_SCAN), value d1
Event: time 1576021932.092536, type 1 (EV_KEY), code 107 (KEY_END), value 0
Event: time 1576021932.092536, -------------- SYN_REPORT ------------

# It works for PgDn as well!

But here is the log from `xev' when I'm pressing exactly the same pair
of the physical keys (PgUp/PgDn):

===> pressing PgUp:

KeyPress event, serial 56, synthetic NO, window 0x5400001,
    root 0x112, subw 0x0, time 1791814, (-320,157), root:(1041,606),
    state 0x0, keycode 81 (keysym 0xff9a, KP_Prior), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 57, synthetic NO, window 0x5400001,
    root 0x112, subw 0x0, time 1791822, (-320,157), root:(1041,606),
    state 0x0, keycode 81 (keysym 0xff9a, KP_Prior), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

# Now it's Prior while it must be KP_Home, let's test PgDn:

===> pressing PgDn:

KeyPress event, serial 41, synthetic NO, window 0x5400001,
    root 0x112, subw 0x0, time 1893432, (108,71), root:(979,534),
    state 0x0, keycode 89 (keysym 0xff9b, KP_Next), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 42, synthetic NO, window 0x5400001,
    root 0x112, subw 0x0, time 1893440, (108,71), root:(979,534),
    state 0x0, keycode 89 (keysym 0xff9b, KP_Next), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

# KP_Next instead of End :(

I don't have ~/.Xmodmap so nothing to look there - I tried to map the
keys through `xmodmap' and its configuration file first but after
reading a lot of HOWTOs and tries & errors I couldn't generate properly
working solution. Plus, unlike udev/hwdb it wouldn't be system-wide.
Plus, udev/hwdb solution did work perfectly for me. Until something
didn't break it.

I'm eager to provide any information that developers may need. Just let
me know what else do you need to know to help me to fix that broken
behavior. Thanks in advance.

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: udev 237-3ubuntu10.33
ProcVersionSignature: Ubuntu 4.15.0-73.82-generic 4.15.18
Uname: Linux 4.15.0-73-generic x86_64
ApportVersion: 2.20.9-0ubuntu7.10
Architecture: amd64
CurrentDesktop: MATE
CustomUdevRuleFiles: 70-snap.core.rules 51-android.rules
Date: Wed Dec 11 02:30:34 2019
InstallationDate: Installed on 2019-09-03 (98 days ago)
InstallationMedia: Ubuntu-MATE 18.04 LTS "Bionic Beaver" - Release amd64 
(20180426)
Lsusb:
 Bus 001 Device 005: ID 04ca:7035 Lite-On Technology Corp. 
 Bus 001 Device 004: ID 8087:07dc Intel Corp. 
 Bus 001 Device 003: ID 138a:0017 Validity Sensors, Inc. Fingerprint Reader
 Bus 001 Device 002: ID 8087:8000 Intel Corp. 
 Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
MachineType: LENOVO 20AL00DYRT
ProcKernelCmdLine: BOOT_IMAGE=/vmlinuz-4.15.0-73-generic 
root=UUID=bf255872-69a5-4d82-b332-7487edc8db13 ro rootflags=subvol=@ 
resume=UUID=a717b356-f82d-40d6-97f1-6aae4a6d2182 ignore_loglevel 
no_console_suspend verbose=1 udev.log_priority=8 loglevel=9 
earlyprintk=vga,keep log_buf_len=10M print_fatal_signals=1 pause_on_oops=2 
panic=5 sysrq_always_enabled crashkernel=512M-:192M
SourcePackage: systemd
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 10/02/2014
dmi.bios.vendor: LENOVO
dmi.bios.version: GIET77WW (2.27 )
dmi.board.asset.tag: Not Available
dmi.board.name: 20AL00DYRT
dmi.board.vendor: LENOVO
dmi.board.version: SDK0E50510 PRO
dmi.chassis.asset.tag: No Asset Information
dmi.chassis.type: 10
dmi.chassis.vendor: LENOVO
dmi.chassis.version: Not Available
dmi.modalias: 
dmi:bvnLENOVO:bvrGIET77WW(2.27):bd10/02/2014:svnLENOVO:pn20AL00DYRT:pvrThinkPadX240:rvnLENOVO:rn20AL00DYRT:rvrSDK0E50510PRO:cvnLENOVO:ct10:cvrNotAvailable:
dmi.product.family: ThinkPad X240
dmi.product.name: 20AL00DYRT
dmi.product.version: ThinkPad X240
dmi.sys.vendor: LENOVO

** Affects: systemd (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug bionic evtest hwdb udev xev

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1855941

Title:
  hwdb rules for remapping keys are not taking effect in X session

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1855941/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to