about android touch pannel

75 views
Skip to first unread message

zhqzh1982

unread,
Dec 11, 2008, 7:58:46 PM12/11/08
to android-porting
hi
my touch pannel driver use input system with event interface
when pen down ,i input the x valuer y value and pressure value,just
below
if((x == 0)&&(y == 0)&&(pressure == 0)){
x = last_x;
y = last_y;
} else {
x = ((x- 80)*240)/(1300-80);
y = ((y - 380)*320)/(1600-400);
}
if (x != last_x) {
printk("the input x value is %d\n",x);
input_report_abs(ts->idev, ABS_X, x);
last_x = x;
}
if (y != last_y) {
printk("the input y value is %d\n",y);
input_report_abs(ts->idev, ABS_Y, y);
last_y = y;
}
if (pressure == last_press)
pressure--;

input_report_abs(ts->idev, ABS_PRESSURE, pressure & 0xfff);
and when pen up
i input the pressure value as 0,just below
input_report_abs(ts->idev, ABS_PRESSURE, 0);

but ,android's touch function do not work ,who can help me
thanks

zhqzh1982

unread,
Dec 11, 2008, 8:50:25 PM12/11/08
to android-porting
now i modify the simply calibrate way by
x = ((x- 80)*480)/(1300-80);
mean the x's value is from 0 to 480
y = ((y - 380)*640)/(1600-400);
the y's value is from 0 to 640
the tslib working ok,but android's touchscreen do not work

Reed Huang

unread,
Dec 11, 2008, 8:56:04 PM12/11/08
to android...@googlegroups.com
You need to send BTN_TOUCH event when the pen is down.

Refer to:
http://androidzaurus.seesaa.net/article/90045743.html

zhqzh1982

unread,
Dec 11, 2008, 9:39:59 PM12/11/08
to android-porting
you mean i shoul send a BTN_TOUCH pressure event.just like
input_event(ts->idev, EV_ABS, BTN_TOUCH, pressure);?

Reed Huang

unread,
Dec 11, 2008, 9:49:11 PM12/11/08
to android...@googlegroups.com
Correct. And only send once when the pen hit the touchscreen. like following:

        if(!wm->pen_is_down)
            input_report_key(wm->input_dev, BTN_TOUCH, 1);

        absx = data.x & 0xfff;
        absy = data.y & 0xfff;

        if(absy > wm->input_dev->absmax[ABS_Y])
            absy = wm->input_dev->absmax[ABS_Y];

        if(absx > wm->input_dev->absmax[ABS_X])
            absx = wm->input_dev->absmax[ABS_X];

        input_report_abs(wm->input_dev, ABS_X, absx);
        input_report_abs(wm->input_dev, ABS_Y, (wm->input_dev->absmax[ABS_Y] - absy) + wm->input_dev->absmin[ABS_Y]);
        input_report_abs(wm->input_dev, ABS_PRESSURE, data.p & 0xfff);
        input_sync(wm->input_dev);

Qingzhan Zhang

unread,
Dec 11, 2008, 10:23:01 PM12/11/08
to android...@googlegroups.com
still do not work
my init code is
         __set_bit(EV_ABS, codec_ts_input->evbit);
        __set_bit(EV_KEY, codec_ts_input->evbit);
        __set_bit(ABS_X, codec_ts_input->absbit);
        __set_bit(ABS_Y, codec_ts_input->absbit);
        __set_bit(BTN_TOUCH, codec_ts_input->absbit);
        __set_bit(ABS_PRESSURE, codec_ts_input->absbit);
and when pen down
if((x == 0)&&(y == 0)&&(pressure == 0)){
        x = last_x;
        y = last_y;
} else {
         x = ((x- 80)*480)/(1300-80);

         y = ((y - 380)*640)/(1600-400);
 }
        input_report_key(ts->idev,BTN_TOUCH,1);

         if (x != last_x) {
        printk("the input x value is %d\n",x);
         input_report_abs(ts->idev, ABS_X, x);
        last_x = x;
}
         if (y != last_y) {
        printk("the input y value is %d\n",y);
        input_report_abs(ts->idev, ABS_Y, y);
        last_y = y;
 }
        if (pressure == last_press)
               pressure--;

        printk("the pressure is %d\n",pressure); 
 input_report_abs(ts->idev, ABS_PRESSURE, pressure & 0xfff);
        input_sync(ts->idev);
 
when pen up
 printk("input the release event \n");
        input_report_abs(ts->idev, ABS_PRESSURE, 0);

Reed Huang

unread,
Dec 11, 2008, 10:31:20 PM12/11/08
to android...@googlegroups.com
Try changing this line:
      __set_bit(BTN_TOUCH, codec_ts_input->absbit);
to:
        __set_bit(BTN_TOUCH, codec_ts_input->keybit);

And when your pen is up, you should also send an event like:

            input_report_key(wm->input_dev, BTN_TOUCH, 0);

zhqzh1982

unread,
Dec 12, 2008, 12:00:24 AM12/12/08
to android-porting
thank you reed,now i think the android's touch screen is working ,but
the code value is not correct ,will you tell me the X /Y value's MAX
and MIN?
thank you
> zhqzh1982 wrote:you mean i shoul send a BTN_TOUCH pressure event.just like input_event(ts->idev, EV_ABS, BTN_TOUCH, pressure);? On 12月12日, 上午9时56分, Reed Huang<reed.hu...@gmail.com>wrote:You need to send BTN_TOUCH event when the pen is down. Refer to:http://androidzaurus.seesaa.net/article/90045743.htmlzhqzh1982 wrote:now i modify the simply calibrate way by x = ((x- 80)*480)/(1300-80); mean the x's value is from 0 to 480 y = ((y - 380)*640)/(1600-400); the y's value is from 0 to 640 the tslib working ok,but android's touchscreen do not work On 12月12日, 上午8时58分, zhqzh1982<qingz...@gmail.com>wrote:hi my touch pannel driver use input system with event interface when pen down ,i input the x valuer y value and pressure value,just below if((x == 0)&&(y == 0)&&(pressure == 0)){ x = last_x; y = last_y;} else { x = ((x- 80)*240)/(1300-80); y = ((y - 380)*320)/(1600-400); } if (x != last_x) { printk("the input x value is %d\n",x); input_report_abs(ts->idev, ABS_X, x); last_x = x; } if (y != last_y) { printk("the input y value is %d\n",y); input_report_abs(ts->idev, ABS_Y, y); last_y = y; } if (pressure == last_press) pressure--; input_report_abs(ts->idev, ABS_PRESSURE, pressure & 0xfff); and when pen up i input the pressure value as 0,just below input_report_abs(ts->idev, ABS_PRESSURE, 0); but ,android's touch function do not work ,who can help me thanks

Reed Huang

unread,
Dec 12, 2008, 1:23:22 AM12/12/08
to android...@googlegroups.com
In my case, the values are:

static int abs_x[3] = {245,3850,5};
static int abs_y[3] = {245,3860,40};

I am not sure whether they are applicable for your device.

Daniel Youn

unread,
Dec 17, 2008, 10:28:29 PM12/17/08
to android...@googlegroups.com
Hello, guys.

I'm porting Android to marvell pxa based platform.
and my touch device uses WM9713-touch drvier.

I've followed set up sequence which has been proved in this mailling list,
but can't get touch driver working.

Here's the logcat from my device.

I/EventHub(   45): New device: path=/dev/input/event0 name=wm9713-touch id=0x10000 (of 0x1) index=1 fd=48 classes=0x2
I/SystemServer(   45): Starting Status Bar Service.
I/EventHub(   45): New device: path=/dev/input/event1 name=pxa27x-keypad id=0x10001 (of 0x2) index=2 fd=51 classes=0x1
I/EventHub(   45): New keyboard: publicID=65537 device->id=65537 devname='pxa27x-keypad propName='hw.keyboards.65537.devname' keylayout='/system/usr/keylayout/qwerty.kl'
E/EventHub(   45): could not get driver version for /dev/input/mouse0, Not a typewriter
I/KeyInputQueue(   45): Device added: id=0x0, name=pxa27x-keypad, classes=1
I/KeyInputQueue(   45): Device added: id=0x10000, name=null, classes=2
I/KeyInputQueue(   45):   X: min=150 max=3830 flat=0 fuzz=0
I/KeyInputQueue(   45):   Y: min=190 max=3830 flat=0 fuzz=0
I/KeyInputQueue(   45):   Pressure: min=0 max=15000 flat=0 fuzz=0
I/KeyInputQueue(   45):   Size: unknown values
I/WindowManager(   45): Input configuration changed: { scale=1.0 imsi=0/0 locale=en_US touch=3 key=2/2 nav=3 orien=2 }

I can't figure out what's wrong with my touch device.
Is there any point to check?
Any advice would be helpful.

Thanks in advance.
Daniel Yun.

Qingzhan Zhang

unread,
Dec 17, 2008, 11:26:35 PM12/17/08
to android...@googlegroups.com
I also use PXA310 with wm9713 .my suggest :
1.config the wm9713_touch.c driver as module,and when the system run up ,use insmode wm9713_touch.ko
2.after insmode the driver ,see the sys filesystem,/sys/class/input/event1/,if you see the event1 entry ,cat the dev ,you will find the dev's  major and minor NUM
3,if you find the dev's major and minor num,you should make the device node at the /dev entry,such as
mknod c 13 65,and run the tslib test case
4,check your hard board ,you should find the touch  interrupt signal 
5,if your hardware's interrupt work well,you should check you irq handler
and now ,I think you complete the driver porting 
good luck
Reply all
Reply to author
Forward
0 new messages