diff options
Diffstat (limited to 'usr/src/dkms_source_tree')
| -rw-r--r-- | usr/src/dkms_source_tree/hid-ntrig.c | 18 |
1 files changed, 11 insertions, 7 deletions
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 { | |||
| 39 | unsigned int id; | 39 | unsigned int id; |
| 40 | struct mt_data data[16]; | 40 | struct mt_data data[16]; |
| 41 | int contactcount; | 41 | int contactcount; |
| 42 | int x, y; | ||
| 42 | }; | 43 | }; |
| 43 | 44 | ||
| 44 | #define SN_MOVE 100 | 45 | #define SN_MOVE 100 |
| @@ -156,7 +157,7 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field, | |||
| 156 | struct input_dev *input = field->hidinput->input; | 157 | struct input_dev *input = field->hidinput->input; |
| 157 | struct ntrig_data *nd = hid_get_drvdata(hid); | 158 | struct ntrig_data *nd = hid_get_drvdata(hid); |
| 158 | struct mt_data *p = &nd->data[nd->id]; | 159 | struct mt_data *p = &nd->data[nd->id]; |
| 159 | int i, count; | 160 | int i, count, mx, my; |
| 160 | 161 | ||
| 161 | /* No special handling needed for the pen */ | 162 | /* No special handling needed for the pen */ |
| 162 | if (field->application == HID_DG_PEN) | 163 | if (field->application == HID_DG_PEN) |
| @@ -170,8 +171,11 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field, | |||
| 170 | /* new mt packet */ | 171 | /* new mt packet */ |
| 171 | case 0xff000001: | 172 | case 0xff000001: |
| 172 | count = nd->contactcount; | 173 | count = nd->contactcount; |
| 174 | mx = my = 0; | ||
| 173 | for (i = 0; i < count; i++) { | 175 | for (i = 0; i < count; i++) { |
| 174 | p = &nd->data[i]; | 176 | p = &nd->data[i]; |
| 177 | mx += p->x; | ||
| 178 | my += p->y; | ||
| 175 | input_report_abs(input, ABS_MT_POSITION_X, p->x); | 179 | input_report_abs(input, ABS_MT_POSITION_X, p->x); |
| 176 | input_report_abs(input, ABS_MT_POSITION_Y, p->y); | 180 | input_report_abs(input, ABS_MT_POSITION_Y, p->y); |
| 177 | input_report_abs(input, ABS_MT_TOUCH_MINOR, p->h); | 181 | 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, | |||
| 179 | input_report_abs(input, ABS_MT_ORIENTATION, p->w > p->h); | 183 | input_report_abs(input, ABS_MT_ORIENTATION, p->w > p->h); |
| 180 | input_mt_sync(field->hidinput->input); | 184 | input_mt_sync(field->hidinput->input); |
| 181 | } | 185 | } |
| 182 | |||
| 183 | input_mt_sync(input); | ||
| 184 | input_report_key(input, BTN_TOUCH, count > 0); | ||
| 185 | if (count > 0) { | 186 | if (count > 0) { |
| 186 | p = &nd->data[0]; | 187 | nd->x = mx / count; |
| 187 | input_report_abs(input, ABS_X, p->x); | 188 | nd->y = my / count; |
| 188 | input_report_abs(input, ABS_Y, p->y); | ||
| 189 | } | 189 | } |
| 190 | input_mt_sync(input); | ||
| 191 | input_report_key(input, BTN_TOUCH, count > 0); | ||
| 192 | input_report_abs(input, ABS_X, nd->x); | ||
| 193 | input_report_abs(input, ABS_Y, nd->y); | ||
| 190 | //input_sync(input); | 194 | //input_sync(input); |
| 191 | 195 | ||
| 192 | p = &nd->data[nd->id = 0]; | 196 | p = &nd->data[nd->id = 0]; |
