一次按键可产生更多按键代码

一次按键可产生更多按键代码

我在一台较旧的笔记本电脑(acer aspiretimeline X 5820)上安装了linux(测试了debian 9和linux mint 18),但它的键盘有问题。

其箭头上有音量和显示亮度的控件(按下 fn 键时起作用)。其中三个工作正常,而最后一个(亮度降低)则不然。当钥匙(箭头与 fn 一起)按下后,它会初始化亮度降低并更改为外部显示器

输出xev为(按住 fn 时按一下箭头):

MappingNotify event, serial 40, synthetic NO, window 0x0,
    request MappingKeyboard, first_keycode 8, count 248

FocusOut event, serial 40, synthetic NO, window 0x7200001,
    mode NotifyGrab, detail NotifyAncestor

FocusIn event, serial 41, synthetic NO, window 0x7200001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 41, synthetic NO, window 0x0,
    keys:  2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   8   0   0   

KeyRelease event, serial 41, synthetic NO, window 0x7200001,
    root 0xb0, subw 0x0, time 5319155, (1023,637), root:(1023,666),
    state 0x10, keycode 235 (keysym 0x1008ff59, XF86Display), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

MappingNotify event, serial 41, synthetic NO, window 0x0,
    request MappingKeyboard, first_keycode 8, count 248

FocusOut event, serial 41, synthetic NO, window 0x7200001,
    mode NotifyGrab, detail NotifyAncestor

FocusIn event, serial 42, synthetic NO, window 0x7200001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 42, synthetic NO, window 0x0,
    keys:  2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   1   0   0   

KeyRelease event, serial 42, synthetic NO, window 0x7200001,
    root 0xb0, subw 0x0, time 5319238, (1023,637), root:(1023,666),
    state 0x10, keycode 232 (keysym 0x1008ff03, XF86MonBrightnessDown), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

输出showkey是:

keycode 227 press
keycode 227 release
keycode 224 press
keycode 224 release

键盘也有专用钥匙(F5 和 fn)用于更改要使用的显示 - 这会产生无输出既不在xev也不在showkey

降低亮度和改变显示效果都可以,但只能同时进行。在两个 Linux 上“工作”相同。 windows下没问题,所以不是硬件问题。

是否可以(以及如何)转移代码 keycode 235 (keysym 0x1008ff59, XF86Display)到正确的键?

答案1

笔记本电脑总是很棘手,因为每个制造商的做法都不同,而且制造商没有文档,只有 Windows 驱动程序。

从你的描述来看,在当前模式下嵌入式控制器(EC)是,它只会为 Fn + 亮度降低产生错误的序列,并且不会为 Fn + F5 产生序列或某种其他类型的事件。

由于没有文档说明如何重新编程 EC 以实现不同的效果,我能想到的最佳解决方案是将 XF86Display 映射到其他xmodmap被忽略且不会更改显示的内容(通过等)。这样,即使产生附加符号,亮度降低键也将正常工作。

如果您可以找到为 Fn + F5 生成的其他事件(例如使用acpi_listen),那么您可以添加一些自定义内容来对该事件做出反应。如果找不到任何事件,则必须将该键符号映射到其他组合键(不带 Fn),或者接受该键丢失的事实。

相关内容