Skip to content

Instantly share code, notes, and snippets.

@tmtm
tmtm / auto_input_key.rb
Last active December 28, 2021 01:56
自動的に 0〜9 キーを入力する
# 自動的に 0〜9 キーを入力する
UI_SET_EVBIT = 1074025828
UI_SET_KEYBIT = 1074025829
UI_DEV_SETUP = 1079792899
UI_DEV_CREATE = 21761
EV_KEY = 1
EV_SYN = 0
SYN_REPORT = 0
@tmtm
tmtm / key_event.rb
Last active December 28, 2021 03:08
キーイベントを表示する
# キーイベントを表示する
EV_KEY = 1
EVIOCGRAB = 1074021776
key_code = {}
IO.readlines('/usr/include/linux/input-event-codes.h').each do |line|
if line.sub(/\/\*.*/, '') =~ /#define\s(KEY_\w+)+\s+(.+)(\/\*.*)?$/
key, code = $1, $2
eval("#{key} = #{code}")