Tuning keyboard for HP Omen 15 laptop

I've purchased HP Omen 15 notebook and installed Ubuntu 20.04 with KDE on it.

Everything works except 3 minor issues with keyboard.

Please, advice how to fix them.

  1. Calculator button works with bugs. Calculator is opened very rarely. I've tried observing events with xev command, and have found that pressing this button produces sometimes many-many event with XF86Calculator key and sometimes - nothig.
  2. Omen button doesn't work at all. I've read in forums that it is a dead button, supported in windows only. However, pressing it gives messages in dmesg: [ 6931.025068] hp_wmi: Unknown event_id - 29 - 0x21a5. So its not dead, probably, installing right driver may help. I understand that command center is supported only on Windows, but I could assign some other program to it.
  3. Positions of delete and pause buttons are swapped in keyboard (see attached image). I'd like to remap them so that pressing pause would produce delete key events and vice versa.

enter image description here

Here is the output of dmesg | grep input:

[    1.080083] input: Power Button as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0C:00/input/input0
[    1.080114] input: Lid Switch as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0D:00/input/input1
[    1.080137] input: Power Button as /devices/LNXSYSTM:00/LNXPWRBN:00/input/input2
[    1.201495] input: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input3
[    1.469199] input: Video Bus as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:03/LNXVIDEO:00/input/input4
[    1.654595] input: SYNA32A5:00 06CB:CE17 Mouse as /devices/platform/AMDI0010:03/i2c-0/i2c-SYNA32A5:00/0018:06CB:CE17.0001/input/input5
[    1.654751] input: SYNA32A5:00 06CB:CE17 Touchpad as /devices/platform/AMDI0010:03/i2c-0/i2c-SYNA32A5:00/0018:06CB:CE17.0001/input/input6
[    1.654872] hid-generic 0018:06CB:CE17.0001: input,hidraw0: I2C HID v1.00 Mouse [SYNA32A5:00 06CB:CE17] on i2c-SYNA32A5:00
[    4.366866] input: HP WMI hotkeys as /devices/virtual/input/input8
[    4.412494] input: HP Wide Vision HD Camera: HP Wi as /devices/pci0000:00/0000:00:08.1/0000:06:00.3/usb3/3-3/3-3:1.0/input/input9
[    4.545854] input: HDA NVidia HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:01.1/0000:01:00.1/sound/card1/input10
[    4.545934] input: HDA NVidia HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:01.1/0000:01:00.1/sound/card1/input11
[    4.546008] input: HDA NVidia HDMI/DP,pcm=8 as /devices/pci0000:00/0000:00:01.1/0000:01:00.1/sound/card1/input12
[    4.546088] input: HDA NVidia HDMI/DP,pcm=9 as /devices/pci0000:00/0000:00:01.1/0000:01:00.1/sound/card1/input13
[    4.546164] input: HDA NVidia HDMI/DP,pcm=10 as /devices/pci0000:00/0000:00:01.1/0000:01:00.1/sound/card1/input14
[    4.546258] input: HDA NVidia HDMI/DP,pcm=11 as /devices/pci0000:00/0000:00:01.1/0000:01:00.1/sound/card1/input15
[    4.547361] snd_hda_codec_realtek hdaudioC2D0:    inputs:
[    4.550677] input: SYNA32A5:00 06CB:CE17 Mouse as /devices/platform/AMDI0010:03/i2c-0/i2c-SYNA32A5:00/0018:06CB:CE17.0001/input/input16
[    4.551919] input: SYNA32A5:00 06CB:CE17 Touchpad as /devices/platform/AMDI0010:03/i2c-0/i2c-SYNA32A5:00/0018:06CB:CE17.0001/input/input17
[    4.552036] hid-multitouch 0018:06CB:CE17.0001: input,hidraw0: I2C HID v1.00 Mouse [SYNA32A5:00 06CB:CE17] on i2c-SYNA32A5:00
[    4.592745] input: HD-Audio Generic Mic as /devices/pci0000:00/0000:00:08.1/0000:06:00.6/sound/card2/input19
[    4.592837] input: HD-Audio Generic Headphone as /devices/pci0000:00/0000:00:08.1/0000:06:00.6/sound/card2/input20
[  599.371063] input: KYE SYSTEMS CORP. Wired Mouse as /devices/pci0000:00/0000:00:08.1/0000:06:00.4/usb5/5-2/5-2:1.0/0003:0458:0186.0002/input/input21
[  599.371352] hid-generic 0003:0458:0186.0002: input,hidraw1: USB HID v1.11 Mouse [KYE SYSTEMS CORP. Wired Mouse] on usb-0000:06:00.4-2/input0
[  599.371405] usbhid 5-2:1.1: couldn't find an input interrupt endpoint

Solution 1:

  1. Struggle with Calculator is still going on. I've submitted a separate question about it (Troubles with Calculator key on HP notebook). Currently I suppose that the issue is somewhere in xkb subsystem.

    UPDATE: Finished. Thanks to "nameless" helper! :) See the link above.

  2. This repository contains an updated driver for HP WMI, that enables four-zone keyboard highlight and maps Omen key to XF86Launch(6) key. Thanks James Churchill for his efforts!

  3. Swapping Delete and Pause is done by file $HOME/.Xmodmap with the following content

    keycode 119 = Pause Break Pause Break
    keycode 127 = Delete NoSymbol Delete
    

    These instructions are determined using the following algorithm.

    1. Determine correct keycodes (119 and 127 above) with showkey -k. Run sudo showkey -k and press Delete then Pause. That program has printed 111 keycode for Delete and 119 for Pause on my machine.
    2. Add 8 to them and put in that file. I'm not sure, but value of 8 is probably obtained from the output of xmodmap -pk. First line of its output shows 8 on my PC, which is min keycode.
    3. Figure out original mappings of these keys by running xmodmap -pke. For example original mapping for Delete key on my PC was
    $ xmodmap -pke | grep 119
    keycode 119 = Delete NoSymbol Delete
    

Solution 2:

As a partial answer to your question, I managed to swap the pause and delete keys for the HP Omen 15 https://gist.github.com/kellpossible/d2d7992b4aa6b9214577596843d307b6