Is there any documentation on the format of the getevent and sendevent shell commands? specifically the ones for touchevents. or is this device-dependent?

it is a bit hard to guess what those ids are doing.

2 Answers 2


There is some documentation on the AOSP site:

Plus several Howtos like e.g.

However, the answer to your question on Google Groups states:

No, this is fairly device-dependent. getevent prints a summary of all the devices so you know what those are. The data generated for a device are generally the Linux kernel's event protocol, so you can look there for further help, but there is no guarantee that a particular device will be following those conventions.

  • Not all of them work... for security reasons, you cannot inject touch events/keyboard events into an activity.. unless the app is system-signed :)
    – t0mm13b
    Commented Aug 14, 2012 at 14:34
  • Well -- the question was about "any documentation" -- not whether something works :) But I'd say your commend shall be added to "any documentation", as it's a useful hint!
    – Izzy
    Commented Aug 14, 2012 at 14:38
  • Seems the url for documentation has changed to source.android.com/devices/input/getevent
    – Ramast
    Commented Dec 3, 2018 at 0:14
  • Thanks, @Ramast, updated (and some of the other URLs, too – unfortunately, some others are gone for good).
    – Izzy
    Commented Dec 3, 2018 at 7:08

That will depend on the factors for the kernel in question:

  • If it has uinput enabled then that's good...
  • Touchscreen drivers, some initialize themselves to reside anywhere within /dev/input/eventX
  • How the kernel handles the input, for the hardware buttons

If this passes the three criteria above, then by reading certain events from /dev/input/eventX where X is a number - this will be determined at boot-time, depending on the ordering of loading the appropriate drivers. This will vary but you can try it out and see:

  • adb shell cat /dev/input/eventX (where X is a number, you will need to know before hand!)
  • depending on which event it is then you can see funny things happening on the screen based on the appropriate /dev/input/eventX being outputted.

The values are in encoded form, based on the kernel's input structure - struct input_event which can be found in most kernel sources under include/linux/input.h.

Be careful! Depending on the touchscreen driver used, some, do not actually return the proper coordinates - that's left as an exercise :)

On the Samsung GT-i5500 running Eclair, /dev/input/event2 is the touchscreen and the values are in encoded form, this is not to be taken for granted as that will depend on what touchscreen driver is used. On the Sony ST15i, running ICS, its, surprisingly, the same! But on the Zte Blade, its /dev/input/event1.

Incidentally, I did some work about a year ago, on creating a touchscreen for ClockWorkMod Recovery which can be found over on Modaco.

The real painful part was trying to determine which event was the touchscreen and act on it accordingly which was ported over to Zte Skate, Zte Racer and Samsung GT-i5500.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .