开发者

Touch screen calibration values, How is it done in Android/Kernel?

开发者 https://www.devze.com 2023-04-05 05:28 出处:网络
I\'m porting Android Gingerbread to my custom board (with a Samsung S5PV210 processor). I have a touch screen with an ESC7000 chip. I found a driver in /kernel/drivers/input/touchscreen/usbtouchscreen

I'm porting Android Gingerbread to my custom board (with a Samsung S5PV210 processor). I have a touch screen with an ESC7000 chip. I found a driver in /kernel/drivers/input/touchscreen/usbtouchscreen.c . It almost worked but the bit range, order and byte ordering was not good in the USB packets. I modified the code to get the right RAW position (used printk on console to see it) and now it almost works. My data range from xmin, ymin to xmax, ymax is 420,430 to 3650, 3650 while in theory, it should be 0,0 to 4095,4095. That is not surprising since a capacitive touch needs calibration. This is a simple calibration like y=mx+b for each axis (simple linear calibration). I looked around in the drivers and I can't figure out where the calibration is processed. It has to be programmable since it's unit dependent and is to be calibrated for each unit one time in system production. I want to do it clean like other Android device. Anybody knows where the calibration information is stored in an Android system? Where is the code doing the compensation calculation. Any web search about that gives information about p开发者_StackOverflow社区eople wanting to recalibrate their phone. So it's useless for me.


Have a look at the following thread: https://groups.google.com/forum/#!msg/rowboat/jlbwnmCIDg0/makHFil31pQJ

On EVMs we pass the calibrated values(or let us say hardcoded values for Xmin/max, Ymin/max and XY resolution) from the driver to the user space.

Raw events are handled here frameworks/base/libs/ui/InputReader.cpp

SingleTouchInputMapper::process(const RawEvent* rawEvent) will process raw events for a Single touch device. ABS_X and ABS_Y are the values passed from driver and these are the absolute coordinates in our case as I told you in my earlier mail.

Correct me if I'm wrong, afaik Android phones have no mechanism to do calibration from user space. It is a sort of standard in Android phones to send the calibrated values from driver itself.

What I suggest is, use tslib to calibrate and let it store values in /etc/pointercal. In SingleTouchInputMapper::sync(nsecs_t when) calculate the absolute coordinates by parsing the values from /etc/pointercal file.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号