1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * HID driver for N-Trig touchscreens
5 * Copyright (c) 2008-2010 Rafi Rubin
6 * Copyright (c) 2009-2010 Stephane Chatty
12 #include <linux/device.h>
13 #include <linux/hid.h>
14 #include <linux/usb.h>
15 #include "usbhid/usbhid.h"
16 #include <linux/module.h>
17 #include <linux/slab.h>
21 #define NTRIG_DUPLICATE_USAGES 0x001
23 static unsigned int min_width;
24 module_param(min_width, uint, 0644);
25 MODULE_PARM_DESC(min_width, "Minimum touch contact width to accept.");
27 static unsigned int min_height;
28 module_param(min_height, uint, 0644);
29 MODULE_PARM_DESC(min_height, "Minimum touch contact height to accept.");
31 static unsigned int activate_slack = 1;
32 module_param(activate_slack, uint, 0644);
33 MODULE_PARM_DESC(activate_slack, "Number of touch frames to ignore at "
34 "the start of touch input.");
36 static unsigned int deactivate_slack = 4;
37 module_param(deactivate_slack, uint, 0644);
38 MODULE_PARM_DESC(deactivate_slack, "Number of empty frames to ignore before "
39 "deactivating touch.");
41 static unsigned int activation_width = 64;
42 module_param(activation_width, uint, 0644);
43 MODULE_PARM_DESC(activation_width, "Width threshold to immediately start "
44 "processing touch events.");
46 static unsigned int activation_height = 32;
47 module_param(activation_height, uint, 0644);
48 MODULE_PARM_DESC(activation_height, "Height threshold to immediately start "
49 "processing touch events.");
52 /* Incoming raw values for a single contact */
58 bool first_contact_touch;
65 /* The current activation state. */
68 /* Empty frames to ignore before recognizing the end of activity */
69 __s8 deactivate_slack;
71 /* Frames to ignore before acknowledging the start of activity */
74 /* Minimum size contact to accept */
78 /* Threshold to override activation slack */
79 __u16 activation_width;
80 __u16 activation_height;
82 __u16 sensor_logical_width;
83 __u16 sensor_logical_height;
84 __u16 sensor_physical_width;
85 __u16 sensor_physical_height;
90 * This function converts the 4 byte raw firmware code into
91 * a string containing 5 comma separated numbers.
93 static int ntrig_version_string(unsigned char *raw, char *buf)
95 __u8 a = (raw[1] & 0x0e) >> 1;
96 __u8 b = (raw[0] & 0x3c) >> 2;
97 __u8 c = ((raw[0] & 0x03) << 3) | ((raw[3] & 0xe0) >> 5);
98 __u8 d = ((raw[3] & 0x07) << 3) | ((raw[2] & 0xe0) >> 5);
99 __u8 e = raw[2] & 0x07;
102 * As yet unmapped bits:
103 * 0b11000000 0b11110001 0b00011000 0b00011000
106 return sprintf(buf, "%u.%u.%u.%u.%u", a, b, c, d, e);
109 static inline int ntrig_get_mode(struct hid_device *hdev)
111 struct hid_report *report = hdev->report_enum[HID_FEATURE_REPORT].
112 report_id_hash[0x0d];
114 if (!report || report->maxfield < 1 ||
115 report->field[0]->report_count < 1)
118 hid_hw_request(hdev, report, HID_REQ_GET_REPORT);
120 return (int)report->field[0]->value[0];
123 static inline void ntrig_set_mode(struct hid_device *hdev, const int mode)
125 struct hid_report *report;
126 __u8 mode_commands[4] = { 0xe, 0xf, 0x1b, 0x10 };
128 if (mode < 0 || mode > 3)
131 report = hdev->report_enum[HID_FEATURE_REPORT].
132 report_id_hash[mode_commands[mode]];
137 hid_hw_request(hdev, report, HID_REQ_GET_REPORT);
140 static void ntrig_report_version(struct hid_device *hdev)
144 struct usb_device *usb_dev = hid_to_usb_dev(hdev);
145 unsigned char *data = kmalloc(8, GFP_KERNEL);
150 ret = usb_control_msg(usb_dev, usb_rcvctrlpipe(usb_dev, 0),
151 USB_REQ_CLEAR_FEATURE,
152 USB_TYPE_CLASS | USB_RECIP_INTERFACE |
155 USB_CTRL_SET_TIMEOUT);
158 ret = ntrig_version_string(&data[2], buf);
160 hid_info(hdev, "Firmware version: %s (%02x%02x %02x%02x)\n",
161 buf, data[2], data[3], data[4], data[5]);
168 static ssize_t show_phys_width(struct device *dev,
169 struct device_attribute *attr,
172 struct hid_device *hdev = to_hid_device(dev);
173 struct ntrig_data *nd = hid_get_drvdata(hdev);
175 return sprintf(buf, "%d\n", nd->sensor_physical_width);
178 static DEVICE_ATTR(sensor_physical_width, S_IRUGO, show_phys_width, NULL);
180 static ssize_t show_phys_height(struct device *dev,
181 struct device_attribute *attr,
184 struct hid_device *hdev = to_hid_device(dev);
185 struct ntrig_data *nd = hid_get_drvdata(hdev);
187 return sprintf(buf, "%d\n", nd->sensor_physical_height);
190 static DEVICE_ATTR(sensor_physical_height, S_IRUGO, show_phys_height, NULL);
192 static ssize_t show_log_width(struct device *dev,
193 struct device_attribute *attr,
196 struct hid_device *hdev = to_hid_device(dev);
197 struct ntrig_data *nd = hid_get_drvdata(hdev);
199 return sprintf(buf, "%d\n", nd->sensor_logical_width);
202 static DEVICE_ATTR(sensor_logical_width, S_IRUGO, show_log_width, NULL);
204 static ssize_t show_log_height(struct device *dev,
205 struct device_attribute *attr,
208 struct hid_device *hdev = to_hid_device(dev);
209 struct ntrig_data *nd = hid_get_drvdata(hdev);
211 return sprintf(buf, "%d\n", nd->sensor_logical_height);
214 static DEVICE_ATTR(sensor_logical_height, S_IRUGO, show_log_height, NULL);
216 static ssize_t show_min_width(struct device *dev,
217 struct device_attribute *attr,
220 struct hid_device *hdev = to_hid_device(dev);
221 struct ntrig_data *nd = hid_get_drvdata(hdev);
223 return sprintf(buf, "%d\n", nd->min_width *
224 nd->sensor_physical_width /
225 nd->sensor_logical_width);
228 static ssize_t set_min_width(struct device *dev,
229 struct device_attribute *attr,
230 const char *buf, size_t count)
232 struct hid_device *hdev = to_hid_device(dev);
233 struct ntrig_data *nd = hid_get_drvdata(hdev);
237 if (kstrtoul(buf, 0, &val))
240 if (val > nd->sensor_physical_width)
243 nd->min_width = val * nd->sensor_logical_width /
244 nd->sensor_physical_width;
249 static DEVICE_ATTR(min_width, S_IWUSR | S_IRUGO, show_min_width, set_min_width);
251 static ssize_t show_min_height(struct device *dev,
252 struct device_attribute *attr,
255 struct hid_device *hdev = to_hid_device(dev);
256 struct ntrig_data *nd = hid_get_drvdata(hdev);
258 return sprintf(buf, "%d\n", nd->min_height *
259 nd->sensor_physical_height /
260 nd->sensor_logical_height);
263 static ssize_t set_min_height(struct device *dev,
264 struct device_attribute *attr,
265 const char *buf, size_t count)
267 struct hid_device *hdev = to_hid_device(dev);
268 struct ntrig_data *nd = hid_get_drvdata(hdev);
272 if (kstrtoul(buf, 0, &val))
275 if (val > nd->sensor_physical_height)
278 nd->min_height = val * nd->sensor_logical_height /
279 nd->sensor_physical_height;
284 static DEVICE_ATTR(min_height, S_IWUSR | S_IRUGO, show_min_height,
287 static ssize_t show_activate_slack(struct device *dev,
288 struct device_attribute *attr,
291 struct hid_device *hdev = to_hid_device(dev);
292 struct ntrig_data *nd = hid_get_drvdata(hdev);
294 return sprintf(buf, "%d\n", nd->activate_slack);
297 static ssize_t set_activate_slack(struct device *dev,
298 struct device_attribute *attr,
299 const char *buf, size_t count)
301 struct hid_device *hdev = to_hid_device(dev);
302 struct ntrig_data *nd = hid_get_drvdata(hdev);
306 if (kstrtoul(buf, 0, &val))
312 nd->activate_slack = val;
317 static DEVICE_ATTR(activate_slack, S_IWUSR | S_IRUGO, show_activate_slack,
320 static ssize_t show_activation_width(struct device *dev,
321 struct device_attribute *attr,
324 struct hid_device *hdev = to_hid_device(dev);
325 struct ntrig_data *nd = hid_get_drvdata(hdev);
327 return sprintf(buf, "%d\n", nd->activation_width *
328 nd->sensor_physical_width /
329 nd->sensor_logical_width);
332 static ssize_t set_activation_width(struct device *dev,
333 struct device_attribute *attr,
334 const char *buf, size_t count)
336 struct hid_device *hdev = to_hid_device(dev);
337 struct ntrig_data *nd = hid_get_drvdata(hdev);
341 if (kstrtoul(buf, 0, &val))
344 if (val > nd->sensor_physical_width)
347 nd->activation_width = val * nd->sensor_logical_width /
348 nd->sensor_physical_width;
353 static DEVICE_ATTR(activation_width, S_IWUSR | S_IRUGO, show_activation_width,
354 set_activation_width);
356 static ssize_t show_activation_height(struct device *dev,
357 struct device_attribute *attr,
360 struct hid_device *hdev = to_hid_device(dev);
361 struct ntrig_data *nd = hid_get_drvdata(hdev);
363 return sprintf(buf, "%d\n", nd->activation_height *
364 nd->sensor_physical_height /
365 nd->sensor_logical_height);
368 static ssize_t set_activation_height(struct device *dev,
369 struct device_attribute *attr,
370 const char *buf, size_t count)
372 struct hid_device *hdev = to_hid_device(dev);
373 struct ntrig_data *nd = hid_get_drvdata(hdev);
377 if (kstrtoul(buf, 0, &val))
380 if (val > nd->sensor_physical_height)
383 nd->activation_height = val * nd->sensor_logical_height /
384 nd->sensor_physical_height;
389 static DEVICE_ATTR(activation_height, S_IWUSR | S_IRUGO,
390 show_activation_height, set_activation_height);
392 static ssize_t show_deactivate_slack(struct device *dev,
393 struct device_attribute *attr,
396 struct hid_device *hdev = to_hid_device(dev);
397 struct ntrig_data *nd = hid_get_drvdata(hdev);
399 return sprintf(buf, "%d\n", -nd->deactivate_slack);
402 static ssize_t set_deactivate_slack(struct device *dev,
403 struct device_attribute *attr,
404 const char *buf, size_t count)
406 struct hid_device *hdev = to_hid_device(dev);
407 struct ntrig_data *nd = hid_get_drvdata(hdev);
411 if (kstrtoul(buf, 0, &val))
415 * No more than 8 terminal frames have been observed so far
416 * and higher slack is highly likely to leave the single
417 * touch emulation stuck down.
422 nd->deactivate_slack = -val;
427 static DEVICE_ATTR(deactivate_slack, S_IWUSR | S_IRUGO, show_deactivate_slack,
428 set_deactivate_slack);
430 static struct attribute *sysfs_attrs[] = {
431 &dev_attr_sensor_physical_width.attr,
432 &dev_attr_sensor_physical_height.attr,
433 &dev_attr_sensor_logical_width.attr,
434 &dev_attr_sensor_logical_height.attr,
435 &dev_attr_min_height.attr,
436 &dev_attr_min_width.attr,
437 &dev_attr_activate_slack.attr,
438 &dev_attr_activation_width.attr,
439 &dev_attr_activation_height.attr,
440 &dev_attr_deactivate_slack.attr,
444 static const struct attribute_group ntrig_attribute_group = {
449 * this driver is aimed at two firmware versions in circulation:
450 * - dual pen/finger single touch
451 * - finger multitouch, pen not working
454 static int ntrig_input_mapping(struct hid_device *hdev, struct hid_input *hi,
455 struct hid_field *field, struct hid_usage *usage,
456 unsigned long **bit, int *max)
458 struct ntrig_data *nd = hid_get_drvdata(hdev);
460 /* No special mappings needed for the pen and single touch */
464 switch (usage->hid & HID_USAGE_PAGE) {
466 switch (usage->hid) {
468 hid_map_usage(hi, usage, bit, max,
469 EV_ABS, ABS_MT_POSITION_X);
470 input_set_abs_params(hi->input, ABS_X,
471 field->logical_minimum,
472 field->logical_maximum, 0, 0);
474 if (!nd->sensor_logical_width) {
475 nd->sensor_logical_width =
476 field->logical_maximum -
477 field->logical_minimum;
478 nd->sensor_physical_width =
479 field->physical_maximum -
480 field->physical_minimum;
481 nd->activation_width = activation_width *
482 nd->sensor_logical_width /
483 nd->sensor_physical_width;
484 nd->min_width = min_width *
485 nd->sensor_logical_width /
486 nd->sensor_physical_width;
490 hid_map_usage(hi, usage, bit, max,
491 EV_ABS, ABS_MT_POSITION_Y);
492 input_set_abs_params(hi->input, ABS_Y,
493 field->logical_minimum,
494 field->logical_maximum, 0, 0);
496 if (!nd->sensor_logical_height) {
497 nd->sensor_logical_height =
498 field->logical_maximum -
499 field->logical_minimum;
500 nd->sensor_physical_height =
501 field->physical_maximum -
502 field->physical_minimum;
503 nd->activation_height = activation_height *
504 nd->sensor_logical_height /
505 nd->sensor_physical_height;
506 nd->min_height = min_height *
507 nd->sensor_logical_height /
508 nd->sensor_physical_height;
514 case HID_UP_DIGITIZER:
515 switch (usage->hid) {
516 /* we do not want to map these for now */
517 case HID_DG_CONTACTID: /* Not trustworthy, squelch for now */
518 case HID_DG_INPUTMODE:
519 case HID_DG_DEVICEINDEX:
520 case HID_DG_CONTACTMAX:
523 /* width/height mapped on TouchMajor/TouchMinor/Orientation */
525 hid_map_usage(hi, usage, bit, max,
526 EV_ABS, ABS_MT_TOUCH_MAJOR);
529 hid_map_usage(hi, usage, bit, max,
530 EV_ABS, ABS_MT_TOUCH_MINOR);
531 input_set_abs_params(hi->input, ABS_MT_ORIENTATION,
538 /* we do not want to map these: no input-oriented meaning */
545 static int ntrig_input_mapped(struct hid_device *hdev, struct hid_input *hi,
546 struct hid_field *field, struct hid_usage *usage,
547 unsigned long **bit, int *max)
549 /* No special mappings needed for the pen and single touch */
553 if (usage->type == EV_KEY || usage->type == EV_REL
554 || usage->type == EV_ABS)
555 clear_bit(usage->code, *bit);
561 * this function is called upon all reports
562 * so that we can filter contact point information,
563 * decide whether we are in multi or single touch mode
564 * and call input_mt_sync after each point if necessary
566 static int ntrig_event (struct hid_device *hid, struct hid_field *field,
567 struct hid_usage *usage, __s32 value)
569 struct ntrig_data *nd = hid_get_drvdata(hid);
570 struct input_dev *input;
572 /* Skip processing if not a claimed input */
573 if (!(hid->claimed & HID_CLAIMED_INPUT))
574 goto not_claimed_input;
576 /* This function is being called before the structures are fully
578 if(!(field->hidinput && field->hidinput->input))
581 input = field->hidinput->input;
583 /* No special handling needed for the pen */
584 if (field->application == HID_DG_PEN)
587 switch (usage->hid) {
589 /* Tag indicating the start of a multitouch group */
590 nd->reading_mt = true;
591 nd->first_contact_touch = false;
593 case HID_DG_TIPSWITCH:
594 nd->tipswitch = value;
595 /* Prevent emission of touch until validated */
597 case HID_DG_CONFIDENCE:
598 nd->confidence = value;
602 /* Clear the contact footer */
603 nd->mt_foot_count = 0;
608 case HID_DG_CONTACTID:
617 * when in single touch mode, this is the last
618 * report received in a finger event. We want
619 * to emit a normal (X, Y) position
621 if (!nd->reading_mt) {
623 * TipSwitch indicates the presence of a
624 * finger in single touch mode.
626 input_report_key(input, BTN_TOUCH,
628 input_report_key(input, BTN_TOOL_DOUBLETAP,
630 input_event(input, EV_ABS, ABS_X, nd->x);
631 input_event(input, EV_ABS, ABS_Y, nd->y);
636 * we receive this when the device is in multitouch
637 * mode. The first of the three values tagged with
638 * this usage tells if the contact point is real
642 /* Shouldn't get more than 4 footer packets, so skip */
643 if (nd->mt_foot_count >= 4)
646 nd->mt_footer[nd->mt_foot_count++] = value;
648 /* if the footer isn't complete break */
649 if (nd->mt_foot_count != 4)
652 /* Pen activity signal. */
653 if (nd->mt_footer[2]) {
655 * When the pen deactivates touch, we see a
656 * bogus frame with ContactCount > 0.
658 * save a bit of work by ensuring act_state < 0
659 * even if deactivation slack is turned off.
661 nd->act_state = deactivate_slack - 1;
662 nd->confidence = false;
667 * The first footer value indicates the presence of a
670 if (nd->mt_footer[0]) {
672 * We do not want to process contacts under
673 * the size threshold, but do not want to
674 * ignore them for activation state
676 if (nd->w < nd->min_width ||
677 nd->h < nd->min_height)
678 nd->confidence = false;
682 if (nd->act_state > 0) {
684 * Contact meets the activation size threshold
686 if (nd->w >= nd->activation_width &&
687 nd->h >= nd->activation_height) {
690 * first contact, activate now
695 * avoid corrupting this frame
696 * but ensure next frame will
704 * Defer adjusting the activation state
705 * until the end of the frame.
710 /* Discarding this contact */
714 /* emit a normal (X, Y) for the first point only */
717 * TipSwitch is superfluous in multitouch
718 * mode. The footer events tell us
719 * if there is a finger on the screen or
722 nd->first_contact_touch = nd->confidence;
723 input_event(input, EV_ABS, ABS_X, nd->x);
724 input_event(input, EV_ABS, ABS_Y, nd->y);
728 input_event(input, EV_ABS, ABS_MT_POSITION_X, nd->x);
729 input_event(input, EV_ABS, ABS_MT_POSITION_Y, nd->y);
732 * Translate from height and width to size
736 input_event(input, EV_ABS,
737 ABS_MT_ORIENTATION, 1);
738 input_event(input, EV_ABS,
739 ABS_MT_TOUCH_MAJOR, nd->w);
740 input_event(input, EV_ABS,
741 ABS_MT_TOUCH_MINOR, nd->h);
743 input_event(input, EV_ABS,
744 ABS_MT_ORIENTATION, 0);
745 input_event(input, EV_ABS,
746 ABS_MT_TOUCH_MAJOR, nd->h);
747 input_event(input, EV_ABS,
748 ABS_MT_TOUCH_MINOR, nd->w);
750 input_mt_sync(field->hidinput->input);
753 case HID_DG_CONTACTCOUNT: /* End of a multitouch group */
754 if (!nd->reading_mt) /* Just to be sure */
757 nd->reading_mt = false;
761 * Activation state machine logic:
763 * Fundamental states:
764 * state > 0: Inactive
766 * state < -deactivate_slack:
767 * Pen termination of touch
769 * Specific values of interest
770 * state == activate_slack
771 * no valid input since the last reset
774 * general operational state
776 * state == -deactivate_slack
777 * read sufficient empty frames to accept
778 * the end of input and reset
781 if (nd->act_state > 0) { /* Currently inactive */
784 * Consider each live contact as
785 * evidence of intentional activity.
787 nd->act_state = (nd->act_state > value)
788 ? nd->act_state - value
792 * Empty frame before we hit the
793 * activity threshold, reset.
795 nd->act_state = nd->activate_slack;
798 * Entered this block inactive and no
799 * coordinates sent this frame, so hold off
803 } else { /* Currently active */
804 if (value && nd->act_state >=
805 nd->deactivate_slack)
807 * Live point: clear accumulated
808 * deactivation count.
811 else if (nd->act_state <= nd->deactivate_slack)
813 * We've consumed the deactivation
814 * slack, time to deactivate and reset.
818 else { /* Move towards deactivation */
824 if (nd->first_contact_touch && nd->act_state <= 0) {
826 * Check to see if we're ready to start
827 * emitting touch events.
829 * Note: activation slack will decrease over
830 * the course of the frame, and it will be
831 * inconsistent from the start to the end of
832 * the frame. However if the frame starts
833 * with slack, first_contact_touch will still
834 * be 0 and we will not get to this point.
836 input_report_key(input, BTN_TOOL_DOUBLETAP, 1);
837 input_report_key(input, BTN_TOUCH, 1);
839 input_report_key(input, BTN_TOOL_DOUBLETAP, 0);
840 input_report_key(input, BTN_TOUCH, 0);
845 /* fall-back to the generic hidinput handling */
851 /* we have handled the hidinput part, now remains hiddev */
852 if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_hid_event)
853 hid->hiddev_hid_event(hid, field, usage, value);
858 static int ntrig_input_configured(struct hid_device *hid,
859 struct hid_input *hidinput)
862 struct input_dev *input = hidinput->input;
864 if (hidinput->report->maxfield < 1)
867 switch (hidinput->report->field[0]->application) {
869 input->name = "N-Trig Pen";
871 case HID_DG_TOUCHSCREEN:
872 /* These keys are redundant for fingers, clear them
873 * to prevent incorrect identification */
874 __clear_bit(BTN_TOOL_PEN, input->keybit);
875 __clear_bit(BTN_TOOL_FINGER, input->keybit);
876 __clear_bit(BTN_0, input->keybit);
877 __set_bit(BTN_TOOL_DOUBLETAP, input->keybit);
879 * The physical touchscreen (single touch)
880 * input has a value for physical, whereas
881 * the multitouch only has logical input
884 input->name = (hidinput->report->field[0]->physical) ?
885 "N-Trig Touchscreen" :
893 static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
896 struct ntrig_data *nd;
897 struct hid_report *report;
900 hdev->quirks |= HID_QUIRK_MULTI_INPUT
901 | HID_QUIRK_NO_INIT_REPORTS;
903 nd = kmalloc(sizeof(struct ntrig_data), GFP_KERNEL);
905 hid_err(hdev, "cannot allocate N-Trig data\n");
909 nd->reading_mt = false;
912 nd->activate_slack = activate_slack;
913 nd->act_state = activate_slack;
914 nd->deactivate_slack = -deactivate_slack;
915 nd->sensor_logical_width = 1;
916 nd->sensor_logical_height = 1;
917 nd->sensor_physical_width = 1;
918 nd->sensor_physical_height = 1;
920 hid_set_drvdata(hdev, nd);
922 ret = hid_parse(hdev);
924 hid_err(hdev, "parse failed\n");
928 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
930 hid_err(hdev, "hw start failed\n");
934 /* This is needed for devices with more recent firmware versions */
935 report = hdev->report_enum[HID_FEATURE_REPORT].report_id_hash[0x0a];
937 /* Let the device settle to ensure the wakeup message gets
940 hid_hw_request(hdev, report, HID_REQ_GET_REPORT);
943 * Sanity check: if the current mode is invalid reset it to
944 * something reasonable.
946 if (ntrig_get_mode(hdev) >= 4)
947 ntrig_set_mode(hdev, 3);
950 ntrig_report_version(hdev);
952 ret = sysfs_create_group(&hdev->dev.kobj,
953 &ntrig_attribute_group);
955 hid_err(hdev, "cannot create sysfs group\n");
963 static void ntrig_remove(struct hid_device *hdev)
965 sysfs_remove_group(&hdev->dev.kobj,
966 &ntrig_attribute_group);
968 kfree(hid_get_drvdata(hdev));
971 static const struct hid_device_id ntrig_devices[] = {
972 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN),
973 .driver_data = NTRIG_DUPLICATE_USAGES },
974 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_1),
975 .driver_data = NTRIG_DUPLICATE_USAGES },
976 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_2),
977 .driver_data = NTRIG_DUPLICATE_USAGES },
978 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_3),
979 .driver_data = NTRIG_DUPLICATE_USAGES },
980 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_4),
981 .driver_data = NTRIG_DUPLICATE_USAGES },
982 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_5),
983 .driver_data = NTRIG_DUPLICATE_USAGES },
984 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_6),
985 .driver_data = NTRIG_DUPLICATE_USAGES },
986 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_7),
987 .driver_data = NTRIG_DUPLICATE_USAGES },
988 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_8),
989 .driver_data = NTRIG_DUPLICATE_USAGES },
990 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_9),
991 .driver_data = NTRIG_DUPLICATE_USAGES },
992 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_10),
993 .driver_data = NTRIG_DUPLICATE_USAGES },
994 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_11),
995 .driver_data = NTRIG_DUPLICATE_USAGES },
996 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_12),
997 .driver_data = NTRIG_DUPLICATE_USAGES },
998 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_13),
999 .driver_data = NTRIG_DUPLICATE_USAGES },
1000 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_14),
1001 .driver_data = NTRIG_DUPLICATE_USAGES },
1002 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_15),
1003 .driver_data = NTRIG_DUPLICATE_USAGES },
1004 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_16),
1005 .driver_data = NTRIG_DUPLICATE_USAGES },
1006 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_17),
1007 .driver_data = NTRIG_DUPLICATE_USAGES },
1008 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_18),
1009 .driver_data = NTRIG_DUPLICATE_USAGES },
1012 MODULE_DEVICE_TABLE(hid, ntrig_devices);
1014 static const struct hid_usage_id ntrig_grabbed_usages[] = {
1015 { HID_ANY_ID, HID_ANY_ID, HID_ANY_ID },
1016 { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1 }
1019 static struct hid_driver ntrig_driver = {
1021 .id_table = ntrig_devices,
1022 .probe = ntrig_probe,
1023 .remove = ntrig_remove,
1024 .input_mapping = ntrig_input_mapping,
1025 .input_mapped = ntrig_input_mapped,
1026 .input_configured = ntrig_input_configured,
1027 .usage_table = ntrig_grabbed_usages,
1028 .event = ntrig_event,
1030 module_hid_driver(ntrig_driver);
1032 MODULE_LICENSE("GPL");