SOLUTION of internal keyboard failure in ArchLinux after upgrading

SOLUTION of internal keyboard failure in ArchLinux after upgrading

Circumstance

  • description
      After an yay -Syuupdate, the internal keyboard didn’t work,but for the power button,sleep button,and two brightness adjusting keys using Fn(Fn+F5,Fn+F6)
  • System information:
    • ArchLinux stable 5.8.8
    • Xorg 1.20.9-2
    • lightdm 1.30.0-4
    • Xfce4 4.14.2-2

Problem probe

  • First:hardware check
      Run into a console tty using Ctrl+Alt+F2,randomly type some words,if worked properly,there is nothing wrong with the hardware.
  • Second:Xorg Driver check
      the latest xorg has abondoned the xf86-input-keyboard driver,taking the new xf86-input-evdev and xf86-input-libinput driver,the latter is installed with xorg-server automatically serving as a dependency item,while I recommand you to install both of them by sudo pacman -S xf86-input-evdevbecause the xf86-input-libinput does better in touchpad guesture.
      then,let’s go teseing our driver
        first copy the following codes and save it as a python scriptkeytest.py,then make it executable by sudo chmod +x keytest.py
#!/usr/bin/python
import struct

keyboardFile = open('/dev/input/event4','rb')
data = keyboardFile.read(24)
print(struct.unpack('4IHHI',data))
keyboardFile.close()

      second execute the script by sudo ./keytest.pyand press key Q of your internal keyboard
    you will get an output sequence like this:

		(1599824380, 0, 226140, 0, 4, 4, 16)
		(1599824380, 0, 226140, 0, 1, 16, 1)
		(1599824380, 0, 226140, 0, 0, 0, 0)
		(1599824380, 0, 358344, 0, 4, 4, 16)
		(1599824380, 0, 358344, 0, 1, 16, 0)
		(1599824380, 0, 358344, 0, 0, 0, 0)

NOTE :
  the value 16 is the keycode python receive from device file,which we will examine it later by grep "KEY_Q" /usr/include/linux/input-event-codes.h.
    third get the predefined keycode of Q by grep "KEY_Q" /usr/include/linux/input-event-codes.h,which outputs like this:
  #define KEY_Q 16
  #define KEY_QUESTION 214
  if keycode matches,the driver is ready for use.

  • Third:Xorg configure file
    • generate a new x configure file
        if you cannot find a xorg.conf file in /etc/X11 or /etc like me, you can simply regenerate a new skeleton by sudo Xorg :0 -configure
    • copy the configure file to /etc/X11 or /etc:
      sudo cp /root/xorg.conf.new /etc/X11/xorg.conf
    • modify the configure file to make the driver work
      • determine which device file your internal keyboard corresponds to by
        sudo cat /proc/bus/input/devices,your output may contain some lines like this:
I: Bus=0011 Vendor=0001 Product=0001 Version=ab41
N: Name="AT Translated Set 2 keyboard"
P: Phys=isa0060/serio0/input0
S: Sysfs=/devices/platform/i8042/serio0/input/input4
U: Uniq=
H: Handlers=sysrq kbd event4 leds 
B: PROP=0
B: EV=120013
B: KEY=402000000 3803078f800d001 feffffdfffefffff fffffffffffffffe
B: MSC=10
B: LED=7

  which implies the device file of your internal keyboard is /dev/input/event4

  • modify the xorg configure file
    sudo vim /etc/X11/xorg.conf then find a block like this:
    Section "InputDevice"
    	Identifier  "Keyboard0"
    	Driver      "kbd"
    EndSection
    
    modify it to the pattern as follows:
    Section "InputDevice"
    	Identifier  "Keyboard0"
    	Driver      "evdev"
    	Option      "Device" "/dev/input/event4"
    EndSection
    
  • Bingo Enjoy your Arch!
  • ending: I’m sorry for my poor English.Thanks for reading.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值