15

I'm trying to figure out what format the output is from the getevent command in the adb shell.

For example, the output looks like this:

adb shell getevent -t | grep event1

The -t flag provides a timestap and the grep is to filter the messages to only the touch screen's events.

22779-197145: /dev/input/event1: 0003 003a 00400001

22779-197999: /dev/input/event1: 0003 0039 82c30a97

22779-218477: /dev/input/event1: 0003 003a 00390001

22779-219301: /dev/input/event1: 0003 0039 82c30aa4

22779-230623: /dev/input/event1: 0003 003a 002f0001

22779-231416: /dev/input/event1: 0003 0039 82c10aae

22779-242769: /dev/input/event1: 0003 003a 00190001

22779-243623: /dev/input/event1: 0003 0039 82c60ac1

22779-253328: /dev/input/event1: 0003 003a 00000002

22779-254213: /dev/input/event1: 0003 0039 82da0ae4

22779-415590: /dev/input/event1: 0003 003a 00000000

22779-416444: /dev/input/event1: 0003 0039 800b1549

The problem is that I have no idea how to process this information. While the seconds last field alternates between two codes (which has been suggested to correspond to X and Y values), the last field seems to either contain huge or very small numbers.

Furthermore, the timestamp is also foreign to me. I wonder if the part after the dash are nanoseconds?

Does anyone know where I can find out about the format of these things?

pypmannetjies
  • 25,734
  • 7
  • 39
  • 49

4 Answers4

15

/dev/input/eventX is used by evdev linux kernel subsystem which is generic input event layer handling events and passing it timestamped to the apps. You can try this to get more human readable output on what is going on Android with getevent tool, like this:

$ adb shell getevent -lp /dev/input/event1

To get all getevent's options, do:

$ adb shell getevent --help

You can read more about getevent tool here and about evdev on Wiki.

According to kernel sources, evdev use nanosecond-resolution time format (ktime) and the sources are in linux/next/include/linux/ktime.h or here, if you want to view it online.

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
2

It doesn't look like touchscreen touches were made in your snippet or possibly x and y were not recorded.

Usually, X coordinates for touch screen are under 0003 0035 and Y is under 0003 0036 whilst 0003 0039 is usually for the finger down (with the last field looking more like 00000000) and for finger up (with the last field also looking more like ffffffff).

Not exactly sure what 0003 003a is for but it seems of little importance and it's definitely not the X or Y hexadecimal.

Also, the timestamp is measured in seconds. The section before the dash in the timestamp represents the Unix Epox on the 1st January 1970 at UTC and the timestamp after the dash becomes a date based on the seconds since the aforementioned time and date.

Hope that adds some more clarity.

Wills
  • 61
  • 4
1

0x35 = X axis

0x36 = Y axis

follow this link for getevent tool

https://source.android.com/devices/input/getevent

and to see the meaning of each details follow this header file.

https://android.googlesource.com/kernel/msm.git/+/android-msm-hammerhead-3.4-kk-r1/include/linux/input.h

ABCDE
  • 31
  • 5
0

You can read more about getevent tool here (archived on archive.org)

https://web.archive.org/web/20120122010833/http://source.android.com/tech/input/getevent.html

Werner925
  • 39
  • 3