Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

主键盘的回车(36)触发的是小键盘的回车(104) 键码有误 #3

Closed
puzzle9 opened this issue Jul 9, 2022 · 2 comments
Closed

Comments

@puzzle9
Copy link
Contributor

puzzle9 commented Jul 9, 2022

演示

笔记本

主键盘区

KeyPress event, serial 45, synthetic NO, window 0x3600001,
    root 0x845, subw 0x0, time 703078, (106,99), root:(156,209),
    state 0x10, keycode 104 (keysym 0xff8d, KP_Enter), same_screen YES,
"   XLookupString gives 1 bytes: (0d) "
"   XmbLookupString gives 1 bytes: (0d) "
    XFilterEvent returns: False

外接键盘

主键盘区

KeyPress event, serial 47, synthetic NO, window 0x3600001,
    root 0x845, subw 0x0, time 746296, (596,1023), root:(646,1133),
    state 0x10, keycode 36 (keysym 0xff0d, Return), same_screen YES,
"   XLookupString gives 1 bytes: (0d) "
"   XmbLookupString gives 1 bytes: (0d) "
    XFilterEvent returns: False

小键盘区

KeyPress event, serial 47, synthetic NO, window 0x3600001,
    root 0x845, subw 0x0, time 769660, (408,407), root:(458,517),
    state 0x10, keycode 104 (keysym 0xff8d, KP_Enter), same_screen YES,
"   XLookupString gives 1 bytes: (0d) "
"   XmbLookupString gives 1 bytes: (0d) "
    XFilterEvent returns: False

影响软件

  • fcitx 在中文并且候选框有字的时候 按回车会触发搜索
@vrolife
Copy link
Owner

vrolife commented Jul 10, 2022

证实确实有这个问题。经分析,这是由于ENTER键从主板传过来的扫描码是0x9C,这个扫描码默认映射KP_Enter键,小米工程师太不讲究了。至于受影响的软件,我这kubuntu+fcitx5没有受到影响。

想变更这个默认行为的话,可以解压文件90-kpenter2enter-keyboard.hwdb.zip到/etc/udev/hwdb.d/90-kpenter2enter-keyboard.hwdb来将kpenter键映射为enter键盘。放置文件后运行systemd-hwdb update更新hwdb. 接着重启或者运行命令udevadm trigger /dev/input/event2使其生效

如果你的机型不是RedmiBookPro152022,运行以下命令查看具体型号。型号不对则文件不生效
evemu-describe /dev/input/event2 |grep DMI # /dev/input/event2 应当为AT Translated Set 2 keyboard
参考https://wiki.archlinux.org/title/map_scancodes_to_keycod

@vrolife vrolife closed this as completed Jul 10, 2022
@vrolife vrolife pinned this issue Jul 10, 2022
@puzzle9
Copy link
Contributor Author

puzzle9 commented Jul 18, 2022

我刚才试了下 在win11中 也是这情况

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants