Android provides an ADB command getevent to obtain input events, such as obtaining key reporting events, obtaining touch screen reporting events, etc.
Users can use this command under the ADB console.
Usage
The usage of this command is:
We input adb shell getevent -h on the CMD command line and will get the help information about this command.
To display which input devices are on the system, use
the command will return all of the input devices that the system used. For below my example, there are 7 input devices that registered at dev/input.
Below are some examples, we can find the touchscreen input event is registered at /dev/input/event2, so we use the touchscreen as an input device for the interpretation.
non-parameter:
Here the first column represents the EVENT_TYPE, the second column displays the EVENT_CODE and the third column is EVENT_VALUE.
-t: display timestamp
-r: print report rate
-p: print the event informaiton supported by the device.
-i: similar to -p, but will contain more information.
-l: print the event type/event code by plain text.
Compare with the default output, the -l output use the plain text replace the raw code of EVENT_TYPE/EVENT_CODE/EVENT_VALUE which is more intuitive.
-c: print given number of events then exit
normal when we debug the touchscreen, we usually use below command to obtain the input event. This command will give all information with plain text output, which is useful for obtain the image of which input event is occurring.