Answer the question
In order to leave comments, you need to log in
How to solve the problem of handling touchscreen events in Android?
Hello developers!
There is a Geniatech ATV1200 TV box based on Android 4.1.2 used as CarPC. A self-made USB resistive touchscreen is connected to it, described here: pccar.ru/showthread.php?t=18943. This touch worked great on an older TV box (Android 2.3) and also works great under Windows XP.
When connected to an ATV1200, a strange effect occurs: the touchscreen coordinate handler rotates them 90 degrees every about 4 seconds. That is, if you click on the same point of the screen, the click is registered sequentially at 4 points with an interval of about 4 seconds, then the cycle repeats. By the position of the points on the screen, it can be seen that at first the coordinates are reversed, then they are reversed, then they are interchanged + mirrored, then they are displayed correctly. Those. The touch only works correctly 25% of the time. Of course, you can't use it.
I run getevent via SSH. Raw coordinates are correct (0..32767) for each coordinate, there is no rotation. What happens to the coordinates further and who distorts them, I don’t know, and why! At the same time, they are correctly scaled based on their current screen resolution. All that I could find on the Internet is that there is a certain InputReader compiled into the kernel and it is responsible for everything. In principle, I also have the kernel sources, but compiling them is beyond my power. :) If you use the test utility input tap XY, then the clicks are registered in the correct place without glitches. Those. someone buggy sat down between Linux and Android. ))
I tried to change the parameters in the IDC file (the config of the wheelbarrow is /system/usr/idc). I have touch.deviceType = touchScreen. If you put a pointer, it starts working correctly, but the coordinates are not absolute (the cursor moves across the screen, the click is registered not at the point of pressing, but at the point where the cursor is located, i.e. it just works like a touchpad detached from the display). If you set the touchPad type, it stops working completely, although the events go to / dev / input / event3 (this is a touch). Changed parameters are reflected in the dumpsys input command.
The author of the USB wheelbarrow is not me, but I participated a little in finishing the firmware and am well versed in it. I can recompile, change the coordinate range of the wheelbarrow, invert them, etc., change the events that it generates. But it works absolutely correctly, the impression is that the problem is in Android itself. It gives me ABS_X, ABS_Y, BTN_TOUCH, BTN_TOOL_FINGER. These are the standard requirements for a single-touch wheelbarrow.
I would like to hear any at least some thoughts, I honestly broke my head. In principle, I almost wrote a native application using the Sourcery G++ cross-compiler, which takes events from /dev/input/event3, parses them, pulls out coordinates with clicks and sends the necessary events to mouse0. But this is complete curvature, of course.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question