2 * HID driver for N-Trig touchscreens
4 * Copyright (c) 2008-2010 Rafi Rubin
5 * Copyright (c) 2009-2010 Stephane Chatty
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the Free
12 * Software Foundation; either version 2 of the License, or (at your option)
16 #include <linux/device.h>
17 #include <linux/hid.h>
18 #include <linux/usb.h>
19 #include "usbhid/usbhid.h"
20 #include <linux/module.h>
21 #include <linux/slab.h>
25 #define NTRIG_DUPLICATE_USAGES 0x001
27 static unsigned int min_width;
28 module_param(min_width, uint, 0644);
29 MODULE_PARM_DESC(min_width, "Minimum touch contact width to accept.");
31 static unsigned int min_height;
32 module_param(min_height, uint, 0644);
33 MODULE_PARM_DESC(min_height, "Minimum touch contact height to accept.");
35 static unsigned int activate_slack = 1;
36 module_param(activate_slack, uint, 0644);
37 MODULE_PARM_DESC(activate_slack, "Number of touch frames to ignore at "
38 "the start of touch input.");
40 static unsigned int deactivate_slack = 4;
41 module_param(deactivate_slack, uint, 0644);
42 MODULE_PARM_DESC(deactivate_slack, "Number of empty frames to ignore before "
43 "deactivating touch.");
45 static unsigned int activation_width = 64;
46 module_param(activation_width, uint, 0644);
47 MODULE_PARM_DESC(activation_width, "Width threshold to immediately start "
48 "processing touch events.");
50 static unsigned int activation_height = 32;
51 module_param(activation_height, uint, 0644);
52 MODULE_PARM_DESC(activation_height, "Height threshold to immediately start "
53 "processing touch events.");
56 /* Incoming raw values for a single contact */
62 bool first_contact_touch;
69 /* The current activation state. */
72 /* Empty frames to ignore before recognizing the end of activity */
73 __s8 deactivate_slack;
75 /* Frames to ignore before acknowledging the start of activity */
78 /* Minimum size contact to accept */
82 /* Threshold to override activation slack */
83 __u16 activation_width;
84 __u16 activation_height;
86 __u16 sensor_logical_width;
87 __u16 sensor_logical_height;
88 __u16 sensor_physical_width;
89 __u16 sensor_physical_height;
94 * This function converts the 4 byte raw firmware code into
95 * a string containing 5 comma separated numbers.
97 static int ntrig_version_string(unsigned char *raw, char *buf)
99 __u8 a = (raw[1] & 0x0e) >> 1;
100 __u8 b = (raw[0] & 0x3c) >> 2;
101 __u8 c = ((raw[0] & 0x03) << 3) | ((raw[3] & 0xe0) >> 5);
102 __u8 d = ((raw[3] & 0x07) << 3) | ((raw[2] & 0xe0) >> 5);
103 __u8 e = raw[2] & 0x07;
106 * As yet unmapped bits:
107 * 0b11000000 0b11110001 0b00011000 0b00011000
110 return sprintf(buf, "%u.%u.%u.%u.%u", a, b, c, d, e);
113 static void ntrig_report_version(struct hid_device *hdev)
117 struct usb_device *usb_dev = hid_to_usb_dev(hdev);
118 unsigned char *data = kmalloc(8, GFP_KERNEL);
123 ret = usb_control_msg(usb_dev, usb_rcvctrlpipe(usb_dev, 0),
124 USB_REQ_CLEAR_FEATURE,
125 USB_TYPE_CLASS | USB_RECIP_INTERFACE |
128 USB_CTRL_SET_TIMEOUT);
131 ret = ntrig_version_string(&data[2], buf);
134 "Firmware version: %s (%02x%02x %02x%02x)\n",
135 buf, data[2], data[3], data[4], data[5]);
142 static ssize_t show_phys_width(struct device *dev,
143 struct device_attribute *attr,
146 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
147 struct ntrig_data *nd = hid_get_drvdata(hdev);
149 return sprintf(buf, "%d\n", nd->sensor_physical_width);
152 static DEVICE_ATTR(sensor_physical_width, S_IRUGO, show_phys_width, NULL);
154 static ssize_t show_phys_height(struct device *dev,
155 struct device_attribute *attr,
158 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
159 struct ntrig_data *nd = hid_get_drvdata(hdev);
161 return sprintf(buf, "%d\n", nd->sensor_physical_height);
164 static DEVICE_ATTR(sensor_physical_height, S_IRUGO, show_phys_height, NULL);
166 static ssize_t show_log_width(struct device *dev,
167 struct device_attribute *attr,
170 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
171 struct ntrig_data *nd = hid_get_drvdata(hdev);
173 return sprintf(buf, "%d\n", nd->sensor_logical_width);
176 static DEVICE_ATTR(sensor_logical_width, S_IRUGO, show_log_width, NULL);
178 static ssize_t show_log_height(struct device *dev,
179 struct device_attribute *attr,
182 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
183 struct ntrig_data *nd = hid_get_drvdata(hdev);
185 return sprintf(buf, "%d\n", nd->sensor_logical_height);
188 static DEVICE_ATTR(sensor_logical_height, S_IRUGO, show_log_height, NULL);
190 static ssize_t show_min_width(struct device *dev,
191 struct device_attribute *attr,
194 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
195 struct ntrig_data *nd = hid_get_drvdata(hdev);
197 return sprintf(buf, "%d\n", nd->min_width *
198 nd->sensor_physical_width /
199 nd->sensor_logical_width);
202 static ssize_t set_min_width(struct device *dev,
203 struct device_attribute *attr,
204 const char *buf, size_t count)
206 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
207 struct ntrig_data *nd = hid_get_drvdata(hdev);
211 if (strict_strtoul(buf, 0, &val))
214 if (val > nd->sensor_physical_width)
217 nd->min_width = val * nd->sensor_logical_width /
218 nd->sensor_physical_width;
223 static DEVICE_ATTR(min_width, S_IWUSR | S_IRUGO, show_min_width, set_min_width);
225 static ssize_t show_min_height(struct device *dev,
226 struct device_attribute *attr,
229 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
230 struct ntrig_data *nd = hid_get_drvdata(hdev);
232 return sprintf(buf, "%d\n", nd->min_height *
233 nd->sensor_physical_height /
234 nd->sensor_logical_height);
237 static ssize_t set_min_height(struct device *dev,
238 struct device_attribute *attr,
239 const char *buf, size_t count)
241 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
242 struct ntrig_data *nd = hid_get_drvdata(hdev);
246 if (strict_strtoul(buf, 0, &val))
249 if (val > nd->sensor_physical_height)
252 nd->min_height = val * nd->sensor_logical_height /
253 nd->sensor_physical_height;
258 static DEVICE_ATTR(min_height, S_IWUSR | S_IRUGO, show_min_height,
261 static ssize_t show_activate_slack(struct device *dev,
262 struct device_attribute *attr,
265 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
266 struct ntrig_data *nd = hid_get_drvdata(hdev);
268 return sprintf(buf, "%d\n", nd->activate_slack);
271 static ssize_t set_activate_slack(struct device *dev,
272 struct device_attribute *attr,
273 const char *buf, size_t count)
275 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
276 struct ntrig_data *nd = hid_get_drvdata(hdev);
280 if (strict_strtoul(buf, 0, &val))
286 nd->activate_slack = val;
291 static DEVICE_ATTR(activate_slack, S_IWUSR | S_IRUGO, show_activate_slack,
294 static ssize_t show_activation_width(struct device *dev,
295 struct device_attribute *attr,
298 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
299 struct ntrig_data *nd = hid_get_drvdata(hdev);
301 return sprintf(buf, "%d\n", nd->activation_width *
302 nd->sensor_physical_width /
303 nd->sensor_logical_width);
306 static ssize_t set_activation_width(struct device *dev,
307 struct device_attribute *attr,
308 const char *buf, size_t count)
310 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
311 struct ntrig_data *nd = hid_get_drvdata(hdev);
315 if (strict_strtoul(buf, 0, &val))
318 if (val > nd->sensor_physical_width)
321 nd->activation_width = val * nd->sensor_logical_width /
322 nd->sensor_physical_width;
327 static DEVICE_ATTR(activation_width, S_IWUSR | S_IRUGO, show_activation_width,
328 set_activation_width);
330 static ssize_t show_activation_height(struct device *dev,
331 struct device_attribute *attr,
334 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
335 struct ntrig_data *nd = hid_get_drvdata(hdev);
337 return sprintf(buf, "%d\n", nd->activation_height *
338 nd->sensor_physical_height /
339 nd->sensor_logical_height);
342 static ssize_t set_activation_height(struct device *dev,
343 struct device_attribute *attr,
344 const char *buf, size_t count)
346 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
347 struct ntrig_data *nd = hid_get_drvdata(hdev);
351 if (strict_strtoul(buf, 0, &val))
354 if (val > nd->sensor_physical_height)
357 nd->activation_height = val * nd->sensor_logical_height /
358 nd->sensor_physical_height;
363 static DEVICE_ATTR(activation_height, S_IWUSR | S_IRUGO,
364 show_activation_height, set_activation_height);
366 static ssize_t show_deactivate_slack(struct device *dev,
367 struct device_attribute *attr,
370 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
371 struct ntrig_data *nd = hid_get_drvdata(hdev);
373 return sprintf(buf, "%d\n", -nd->deactivate_slack);
376 static ssize_t set_deactivate_slack(struct device *dev,
377 struct device_attribute *attr,
378 const char *buf, size_t count)
380 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
381 struct ntrig_data *nd = hid_get_drvdata(hdev);
385 if (strict_strtoul(buf, 0, &val))
389 * No more than 8 terminal frames have been observed so far
390 * and higher slack is highly likely to leave the single
391 * touch emulation stuck down.
396 nd->deactivate_slack = -val;
401 static DEVICE_ATTR(deactivate_slack, S_IWUSR | S_IRUGO, show_deactivate_slack,
402 set_deactivate_slack);
404 static struct attribute *sysfs_attrs[] = {
405 &dev_attr_sensor_physical_width.attr,
406 &dev_attr_sensor_physical_height.attr,
407 &dev_attr_sensor_logical_width.attr,
408 &dev_attr_sensor_logical_height.attr,
409 &dev_attr_min_height.attr,
410 &dev_attr_min_width.attr,
411 &dev_attr_activate_slack.attr,
412 &dev_attr_activation_width.attr,
413 &dev_attr_activation_height.attr,
414 &dev_attr_deactivate_slack.attr,
418 static struct attribute_group ntrig_attribute_group = {
423 * this driver is aimed at two firmware versions in circulation:
424 * - dual pen/finger single touch
425 * - finger multitouch, pen not working
428 static int ntrig_input_mapping(struct hid_device *hdev, struct hid_input *hi,
429 struct hid_field *field, struct hid_usage *usage,
430 unsigned long **bit, int *max)
432 struct ntrig_data *nd = hid_get_drvdata(hdev);
434 /* No special mappings needed for the pen and single touch */
438 switch (usage->hid & HID_USAGE_PAGE) {
440 switch (usage->hid) {
442 hid_map_usage(hi, usage, bit, max,
443 EV_ABS, ABS_MT_POSITION_X);
444 input_set_abs_params(hi->input, ABS_X,
445 field->logical_minimum,
446 field->logical_maximum, 0, 0);
448 if (!nd->sensor_logical_width) {
449 nd->sensor_logical_width =
450 field->logical_maximum -
451 field->logical_minimum;
452 nd->sensor_physical_width =
453 field->physical_maximum -
454 field->physical_minimum;
455 nd->activation_width = activation_width *
456 nd->sensor_logical_width /
457 nd->sensor_physical_width;
458 nd->min_width = min_width *
459 nd->sensor_logical_width /
460 nd->sensor_physical_width;
464 hid_map_usage(hi, usage, bit, max,
465 EV_ABS, ABS_MT_POSITION_Y);
466 input_set_abs_params(hi->input, ABS_Y,
467 field->logical_minimum,
468 field->logical_maximum, 0, 0);
470 if (!nd->sensor_logical_height) {
471 nd->sensor_logical_height =
472 field->logical_maximum -
473 field->logical_minimum;
474 nd->sensor_physical_height =
475 field->physical_maximum -
476 field->physical_minimum;
477 nd->activation_height = activation_height *
478 nd->sensor_logical_height /
479 nd->sensor_physical_height;
480 nd->min_height = min_height *
481 nd->sensor_logical_height /
482 nd->sensor_physical_height;
488 case HID_UP_DIGITIZER:
489 switch (usage->hid) {
490 /* we do not want to map these for now */
491 case HID_DG_CONTACTID: /* Not trustworthy, squelch for now */
492 case HID_DG_INPUTMODE:
493 case HID_DG_DEVICEINDEX:
494 case HID_DG_CONTACTMAX:
497 /* width/height mapped on TouchMajor/TouchMinor/Orientation */
499 hid_map_usage(hi, usage, bit, max,
500 EV_ABS, ABS_MT_TOUCH_MAJOR);
503 hid_map_usage(hi, usage, bit, max,
504 EV_ABS, ABS_MT_TOUCH_MINOR);
505 input_set_abs_params(hi->input, ABS_MT_ORIENTATION,
512 /* we do not want to map these: no input-oriented meaning */
519 static int ntrig_input_mapped(struct hid_device *hdev, struct hid_input *hi,
520 struct hid_field *field, struct hid_usage *usage,
521 unsigned long **bit, int *max)
523 /* No special mappings needed for the pen and single touch */
527 if (usage->type == EV_KEY || usage->type == EV_REL
528 || usage->type == EV_ABS)
529 clear_bit(usage->code, *bit);
535 * this function is called upon all reports
536 * so that we can filter contact point information,
537 * decide whether we are in multi or single touch mode
538 * and call input_mt_sync after each point if necessary
540 static int ntrig_event (struct hid_device *hid, struct hid_field *field,
541 struct hid_usage *usage, __s32 value)
543 struct input_dev *input = field->hidinput->input;
544 struct ntrig_data *nd = hid_get_drvdata(hid);
546 /* No special handling needed for the pen */
547 if (field->application == HID_DG_PEN)
550 if (hid->claimed & HID_CLAIMED_INPUT) {
551 switch (usage->hid) {
553 /* Tag indicating the start of a multitouch group */
555 nd->first_contact_touch = 0;
557 case HID_DG_TIPSWITCH:
558 nd->tipswitch = value;
559 /* Prevent emission of touch until validated */
561 case HID_DG_CONFIDENCE:
562 nd->confidence = value;
566 /* Clear the contact footer */
567 nd->mt_foot_count = 0;
572 case HID_DG_CONTACTID:
581 * when in single touch mode, this is the last
582 * report received in a finger event. We want
583 * to emit a normal (X, Y) position
585 if (!nd->reading_mt) {
587 * TipSwitch indicates the presence of a
588 * finger in single touch mode.
590 input_report_key(input, BTN_TOUCH,
592 input_report_key(input, BTN_TOOL_DOUBLETAP,
594 input_event(input, EV_ABS, ABS_X, nd->x);
595 input_event(input, EV_ABS, ABS_Y, nd->y);
600 * we receive this when the device is in multitouch
601 * mode. The first of the three values tagged with
602 * this usage tells if the contact point is real
606 /* Shouldn't get more than 4 footer packets, so skip */
607 if (nd->mt_foot_count >= 4)
610 nd->mt_footer[nd->mt_foot_count++] = value;
612 /* if the footer isn't complete break */
613 if (nd->mt_foot_count != 4)
616 /* Pen activity signal. */
617 if (nd->mt_footer[2]) {
619 * When the pen deactivates touch, we see a
620 * bogus frame with ContactCount > 0.
622 * save a bit of work by ensuring act_state < 0
623 * even if deactivation slack is turned off.
625 nd->act_state = deactivate_slack - 1;
631 * The first footer value indicates the presence of a
634 if (nd->mt_footer[0]) {
636 * We do not want to process contacts under
637 * the size threshold, but do not want to
638 * ignore them for activation state
640 if (nd->w < nd->min_width ||
641 nd->h < nd->min_height)
646 if (nd->act_state > 0) {
648 * Contact meets the activation size threshold
650 if (nd->w >= nd->activation_width &&
651 nd->h >= nd->activation_height) {
654 * first contact, activate now
659 * avoid corrupting this frame
660 * but ensure next frame will
668 * Defer adjusting the activation state
669 * until the end of the frame.
674 /* Discarding this contact */
678 /* emit a normal (X, Y) for the first point only */
681 * TipSwitch is superfluous in multitouch
682 * mode. The footer events tell us
683 * if there is a finger on the screen or
686 nd->first_contact_touch = nd->confidence;
687 input_event(input, EV_ABS, ABS_X, nd->x);
688 input_event(input, EV_ABS, ABS_Y, nd->y);
692 input_event(input, EV_ABS, ABS_MT_POSITION_X, nd->x);
693 input_event(input, EV_ABS, ABS_MT_POSITION_Y, nd->y);
696 * Translate from height and width to size
700 input_event(input, EV_ABS,
701 ABS_MT_ORIENTATION, 1);
702 input_event(input, EV_ABS,
703 ABS_MT_TOUCH_MAJOR, nd->w);
704 input_event(input, EV_ABS,
705 ABS_MT_TOUCH_MINOR, nd->h);
707 input_event(input, EV_ABS,
708 ABS_MT_ORIENTATION, 0);
709 input_event(input, EV_ABS,
710 ABS_MT_TOUCH_MAJOR, nd->h);
711 input_event(input, EV_ABS,
712 ABS_MT_TOUCH_MINOR, nd->w);
714 input_mt_sync(field->hidinput->input);
717 case HID_DG_CONTACTCOUNT: /* End of a multitouch group */
718 if (!nd->reading_mt) /* Just to be sure */
725 * Activation state machine logic:
727 * Fundamental states:
728 * state > 0: Inactive
730 * state < -deactivate_slack:
731 * Pen termination of touch
733 * Specific values of interest
734 * state == activate_slack
735 * no valid input since the last reset
738 * general operational state
740 * state == -deactivate_slack
741 * read sufficient empty frames to accept
742 * the end of input and reset
745 if (nd->act_state > 0) { /* Currently inactive */
748 * Consider each live contact as
749 * evidence of intentional activity.
751 nd->act_state = (nd->act_state > value)
752 ? nd->act_state - value
756 * Empty frame before we hit the
757 * activity threshold, reset.
759 nd->act_state = nd->activate_slack;
762 * Entered this block inactive and no
763 * coordinates sent this frame, so hold off
767 } else { /* Currently active */
768 if (value && nd->act_state >=
769 nd->deactivate_slack)
771 * Live point: clear accumulated
772 * deactivation count.
775 else if (nd->act_state <= nd->deactivate_slack)
777 * We've consumed the deactivation
778 * slack, time to deactivate and reset.
782 else { /* Move towards deactivation */
788 if (nd->first_contact_touch && nd->act_state <= 0) {
790 * Check to see if we're ready to start
791 * emitting touch events.
793 * Note: activation slack will decrease over
794 * the course of the frame, and it will be
795 * inconsistent from the start to the end of
796 * the frame. However if the frame starts
797 * with slack, first_contact_touch will still
798 * be 0 and we will not get to this point.
800 input_report_key(input, BTN_TOOL_DOUBLETAP, 1);
801 input_report_key(input, BTN_TOUCH, 1);
803 input_report_key(input, BTN_TOOL_DOUBLETAP, 0);
804 input_report_key(input, BTN_TOUCH, 0);
809 /* fall-back to the generic hidinput handling */
814 /* we have handled the hidinput part, now remains hiddev */
815 if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_hid_event)
816 hid->hiddev_hid_event(hid, field, usage, value);
821 static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
824 struct ntrig_data *nd;
825 struct hid_input *hidinput;
826 struct input_dev *input;
827 struct hid_report *report;
830 hdev->quirks |= HID_QUIRK_MULTI_INPUT;
832 nd = kmalloc(sizeof(struct ntrig_data), GFP_KERNEL);
834 dev_err(&hdev->dev, "cannot allocate N-Trig data\n");
841 nd->activate_slack = activate_slack;
842 nd->act_state = activate_slack;
843 nd->deactivate_slack = -deactivate_slack;
844 nd->sensor_logical_width = 0;
845 nd->sensor_logical_height = 0;
846 nd->sensor_physical_width = 0;
847 nd->sensor_physical_height = 0;
849 hid_set_drvdata(hdev, nd);
851 ret = hid_parse(hdev);
853 dev_err(&hdev->dev, "parse failed\n");
857 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
859 dev_err(&hdev->dev, "hw start failed\n");
864 list_for_each_entry(hidinput, &hdev->inputs, list) {
865 if (hidinput->report->maxfield < 1)
868 input = hidinput->input;
869 switch (hidinput->report->field[0]->application) {
871 input->name = "N-Trig Pen";
873 case HID_DG_TOUCHSCREEN:
874 /* These keys are redundant for fingers, clear them
875 * to prevent incorrect identification */
876 __clear_bit(BTN_TOOL_PEN, input->keybit);
877 __clear_bit(BTN_TOOL_FINGER, input->keybit);
878 __clear_bit(BTN_0, input->keybit);
879 __set_bit(BTN_TOOL_DOUBLETAP, input->keybit);
881 * The physical touchscreen (single touch)
882 * input has a value for physical, whereas
883 * the multitouch only has logical input
887 (hidinput->report->field[0]
889 "N-Trig Touchscreen" :
895 /* This is needed for devices with more recent firmware versions */
896 report = hdev->report_enum[HID_FEATURE_REPORT].report_id_hash[0x0a];
898 usbhid_submit_report(hdev, report, USB_DIR_OUT);
900 ntrig_report_version(hdev);
902 ret = sysfs_create_group(&hdev->dev.kobj,
903 &ntrig_attribute_group);
911 static void ntrig_remove(struct hid_device *hdev)
913 sysfs_remove_group(&hdev->dev.kobj,
914 &ntrig_attribute_group);
916 kfree(hid_get_drvdata(hdev));
919 static const struct hid_device_id ntrig_devices[] = {
920 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN),
921 .driver_data = NTRIG_DUPLICATE_USAGES },
922 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_1),
923 .driver_data = NTRIG_DUPLICATE_USAGES },
924 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_2),
925 .driver_data = NTRIG_DUPLICATE_USAGES },
926 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_3),
927 .driver_data = NTRIG_DUPLICATE_USAGES },
928 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_4),
929 .driver_data = NTRIG_DUPLICATE_USAGES },
930 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_5),
931 .driver_data = NTRIG_DUPLICATE_USAGES },
932 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_6),
933 .driver_data = NTRIG_DUPLICATE_USAGES },
934 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_7),
935 .driver_data = NTRIG_DUPLICATE_USAGES },
936 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_8),
937 .driver_data = NTRIG_DUPLICATE_USAGES },
938 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_9),
939 .driver_data = NTRIG_DUPLICATE_USAGES },
940 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_10),
941 .driver_data = NTRIG_DUPLICATE_USAGES },
942 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_11),
943 .driver_data = NTRIG_DUPLICATE_USAGES },
944 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_12),
945 .driver_data = NTRIG_DUPLICATE_USAGES },
946 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_13),
947 .driver_data = NTRIG_DUPLICATE_USAGES },
948 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_14),
949 .driver_data = NTRIG_DUPLICATE_USAGES },
950 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_15),
951 .driver_data = NTRIG_DUPLICATE_USAGES },
952 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_16),
953 .driver_data = NTRIG_DUPLICATE_USAGES },
954 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_17),
955 .driver_data = NTRIG_DUPLICATE_USAGES },
956 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_18),
957 .driver_data = NTRIG_DUPLICATE_USAGES },
960 MODULE_DEVICE_TABLE(hid, ntrig_devices);
962 static const struct hid_usage_id ntrig_grabbed_usages[] = {
963 { HID_ANY_ID, HID_ANY_ID, HID_ANY_ID },
964 { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1 }
967 static struct hid_driver ntrig_driver = {
969 .id_table = ntrig_devices,
970 .probe = ntrig_probe,
971 .remove = ntrig_remove,
972 .input_mapping = ntrig_input_mapping,
973 .input_mapped = ntrig_input_mapped,
974 .usage_table = ntrig_grabbed_usages,
975 .event = ntrig_event,
978 static int __init ntrig_init(void)
980 return hid_register_driver(&ntrig_driver);
983 static void __exit ntrig_exit(void)
985 hid_unregister_driver(&ntrig_driver);
988 module_init(ntrig_init);
989 module_exit(ntrig_exit);
990 MODULE_LICENSE("GPL");