Create TOC

2021년 5월 31일

Debian/key scancode 확인하기

udev의 hwdb를 이용해 키를 변경하려면 key scancode를 확인해야 한다. evtest를 실행하고 입력 장치를 고른 후 키를 누르면 key scancode를 확인할 수 있다.

$ evtest
No device specified, trying to scan all of /dev/input/event*
Not running as root, no devices may be available.
Available devices:
/dev/input/event0:      AT Translated Set 2 keyboard
...
/dev/input/event17:     Apple Wireless Trackpad
/dev/input/event18:     Logitech K760 Keyboard
..
Select the device event number [0-20]: 18
...
Event: time 1622111951.465432, -------------- SYN_REPORT ------------
Event: time 1622111957.763084, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70039
Event: time 1622111957.763084, type 1 (EV_KEY), code 58 (KEY_CAPSLOCK), value 1
Event: time 1622111957.763084, -------------- SYN_REPORT ------------
Event: time 1622111957.967015, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70006
Event: time 1622111957.967015, type 1 (EV_KEY), code 46 (KEY_C), value 1
Event: time 1622111957.967015, -------------- SYN_REPORT ------------

value 뒤의 값이 key scancode다.