Today, I found myself a bit of spare time and played with corgi_ts.c to make touchscreen better. First, I put a printk line in corgi_ts.c to see what kind of value is passed to Android. The coordinate was in landscape view, origined from top-left. The default style of Android is landscape view. It wouldn't work.
So, I wrote a small patch to swap the coordinate like this;
diff -ur linux-2.6.23/drivers/input/touchscreen/corgi_ts.c linux-2.6.23-new/drivers/input/touchscreen/corgi_ts.c
--- linux-2.6.23/drivers/input/touchscreen/corgi_ts.c 2008-03-18 18:39:56.779191359 +0900
+++ linux-2.6.23-new/drivers/input/touchscreen/corgi_ts.c 2008-03-18 19:44:02.823705338 +0900
@@ -183,11 +183,14 @@
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);
- input_report_abs(dev, ABS_PRESSURE, corgi_ts->tc.pressure);
- input_report_key(dev, BTN_TOUCH, corgi_ts->pendown);
- input_sync(dev);
+ if ((X_AXIS_MIN < corgi_ts->tc.y && corgi_ts->tc.y < X_AXIS_MAX) &
+ (Y_AXIS_MIN < corgi_ts->tc.x && corgi_ts->tc.x < Y_AXIS_MAX)) {
+ input_report_abs(dev, ABS_X, Y_AXIS_MAX - corgi_ts->tc.y);
+ input_report_abs(dev, ABS_Y, corgi_ts->tc.x);
+ input_report_abs(dev, ABS_PRESSURE, corgi_ts->tc.pressure);
+ input_report_key(dev, BTN_TOUCH, corgi_ts->pendown);
+ input_sync(dev);
+ }
}
static void ts_interrupt_main(struct corgi_ts *corgi_ts, int isTimer)
@@ -267,6 +270,18 @@
#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)
{
struct corgi_ts *corgi_ts;
@@ -302,10 +317,13 @@
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);
- input_set_abs_params(input_dev, ABS_X, X_AXIS_MIN, X_AXIS_MAX, 0, 0);
- input_set_abs_params(input_dev, ABS_Y, Y_AXIS_MIN, Y_AXIS_MAX, 0, 0);
+ input_set_abs_params(input_dev, ABS_X, Y_AXIS_MIN, Y_AXIS_MAX, 0, 0);
+ input_set_abs_params(input_dev, ABS_Y, X_AXIS_MIN, X_AXIS_MAX, 0, 0);
input_set_abs_params(input_dev, ABS_PRESSURE, PRESSURE_MIN, PRESSURE_MAX, 0, 0);
pxa_gpio_mode(IRQ_TO_GPIO(corgi_ts->irq_gpio) | GPIO_IN);
It looks OK. Pointer Location applet in Dev Tools works fine. It draws lines between dots where I tapped with a stylas pen. And pressure value is passed correctly. Red bar on the top of following image shows pressure value passed from touchscreen driver.

But. Still touchscreen works only in the first applet. If I switch to Google Map after playing with Pointer Location, touchscreen input is gone. After reboot, I tried Google Map first, touchscreen works.
Anyway, one step at a time.
Cheers,
posted by 安藤恐竜 at 19:23
|
Comment(32)
|
TrackBack(0)
|
日記