Evtest

From Texas Instruments Wiki
Jump to: navigation, search

About

evtest is a open source tool that can be used for testing the USB HID class drivers and any other drivers based on event framework . Its an event device test program. It helps in seeing the event layer events that a USB HID device like a USB keyboard or a USB mouse or a keypad or a touchscreen might be generating. Thus it can be used to test USB HID(USB Mouse and USB keyboard),keypad and touchscreen modules.

Supports-

  • Detection of USB mouse movements, left button click, right button click, middle button click, wheeling.
  • Detection of keys pressed on USB keyboard .Value of key pressed appears on the serial console.
  • Detection of keys pressed on keypad.Value of key pressed appears on the serial console.
  • Detection of pressure values on touching the touchscreen.

Visit evtest man page for more information.

Source Download Location


Cross compiling

  • Cross compilation command - $(TOOL_CHAIN_PREFIX)-gcc -o evtest evtest.c.
    • The TOOL_CHAIN_PREFIX corresponds to the tool chain in use. Set this based on your tool chain. Also make path to toolchain is exported as part of $PATH.


Test setup

  • EVM booted up with NFS configuration.
  • Connect a USB mouse and USB keyboard through a USB Hub to the EVM.


Execution

  • evtest /dev/input/event X ---- Test the USB Mouse,USB Keyboard,Keypad or touchscreen.
    • X can be 0,1,2 or 3 ...

Please note that the event number( X ) changes based on the order of plugin. So please make sure to provide the right event number.


Execution logs

Testing USB Mouse
---------------------
[root@beagleboard]# evtest /dev/input/event2
Press the Mouse button and observe the screen

Example if Left button is pressed and released the following lines should get displayed on console

Event: time 1871.724792, -------------- Report Sync ------------
Event: time 1873.804687, type 1 (Key), code 272 (LeftBtn), value 1
Event: time 1873.804687, -------------- Report Sync ------------
Event: time 1873.964660, type 1 (Key), code 272 (LeftBtn), value 0
Event: time 1873.964660, -------------- Report Sync ------------Moving the Mouse also results in Console messages
Event: time 1959.120635, -------------- Report Sync ------------
Event: time 1959.130676, type 2 (Relative), code 0 (X), value -21
Event: time 1959.130676, -------------- Report Sync ------------
Event: time 1959.140625, type 2 (Relative), code 0 (X), value -16

Testing USB keyboard
---------------------

root@beagleboard]# evtest /dev/input/event3

Press a Key on USB KeyBoard, 

Example if "a" is pressed the following output is seen on Console:

Event: time 1657.754638, type 1 (Key), code 30 (A), value 1
Event: time 1657.754638, -------------- Report Sync ------------
Event: time 1657.964599, type 1 (Key), code 30 (A), value 0
Event: time 1657.964599, -------------- Report Sync ------------

Testing touchscreen
-----------------------
root@arago:/STUsers# ./evtest /dev/input/event1
Input driver version is 1.0.0<4>evdev.c(EVIOCGBIT): Suspicious buffer size 511,
limiting output to 64 bytes. See http://userweb.kernel.org/~dtor/eviocgbit-bug.h
tml
evdev.c(EVIOCGBIT): Suspicious buffer size 511, limiting output to 64 bytes. See
 http://userweb.kernel.org/~dtor/eviocgbit-bug.html

Input device ID: bus 0x0 vendor 0x0 product 0x0 version 0x0
Input device name: "ADS784x Touchscreen"
Supported events:
  Event type 0 (Sync)
  Event type 1 (Key)
    Event code 330 (Touch)
  Event type 3 (Absolute)
    Event code 0 (X)
      Value      0
      Min        0
      Max     4095
    Event code 1 (Y)
      Value      0
      Min        0
      Max     4095
    Event code 24 (Pressure)
      Value      0
      Min        0
      Max      255
Testing ... (interrupt to exit)
Event: time 1233761671.219512, type 1 (Key), code 330 (Touch), value 1
Event: time 1233761671.219512, type 3 (Absolute), code 0 (X), value 1970
Event: time 1233761671.219512, type 3 (Absolute), code 1 (Y), value 813
Event: time 1233761671.219512, type 3 (Absolute), code 24 (Pressure), value 226
Event: time 1233761671.219543, -------------- Report Sync ------------
Event: time 1233761671.387817, type 3 (Absolute), code 0 (X), value 2102
Event: time 1233761671.387847, type 3 (Absolute), code 1 (Y), value 1254
Event: time 1233761671.387847, type 3 (Absolute), code 24 (Pressure), value 245
Event: time 1233761671.387847, -------------- Report Sync ------------
Event: time 1233761671.413604, type 3 (Absolute), code 0 (X), value 2096
Event: time 1233761671.413604, type 3 (Absolute), code 1 (Y), value 1282
Event: time 1233761671.413604, type 3 (Absolute), code 24 (Pressure), value 252
Event: time 1233761671.413635, -------------- Report Sync ------------
Event: time 1233761671.519775, type 1 (Key), code 330 (Touch), value 0
Event: time 1233761671.519805, type 3 (Absolute), code 24 (Pressure), value 0
Event: time 1233761671.519805, -------------- Report Sync ------------


Testing keypad
-------------------
root@arago:/STUsers# ./evtest_executable /dev/input/event0
Input driver version is 1.0.0<4>evdev.c(EVIOCGBIT): Suspicious buffer size 511,
limiting output to 64 bytes. See http://userweb.kernel.org/~dtor/eviocgbit-bug.h
tml
evdev.c(EVIOCGBIT): Suspicious buffer size 511, limiting output to 64 bytes. See
 http://userweb.kernel.org/~dtor/eviocgbit-bug.html

Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x3
Input device name: "omap_twl4030keypad"
Supported events:
  Event type 0 (Sync)
  Event type 1 (Key)
    Event code 18 (E)
    Event code 23 (I)
    Event code 24 (O)
    Event code 25 (P)
    Event code 28 (Enter)
    Event code 30 (A)
    Event code 33 (F)
    Event code 36 (J)
    Event code 37 (K)
    Event code 48 (B)
    Event code 49 (N)
    Event code 50 (M)
    Event code 103 (Up)
    Event code 105 (Left)
    Event code 106 (Right)
    Event code 108 (Down)
  Event type 20 (Repeat)
Testing ... (interrupt to exit)
Event: time 1233761734.520599, type 1 (Key), code 37 (K), value 1
Event: time 1233761734.715148, type 1 (Key), code 37 (K), value 0
Event: time 1233761738.967529, type 1 (Key), code 108 (Down), value 1
Event: time 1233761739.182342, type 1 (Key), code 108 (Down), value 0
Event: time 1233761743.785919, type 1 (Key), code 28 (Enter), value 1