aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-ntrig.c
diff options
context:
space:
mode:
authorRafi Rubin <rafi@seas.upenn.edu>2010-03-10 10:10:28 -0500
committerJiri Kosina <jkosina@suse.cz>2010-03-10 10:10:28 -0500
commit2886539d5e649c22a6d2107eb431d3bee81e0e6d (patch)
tree3c552a2f31654171553a55bf2db45ec468b7c5d1 /drivers/hid/hid-ntrig.c
parenteff7f270e9a05688066f40589d7b44e1dcf335dc (diff)
HID: ntrig: fix touch events
This reinstates the lost unpressing of BTN_TOUCH. To prevent undesireably touch toggles this also deals with tip switch events. Added a trap to prevent going out of bounds for hidinputs with empty reports. Clear bits of unused buttons which result in misidentification. Signed-off-by: Rafi Rubin <rafi@seas.upenn.edu> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-ntrig.c')
-rw-r--r--drivers/hid/hid-ntrig.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c
index 3234c729a895..edcc0c4247bb 100644
--- a/drivers/hid/hid-ntrig.c
+++ b/drivers/hid/hid-ntrig.c
@@ -140,6 +140,9 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
140 nd->reading_mt = 1; 140 nd->reading_mt = 1;
141 nd->first_contact_confidence = 0; 141 nd->first_contact_confidence = 0;
142 break; 142 break;
143 case HID_DG_TIPSWITCH:
144 /* Prevent emission of touch until validated */
145 return 1;
143 case HID_DG_CONFIDENCE: 146 case HID_DG_CONFIDENCE:
144 nd->confidence = value; 147 nd->confidence = value;
145 break; 148 break;
@@ -259,6 +262,7 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
259 BTN_TOOL_TRIPLETAP, 0); 262 BTN_TOOL_TRIPLETAP, 0);
260 input_report_key(input, 263 input_report_key(input,
261 BTN_TOOL_QUADTAP, 0); 264 BTN_TOOL_QUADTAP, 0);
265 input_report_key(input, BTN_TOUCH, 0);
262 } 266 }
263 break; 267 break;
264 268
@@ -308,13 +312,20 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
308 312
309 313
310 list_for_each_entry(hidinput, &hdev->inputs, list) { 314 list_for_each_entry(hidinput, &hdev->inputs, list) {
315 if (hidinput->report->maxfield < 1)
316 continue;
317
311 input = hidinput->input; 318 input = hidinput->input;
312 switch (hidinput->report->field[0]->application) { 319 switch (hidinput->report->field[0]->application) {
313 case HID_DG_PEN: 320 case HID_DG_PEN:
314 input->name = "N-Trig Pen"; 321 input->name = "N-Trig Pen";
315 break; 322 break;
316 case HID_DG_TOUCHSCREEN: 323 case HID_DG_TOUCHSCREEN:
324 /* These keys are redundant for fingers, clear them
325 * to prevent incorrect identification */
317 __clear_bit(BTN_TOOL_PEN, input->keybit); 326 __clear_bit(BTN_TOOL_PEN, input->keybit);
327 __clear_bit(BTN_TOOL_FINGER, input->keybit);
328 __clear_bit(BTN_0, input->keybit);
318 /* 329 /*
319 * A little something special to enable 330 * A little something special to enable
320 * two and three finger taps. 331 * two and three finger taps.