jingyu9575 / remap-omen-key

Remap the OMEN key to Home for HP OMEN laptops
MIT License
65 stars 14 forks source link

Can I remap omen key on ubuntu 16.04? #1

Closed sherpahu closed 5 years ago

sherpahu commented 5 years ago

I find this project remapping omen key with registry , which only works on Windows. So I am wondering whether there is a method to make it work on my Ubuntu system. Thanks in advance! ps. Since that your location showed in Github is China and your id is Chinese Pinyin, I also translate the above issue into Chinese for you. 请问能否在Ubuntu系统上将OMEN键映射为Home?

jingyu9575 commented 5 years ago

Windows 下注册表的方法使用了惠普的 HP System Event Utility 驱动。Linux 内核包含对应的驱动,但在我的电脑上似乎有问题。

请尝试运行sudo dmesg -w,然后按 OMEN 键。是否有错误信息提示?

sherpahu commented 5 years ago

有错误信息 [ 497.822211] ACPI Error: Field [D128] at bit offset/length 128/1024 exceeds size of target Buffer (160 bits) (20170831/dsopcode-235) [ 497.822238] No Local Variables are initialized for Method [HWMC] [ 497.822243] Initialized Arguments for Method [HWMC]: (2 arguments defined for method invocation) [ 497.822245] Arg0: 00000000b750981c Integer 0000000000000002 [ 497.822259] Arg1: 0000000093a78128 Buffer(20) 53 45 43 55 01 00 00 00 [ 497.822286] ACPI Error: Method parse/execution failed \HWMC, AE_AML_BUFFER_LIMIT (20170831/psparse-550) [ 497.822312] ACPI Error: Method parse/execution failed _SB.WMID.WMAA, AE_AML_BUFFER_LIMIT (20170831/psparse-550) [ 498.788997] acpi INT3400:00: Unsupported event [0x86] [ 499.832790] acpi INT3400:00: Unsupported event [0x86] [ 500.878849] acpi INT3400:00: Unsupported event [0x86]

jingyu9575 commented 5 years ago

这个 INT3400 应该跟按键没有关系,有可能你的机型是驱动支持的(驱动是否已经加载?modprobe hp-wmi)。可以试试 xev, evtest 之类的工具,看桌面环境能不能检测到这个键。如果可以,在桌面环境加快捷键应该能解决。如果检测不到,那就还是驱动问题。

我的电脑上按 OMEN 键会出现 hp-wmi: Bad event 错误,是驱动问题,不太容易解决。

sherpahu commented 5 years ago

xev我之前试过,没有用,按这个键没有反应 evtest选中hp的键是下面这样 image 驱动怎么加载?modprobe hp-wmi也没有输出

jingyu9575 commented 5 years ago

evtest选中hp的键是下面这样

evtest 需要在桌面环境以外使用(Ctrl+Alt+F2,用 Ctrl+Alt+F7 返回)。

modprobe hp-wmi

这个命令就是加载。看输出,系统已经默认加载了。


现在我也没法确定你的机型上是什么状态。这问题我能想到的办法有:

  1. 如果驱动正常工作,可以在桌面环境上改键,或者读取 /dev/input/event17 获得事件后发送按键。
  2. 驱动有问题,但按 OMEN 键时有固定的 dmesg 消息。可以监测这个消息发送按键。
    • 我的机型在 Ubuntu 19.04 上就是这个状态,每次按 OMEN 键会出现一行 hp-wmi: Bad event 错误。
  3. 驱动有问题而且没有规律,就只能等待驱动修复。
sherpahu commented 5 years ago

好吧,谢谢你了。 OMEN键映射的方式还是感觉有点麻烦,我目前的解决方法就是把insert映射为home,delete与end互换,反正insert键基本不用(我目前只会在终端的复制用到insert键,但是ctrl+shift+c也可以实现复制,就没有太大的困扰了),正好这样home键也可以离字母键区更近,输入更方便一点。

hockeymikey commented 3 years ago

What was the solution here?

jingyu9575 commented 3 years ago

@hockeymikey Last time I checked, the key is handled by a Linux driver, but the driver has bugs making it unusable. On my system, one possible workaround is to watch the "hp-wmi: Bad event" error and emit Home when the driver writes this line.

I'm not sure what is the status of this driver now. Maybe the bugs have been fixed and the key can be remapped normally. I currently do not have Linux installed.