From fa669917d7ad99275056f1361c2c9d9f00997ba0 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Wed, 25 Aug 2010 14:12:10 +0200 Subject: try this --- usr/src/dkms_source_tree/hid-ntrig.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'usr') diff --git a/usr/src/dkms_source_tree/hid-ntrig.c b/usr/src/dkms_source_tree/hid-ntrig.c index 7bc1a5e..fb882bd 100644 --- a/usr/src/dkms_source_tree/hid-ntrig.c +++ b/usr/src/dkms_source_tree/hid-ntrig.c @@ -39,6 +39,7 @@ struct ntrig_data { unsigned int id; struct mt_data data[16]; int contactcount; + int x, y; }; #define SN_MOVE 100 @@ -156,7 +157,7 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field, struct input_dev *input = field->hidinput->input; struct ntrig_data *nd = hid_get_drvdata(hid); struct mt_data *p = &nd->data[nd->id]; - int i, count; + int i, count, mx, my; /* No special handling needed for the pen */ if (field->application == HID_DG_PEN) @@ -170,8 +171,11 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field, /* new mt packet */ case 0xff000001: count = nd->contactcount; + mx = my = 0; for (i = 0; i < count; i++) { p = &nd->data[i]; + mx += p->x; + my += p->y; input_report_abs(input, ABS_MT_POSITION_X, p->x); input_report_abs(input, ABS_MT_POSITION_Y, p->y); input_report_abs(input, ABS_MT_TOUCH_MINOR, p->h); @@ -179,14 +183,14 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field, input_report_abs(input, ABS_MT_ORIENTATION, p->w > p->h); input_mt_sync(field->hidinput->input); } - - input_mt_sync(input); - input_report_key(input, BTN_TOUCH, count > 0); if (count > 0) { - p = &nd->data[0]; - input_report_abs(input, ABS_X, p->x); - input_report_abs(input, ABS_Y, p->y); + nd->x = mx / count; + nd->y = my / count; } + input_mt_sync(input); + input_report_key(input, BTN_TOUCH, count > 0); + input_report_abs(input, ABS_X, nd->x); + input_report_abs(input, ABS_Y, nd->y); //input_sync(input); p = &nd->data[nd->id = 0]; -- cgit v1.2.3