最終更新:2017-05-30 (火) 14:23:19 (118d)  

evtest はてなブックマークを見る
Top / evtest

utility to monitor Linux input device events

http://cgit.freedesktop.org/evtest/

使い方

evtest /dev/input/eventX
evtest --query /dev/input/eventX <type> <value>

ビルド

  • CentOSにパッケージはないのでビルドする
    $ git clone https://anongit.freedesktop.org/git/evtest.git
    $ gcc -o evtest evtest.c

処理の流れ

  • $ sudo evtest
    No device specified, trying to scan all of /dev/input/event*
    Available devices:
    /dev/input/event0:	Power Button
    /dev/input/event1:	Sleep Button
    /dev/input/event2:	AT Translated Set 2 keyboard
    /dev/input/event3:	VirtualBox USB Tablet
    /dev/input/event4:	VirtualBox mouse integration
    /dev/input/event5:	ImExPS/2 Generic Explorer Mouse
    $ sudo evtest
    No device specified, trying to scan all of /dev/input/event*
    Available devices:
    /dev/input/event0:	Power Button
    /dev/input/event1:	AT Translated Set 2 keyboard
    /dev/input/event2:	VMware VMware Virtual USB Mouse
    /dev/input/event3:	VMware VMware Virtual USB Mouse
    /dev/input/event4:	ImPS/2 Generic Wheel Mouse
    

Fedora 16

  • ***********************************************
      This device is grabbed by another process.
      No events are available to evtest while the
      other grab is active.
      In most cases, this is caused by an X driver,
      try VT-switching and re-run evtest again.
    ***********************************************

Ubuntu/パッケージ

evtest/バージョン?

CentOS 5でビルド

  • evtest.cに書きを追加
    #define KEY_VIDEOPHONE		0x1a0
    #define KEY_GAMES		0x1a1
    #define KEY_ZOOMIN		0x1a2
    #define KEY_ZOOMOUT		0x1a3
    #define KEY_ZOOMRESET		0x1a4
    #define KEY_WORDPROCESSOR	0x1a5
    #define KEY_EDITOR		0x1a6
    #define KEY_SPREADSHEET		0x1a7
    #define KEY_GRAPHICSEDITOR	0x1a8
    #define KEY_PRESENTATION	0x1a9
    #define KEY_DATABASE		0x1aa
    #define KEY_NEWS		0x1ab
    #define KEY_VOICEMAIL		0x1ac
    #define KEY_ADDRESSBOOK		0x1ad
    #define KEY_MESSENGER		0x1ae
    
    #define KEY_DISPLAYTOGGLE	0x1af	/* Turn display (LCD) on and off */
    #define KEY_BRL_DOT9		0x1f9
    #define KEY_BRL_DOT10		0x1fa
    
    #define KEY_BLUETOOTH		237
    #define KEY_SCREENLOCK		KEY_COFFEE
    #define KEY_CNT			(KEY_MAX+1)

Android

関連