--- a/drivers/hid/hid-ntrig.c 2010-10-18 21:40:38.000000000 -0500 +++ b/drivers/hid/hid-ntrig.c 2010-10-18 21:39:53.685685001 -0500 @@ -46,6 +46,8 @@ struct ntrig_data { struct ntrig_contact row[MAX_SLOTS], col[MAX_SLOTS]; + bool reading_mt; + bool tipswitch; int dmin, dmed, dmax; int nrow, ncol; int index, nindex; @@ -307,12 +309,18 @@ } /* touchscreen emulation */ - if (oldest) { - input_event(input, EV_KEY, BTN_TOUCH, 1); - input_event(input, EV_ABS, ABS_X, oldest->x); - input_event(input, EV_ABS, ABS_Y, oldest->y); + if (!nd->reading_mt) { + input_event(input, EV_KEY, BTN_TOUCH, nd->tipswitch); + input_event(input, EV_ABS, ABS_X, nd->col[0].x); + input_event(input, EV_ABS, ABS_Y, nd->col[0].y); } else { - input_event(input, EV_KEY, BTN_TOUCH, 0); + if (oldest) { + input_event(input, EV_KEY, BTN_TOUCH, 1); + input_event(input, EV_ABS, ABS_X, oldest->x); + input_event(input, EV_ABS, ABS_Y, oldest->y); + } else { + input_event(input, EV_KEY, BTN_TOUCH, 0); + } } } @@ -334,8 +342,12 @@ if (hid->claimed & HID_CLAIMED_INPUT) { switch (usage->hid) { + case 0xff000001: + nd->reading_mt = 1; + break; case HID_DG_TIPSWITCH: nd->index = nd->nindex++; + nd->tipswitch = value; break; case HID_GD_X: nd->col[nd->index].x = value; @@ -348,11 +360,21 @@ break; case HID_DG_HEIGHT: nd->col[nd->index].h = value; + /* End of a single touch group */ + if (!nd->reading_mt) { + nd->reading_mt = 0; + nd->nindex = 0; + nd->ncol = 0; + report_frame(input, nd); + } break; case HID_DG_CONTACTCOUNT: /* End of a multitouch group */ + if (!nd->reading_mt) + break; nd->nindex = 0; nd->ncol = value; report_frame(input, nd); + nd->reading_mt = 0; break; } } @@ -382,6 +404,7 @@ } hid_set_drvdata(hdev, nd); + nd->reading_mt = 0; ret = hid_parse(hdev); if (ret) {