evtest displays information on the input device specified on the command line, including all the events supported by the device. It then monitors the device and displays all the events layer events generated. ((From the man page) )
How to get the log file
Here are the general steps to follow. Note these steps somewhere, as you will not be able to see this window when you enter a VT.
- Press Crtl+Alt+F2 from your keyboard (Return to this page by Ctrl+Alt+F7).
- You will enter a virtual terminal (tty2) and X is no longer active.
- Now login with you username and password.
Type the following in your VT.
You may find a input device something like this in your devices file.
I: Bus=0011 Vendor=0002 Product=0007 Version=01b1 N: Name="SynPS/2 Synaptics TouchPad" P: Phys=isa0060/serio2/input0 S: Sysfs=/devices/platform/i8042/serio2/input/input8 U: Uniq= H: Handlers=mouse2 event8 B: EV=b B: KEY=420 0 70000 0 0 0 0 0 0 0 0 B: ABS=11000003
- Or find some other relevant input device which you want to debug.
- Take note of X in eventX. In this case its event8( H: Handlers=mouse2 event8)
Now start evtest by typing in your VT
- Type an identifier(say a) from the keyboard.
- Generate appropriate events from the mouse or keyboard without generating unnecessary events, as this will create noise in the log file.
- Again type an identifier(same as above). This will help to find relevant events from the log file later.
- Close as soon as possible, and try to generate minimum events to keep the log file small and readable.
- Upload the log file.
How to use the tool?
evtest is not installed by default in ubuntu installation. Instead you must install it by using apt-get.
sudo apt-get install evtest
evtest should be used outside of X. This is because the X-driver grabs the device when active. This means that the kernel delivers hw events to the driver itself and not to any other device opener (ie-evtest). This is why we should switch to a VT so that the X-driver ungrabs the device node allowing others to receive events. (Thanks to Mattia Dongili and Peter Hutterer for help on this, in an email)
evtest needs to be able to read from the device; in most cases this means it must be run as root.
When to use the tool?
This tool is extremely useful when we need to verify what events kernel is generating in response to device specific hardware events. Thus if the events are not as expected then the bug is right inside the kernel and in the other case the bug is somewhere above kernel in X or in some other driver.