Touchscreen works in Android?

100 Aufrufe
Direkt zur ersten ungelesenen Nachricht

Marty

ungelesen,
13.05.2008, 02:31:3013.05.08
an Android Internals
Dear all,

I am trying to slove the touchscreen problem in Android.

The Android's GUI doesn't seem accept touchscreen's event, but mouse
event.

Is this assumption correct ?

BTW, does anyone's touchscreen of Android work well in real HW?

Ref: http://androidzaurus.seesaa.net/article/74237419.html

Marty

ungelesen,
13.05.2008, 04:30:3913.05.08
an Android Internals
However, the applet Pointer Location ( Android menu -> All -> Dev
tools -> Pointer Location ), it can work well with touch screen.

Akio

ungelesen,
13.05.2008, 09:52:5013.05.08
an Android Internals
Dear Marty:

About One month ago, I worked on how to make touchscreen work
under android on freescale i.mx27.
If you want to know what I am done, please check the url.
http://androidzaurus.seesaa.net/article/90045743.html

Right now, I am working on how to dejitter and make the report
touched point more smoothly.
If you have any problem, I think we can discuss it.

BTW, what is your hw platform?

Best Regards,
Akio

Marty

ungelesen,
13.05.2008, 23:14:0913.05.08
an Android Internals
Dear Akio,

Thanks for you reply.
My environment is Qemu emulating as Sptiz (Sharp SL3000).
The touchscreen function works well in X-Window, such as Opie,
OpenMoko and Poky. However, Android not works.

However, the AZ wrote a new article - http://androidzaurus.seesaa.net/article/96581331.html
Touchscreen have 4 attributes of event - x, y, pressure and pendown.
The critical point is “pendown” attribute, I disregard it for a long
time.

This problem is solved now. :D

Marty

Akio

ungelesen,
14.05.2008, 10:08:0114.05.08
an Android Internals

Dear Marty:

It is a good news. would you like to share how to solve the
problem?
thank you very much.

Best Regards,
Akio



On May 14, 11:14 am, Marty <cs87...@gmail.com> wrote:
> Dear Akio,
>
> Thanks for you reply.
> My environment is Qemu emulating as Sptiz (Sharp SL3000).
> The touchscreen function works well in X-Window, such as Opie,
> OpenMoko and Poky. However, Android not works.
>
> However, the AZ wrote a new article -http://androidzaurus.seesaa.net/article/96581331.html

Marty

ungelesen,
14.05.2008, 22:41:4414.05.08
an Android Internals
Dear Akio,

There are two problems have to be solved:
1. Point calibration (rotate with 90 degree)
2. Pen down issue

The behavior of touch screen is incorrect.
If you draw a vertical line, however, a horizontal line is shown.
So that, we have to rotate the behavior of touch screen with 90
degree.
The path in http://androidzaurus.seesaa.net/article/90045743.html can
solve this problem.

The solution of pen down issue can be found in
http://androidzaurus.seesaa.net/article/96581331.html.
Android detect pen down event. Therefore, not only x, y, pressure
events,
but aloes pen down event is necessary for Android GUI.
The corgi_ts driver didn’t implement the event in the code, however,
the second link above can solve this issue.
After patching, the touch screen work more normally. But the deviation
of (X,Y) is still exist.

Marty :D

Akio

ungelesen,
15.05.2008, 10:14:4315.05.08
an Android Internals
Dear Marty:

Thank you very much.
Right now, I can do more better than before.

The following is my stupid solution to solve calibration :P

1. using tslib's utility ts_calibrate to get the correct
coefficient.
2. send the coefficient to the touch panel driver (right now
is hard code, in the future will be via /proc)
3. report calibrated pen down event to android.

BTW, do you have jitter problem?

Best Regards,
Akio

On May 15, 10:41 am, Marty <cs87...@gmail.com> wrote:
> Dear Akio,
>
> There are two problems have to be solved:
> 1. Point calibration (rotate with 90 degree)
> 2. Pen down issue
>
> The behavior of touch screen is incorrect.
> If you draw a vertical line, however, a horizontal line is shown.
> So that, we have to rotate the behavior of touch screen with 90
> degree.
> The path inhttp://androidzaurus.seesaa.net/article/90045743.htmlcan
> solve this problem.
>
> The solution of pen down issue can be found inhttp://androidzaurus.seesaa.net/article/96581331.html.

Marty

ungelesen,
16.05.2008, 02:49:0116.05.08
an Android Internals
Dear Akio,
Thank for your hits again, it help a lot!
I have tried tslib-1.4 today.
I can utilize ts_calibrate to calibrate touch screen, and the cursor
in ts_test work normally. However, the jitter problem exists in
ts_test.
I found a article - http://wiki.kldp.org/wiki.php/AndroidPortingOnRealTarget
The author utilizes tslib to calibrate touchs creen in Android too.
In the article, he sets the environment variable of TSLIB, and then
start-up Android. However, it has no effect in mine environment.

BTW, the content of /etc/pointercal, I can’t understand it. The
content of my pointercal file in:
70356 0 1468924 0 70547 -483124 655364 6553665536
(6553665536 is weire, it should be 65536 65536)
There are no document describe can be refered.
How can I utilize the pointercal data to calibrate Android’s behavior
of touch screen?
Thank you

---------The result of ts_calibrate ---------
xres=640, yres=480
Took 2 sample...
Top left: x = 25, Y = 53
Took 8 sample...
Top right: X = 259, Y = 53
Took 7 sample...
Bot right: X = 528, Y = 406
Took 5 sample...
Bot left: X = 26, Y = 406
Took 4 sample...
Center: X = 278, Y = 231

22.414001 1.073551 -0.00001
-7.371877 -0.000005 1.076471
Calibration contents: 1468924 70356 0 -483124 0 70547 655364 65536

Marty

ungelesen,
16.05.2008, 04:13:5816.05.08
an Android Internals
sorry, the content of pointercal file is:

70356 0 1468924 0 70547 -483124 65536@4 65536@65536@

Marty :)

Akio

ungelesen,
16.05.2008, 09:51:1916.05.08
an Android Internals
Dear Marty:

You have to check the following file from tslib.
plugins\linear.c, linear_read(), it uses the content of
pointcal
70356 0 1468924 0 70547 -483124 65536
a[0] for 70356
a[1] for 0
a[2] for 1468924
a[3] for 0
a[4] for 70547
a[5] for -483124
a[6] for 65536

a[6] is for scale factor.

plugins\dejitter.c, average(), it is a digital filter.
plugins\variance.c, variance_read(), it filter outs sample
noise.

if You spend some time to know the above three function's
purpose, you will find out
what I'm thinking.

According my experience, if you use the calibrate data in
the touch screen module,
the report data must just fit the exactly LCD absolute
position.

in initial phase,
input_set_abs_params(mxc_inputdev, ABS_X, LCD_X_MIN,
LCD_X_MAX, 0, 0);
input_set_abs_params(mxc_inputdev, ABS_Y, LCD_Y_MIN,
LCD_Y_MAX, 0, 0);

in event report phase,
input_report_abs(mxc_inputdev, ABS_X, ABS_X);
input_report_abs(mxc_inputdev, ABS_Y, ABS_Y);
which ABS_X and ABS_Y is the calibrated value of the sample
position.

Forgot the tslib's setting. Android seems don't use the
tslib as the input event interface.
That's why I pass the result into mxc_ts.c and report the
calibrated data to Android.

Hope those information can help you. :)

Best Regards,
Akio

Akio

ungelesen,
16.05.2008, 09:56:0116.05.08
an Android Internals
Dear Marty:

http://www.embedded.com/story/OEG20020529S0046
if you want to how to get the value of the pointcal, you can study the
above
URL. BTW, there is another documents from TI analog application
notes,
also talking about the same thing of touch screen calibration and how
to
implement. if you want to know the detail, you can check out the
following code
in tslib, tests\ts_calibrate.c, which have the whole algorithm which
implements the
above mathematics.

Best Regards,
Akio

Marty

ungelesen,
16.05.2008, 22:40:5316.05.08
an Android Internals
Dear Akio,

thank you very much!!

You teach me a lot :D

Akio

ungelesen,
17.05.2008, 07:41:0817.05.08
an Android Internals
Dear Marty:

You are welcome.
I learned those from the android hackers and related experts
who provide the touch screen know how.
I just make a summery. :)

Best Regards,
akio

nienfeng

ungelesen,
22.05.2008, 01:26:3922.05.08
an Android Internals
Dear Akio, Marty:

Thanks for you.
I have finished the calibration of touch screen in spitz platform.
But I tuned it by manually, change the value and observe the behavior
in android.
The following the what I modified in linux-2.6.23/drivers/input/
touchscreen/corgi_ts.c

--- corgi_ts.c.org 2008-05-13 18:36:20.000000000 +0800
+++ corgi_ts.c 2008-05-22 13:07:56.000000000 +0800
@@ -167,8 +167,10 @@
return 0;
}

- corgi_ts->tc.x = x;
- corgi_ts->tc.y = y;
+ corgi_ts->tc.x = y - 300;
+ corgi_ts->tc.y = x - 200;
+
+
corgi_ts->tc.pressure = (x * (z2 - z1)) / z1;
return 1;
}
@@ -176,6 +178,7 @@
static void new_data(struct corgi_ts *corgi_ts)
{
struct input_dev *dev = corgi_ts->input;
+ int x,y;

if (corgi_ts->power_mode != PWR_MODE_ACTIVE)
return;
@@ -183,8 +186,15 @@
if (!corgi_ts->tc.pressure && corgi_ts->pendown == 0)
return;

- input_report_abs(dev, ABS_X, corgi_ts->tc.x);
- input_report_abs(dev, ABS_Y, corgi_ts->tc.y);
+ x = X_AXIS_MAX - corgi_ts->tc.x -220;
+ x = (x*106)/100;
+ y= corgi_ts->tc.y + 190;
+ y= (y*105)/100;
+
+ /*input_report_abs(dev, ABS_X, X_AXIS_MAX - corgi_ts->tc.x);*/
+ /*input_report_abs(dev, ABS_Y, corgi_ts->tc.y + 200);*/
+ input_report_abs(dev, ABS_X, x);
+ input_report_abs(dev, ABS_Y, y);
input_report_abs(dev, ABS_PRESSURE, corgi_ts->tc.pressure);
input_report_key(dev, BTN_TOUCH, corgi_ts->pendown);
input_sync(dev);
@@ -215,6 +225,8 @@
/* Enable Falling Edge */
set_irq_type(corgi_ts->irq_gpio, IRQT_FALLING);
corgi_ts->pendown = 0;
+ input_report_key(corgi_ts->input, BTN_TOUCH, corgi_ts-
>pendown);
+ input_sync(corgi_ts->input);
}
}

@@ -266,6 +278,17 @@
#define corgits_suspend NULL
#define corgits_resume NULL
#endif
+static int corgits_open(struct input_dev *input)
+{
+ printk("corgi_ts: open\n");
+ return 0;
+}
+
+static void corgits_close(struct input_dev *input)
+{
+ printk("corgi_ts: close\n");
+ return;
+}

static int __init corgits_probe(struct platform_device *pdev)
{
@@ -301,6 +324,8 @@
input_dev->id.product = 0x0002;
input_dev->id.version = 0x0100;
input_dev->dev.parent = &pdev->dev;
+ input_dev->open = corgits_open;
+ input_dev->close = corgits_close;

input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
Allen antworten
Antwort an Autor
Weiterleiten
0 neue Nachrichten