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.
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It only takes a minute to sign up.
Sign up to join this communityThere 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.
That will depend on the factors for the kernel in question:
uinput
enabled then that's good.../dev/input/event
XIf this passes the three criteria above, then by reading certain events from /dev/input/event
X 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/event
X (where X is a number, you will need to know before hand!)/dev/input/event
X 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.