aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-ntrig.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hid/hid-ntrig.c')
-rw-r--r--drivers/hid/hid-ntrig.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c
index 3234c729a895..9b24fc510712 100644
--- a/drivers/hid/hid-ntrig.c
+++ b/drivers/hid/hid-ntrig.c
@@ -16,6 +16,7 @@
16#include <linux/device.h> 16#include <linux/device.h>
17#include <linux/hid.h> 17#include <linux/hid.h>
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/slab.h>
19 20
20#include "hid-ids.h" 21#include "hid-ids.h"
21 22
@@ -140,6 +141,9 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
140 nd->reading_mt = 1; 141 nd->reading_mt = 1;
141 nd->first_contact_confidence = 0; 142 nd->first_contact_confidence = 0;
142 break; 143 break;
144 case HID_DG_TIPSWITCH:
145 /* Prevent emission of touch until validated */
146 return 1;
143 case HID_DG_CONFIDENCE: 147 case HID_DG_CONFIDENCE:
144 nd->confidence = value; 148 nd->confidence = value;
145 break; 149 break;
@@ -259,6 +263,7 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
259 BTN_TOOL_TRIPLETAP, 0); 263 BTN_TOOL_TRIPLETAP, 0);
260 input_report_key(input, 264 input_report_key(input,
261 BTN_TOOL_QUADTAP, 0); 265 BTN_TOOL_QUADTAP, 0);
266 input_report_key(input, BTN_TOUCH, 0);
262 } 267 }
263 break; 268 break;
264 269
@@ -308,13 +313,20 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
308 313
309 314
310 list_for_each_entry(hidinput, &hdev->inputs, list) { 315 list_for_each_entry(hidinput, &hdev->inputs, list) {
316 if (hidinput->report->maxfield < 1)
317 continue;
318
311 input = hidinput->input; 319 input = hidinput->input;
312 switch (hidinput->report->field[0]->application) { 320 switch (hidinput->report->field[0]->application) {
313 case HID_DG_PEN: 321 case HID_DG_PEN:
314 input->name = "N-Trig Pen"; 322 input->name = "N-Trig Pen";
315 break; 323 break;
316 case HID_DG_TOUCHSCREEN: 324 case HID_DG_TOUCHSCREEN:
325 /* These keys are redundant for fingers, clear them
326 * to prevent incorrect identification */
317 __clear_bit(BTN_TOOL_PEN, input->keybit); 327 __clear_bit(BTN_TOOL_PEN, input->keybit);
328 __clear_bit(BTN_TOOL_FINGER, input->keybit);
329 __clear_bit(BTN_0, input->keybit);
318 /* 330 /*
319 * A little something special to enable 331 * A little something special to enable
320 * two and three finger taps. 332 * two and three finger taps.