aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/hid/uhid.txt11
-rw-r--r--drivers/hid/hid-ids.h3
-rw-r--r--drivers/hid/hid-multitouch.c281
-rw-r--r--drivers/hid/hid-sony.c12
-rw-r--r--drivers/hid/uhid.c78
-rw-r--r--include/linux/hid.h3
-rw-r--r--include/uapi/linux/uhid.h23
7 files changed, 233 insertions, 178 deletions
diff --git a/Documentation/hid/uhid.txt b/Documentation/hid/uhid.txt
index dc35a2b75eee..ee6593608c8e 100644
--- a/Documentation/hid/uhid.txt
+++ b/Documentation/hid/uhid.txt
@@ -93,6 +93,11 @@ the request was handled successfully.
93 event to the kernel. The payload is of type struct uhid_create_req and 93 event to the kernel. The payload is of type struct uhid_create_req and
94 contains information about your device. You can start I/O now. 94 contains information about your device. You can start I/O now.
95 95
96 UHID_CREATE2:
97 Same as UHID_CREATE, but the HID report descriptor data (rd_data) is an array
98 inside struct uhid_create2_req, instead of a pointer to a separate array.
99 Enables use from languages that don't support pointers, e.g. Python.
100
96 UHID_DESTROY: 101 UHID_DESTROY:
97 This destroys the internal HID device. No further I/O will be accepted. There 102 This destroys the internal HID device. No further I/O will be accepted. There
98 may still be pending messages that you can receive with read() but no further 103 may still be pending messages that you can receive with read() but no further
@@ -105,6 +110,12 @@ the request was handled successfully.
105 contains a data-payload. This is the raw data that you read from your device. 110 contains a data-payload. This is the raw data that you read from your device.
106 The kernel will parse the HID reports and react on it. 111 The kernel will parse the HID reports and react on it.
107 112
113 UHID_INPUT2:
114 Same as UHID_INPUT, but the data array is the last field of uhid_input2_req.
115 Enables userspace to write only the required bytes to kernel (ev.type +
116 ev.u.input2.size + the part of the data array that matters), instead of
117 the entire struct uhid_input2_req.
118
108 UHID_FEATURE_ANSWER: 119 UHID_FEATURE_ANSWER:
109 If you receive a UHID_FEATURE request you must answer with this request. You 120 If you receive a UHID_FEATURE request you must answer with this request. You
110 must copy the "id" field from the request into the answer. Set the "err" field 121 must copy the "id" field from the request into the answer. Set the "err" field
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index af15a631bb24..548c1a519593 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -67,6 +67,9 @@
67#define USB_VENDOR_ID_ALPS 0x0433 67#define USB_VENDOR_ID_ALPS 0x0433
68#define USB_DEVICE_ID_IBM_GAMEPAD 0x1101 68#define USB_DEVICE_ID_IBM_GAMEPAD 0x1101
69 69
70#define USB_VENDOR_ID_ANTON 0x1130
71#define USB_DEVICE_ID_ANTON_TOUCH_PAD 0x3101
72
70#define USB_VENDOR_ID_APPLE 0x05ac 73#define USB_VENDOR_ID_APPLE 0x05ac
71#define USB_DEVICE_ID_APPLE_MIGHTYMOUSE 0x0304 74#define USB_DEVICE_ID_APPLE_MIGHTYMOUSE 0x0304
72#define USB_DEVICE_ID_APPLE_MAGICMOUSE 0x030d 75#define USB_DEVICE_ID_APPLE_MAGICMOUSE 0x030d
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index 221d503f1c24..35278e43c7a4 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -68,6 +68,9 @@ MODULE_LICENSE("GPL");
68#define MT_QUIRK_HOVERING (1 << 11) 68#define MT_QUIRK_HOVERING (1 << 11)
69#define MT_QUIRK_CONTACT_CNT_ACCURATE (1 << 12) 69#define MT_QUIRK_CONTACT_CNT_ACCURATE (1 << 12)
70 70
71#define MT_INPUTMODE_TOUCHSCREEN 0x02
72#define MT_INPUTMODE_TOUCHPAD 0x03
73
71struct mt_slot { 74struct mt_slot {
72 __s32 x, y, cx, cy, p, w, h; 75 __s32 x, y, cx, cy, p, w, h;
73 __s32 contactid; /* the device ContactID assigned to this slot */ 76 __s32 contactid; /* the device ContactID assigned to this slot */
@@ -84,6 +87,7 @@ struct mt_class {
84 __s32 sn_pressure; /* Signal/noise ratio for pressure events */ 87 __s32 sn_pressure; /* Signal/noise ratio for pressure events */
85 __u8 maxcontacts; 88 __u8 maxcontacts;
86 bool is_indirect; /* true for touchpads */ 89 bool is_indirect; /* true for touchpads */
90 bool export_all_inputs; /* do not ignore mouse, keyboards, etc... */
87}; 91};
88 92
89struct mt_fields { 93struct mt_fields {
@@ -100,11 +104,11 @@ struct mt_device {
100 int cc_value_index; /* contact count value index in the field */ 104 int cc_value_index; /* contact count value index in the field */
101 unsigned last_slot_field; /* the last field of a slot */ 105 unsigned last_slot_field; /* the last field of a slot */
102 unsigned mt_report_id; /* the report ID of the multitouch device */ 106 unsigned mt_report_id; /* the report ID of the multitouch device */
103 unsigned pen_report_id; /* the report ID of the pen device */
104 __s16 inputmode; /* InputMode HID feature, -1 if non-existent */ 107 __s16 inputmode; /* InputMode HID feature, -1 if non-existent */
105 __s16 inputmode_index; /* InputMode HID feature index in the report */ 108 __s16 inputmode_index; /* InputMode HID feature index in the report */
106 __s16 maxcontact_report_id; /* Maximum Contact Number HID feature, 109 __s16 maxcontact_report_id; /* Maximum Contact Number HID feature,
107 -1 if non-existent */ 110 -1 if non-existent */
111 __u8 inputmode_value; /* InputMode HID feature value */
108 __u8 num_received; /* how many contacts we received */ 112 __u8 num_received; /* how many contacts we received */
109 __u8 num_expected; /* expected last contact index */ 113 __u8 num_expected; /* expected last contact index */
110 __u8 maxcontacts; 114 __u8 maxcontacts;
@@ -128,16 +132,17 @@ static void mt_post_parse(struct mt_device *td);
128#define MT_CLS_CONFIDENCE_MINUS_ONE 0x0005 132#define MT_CLS_CONFIDENCE_MINUS_ONE 0x0005
129#define MT_CLS_DUAL_INRANGE_CONTACTID 0x0006 133#define MT_CLS_DUAL_INRANGE_CONTACTID 0x0006
130#define MT_CLS_DUAL_INRANGE_CONTACTNUMBER 0x0007 134#define MT_CLS_DUAL_INRANGE_CONTACTNUMBER 0x0007
131#define MT_CLS_DUAL_NSMU_CONTACTID 0x0008 135/* reserved 0x0008 */
132#define MT_CLS_INRANGE_CONTACTNUMBER 0x0009 136#define MT_CLS_INRANGE_CONTACTNUMBER 0x0009
133#define MT_CLS_NSMU 0x000a 137#define MT_CLS_NSMU 0x000a
134#define MT_CLS_DUAL_CONTACT_NUMBER 0x0010 138/* reserved 0x0010 */
135#define MT_CLS_DUAL_CONTACT_ID 0x0011 139/* reserved 0x0011 */
136#define MT_CLS_WIN_8 0x0012 140#define MT_CLS_WIN_8 0x0012
141#define MT_CLS_EXPORT_ALL_INPUTS 0x0013
137 142
138/* vendor specific classes */ 143/* vendor specific classes */
139#define MT_CLS_3M 0x0101 144#define MT_CLS_3M 0x0101
140#define MT_CLS_CYPRESS 0x0102 145/* reserved 0x0102 */
141#define MT_CLS_EGALAX 0x0103 146#define MT_CLS_EGALAX 0x0103
142#define MT_CLS_EGALAX_SERIAL 0x0104 147#define MT_CLS_EGALAX_SERIAL 0x0104
143#define MT_CLS_TOPSEED 0x0105 148#define MT_CLS_TOPSEED 0x0105
@@ -189,28 +194,18 @@ static struct mt_class mt_classes[] = {
189 .quirks = MT_QUIRK_VALID_IS_INRANGE | 194 .quirks = MT_QUIRK_VALID_IS_INRANGE |
190 MT_QUIRK_SLOT_IS_CONTACTNUMBER, 195 MT_QUIRK_SLOT_IS_CONTACTNUMBER,
191 .maxcontacts = 2 }, 196 .maxcontacts = 2 },
192 { .name = MT_CLS_DUAL_NSMU_CONTACTID,
193 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
194 MT_QUIRK_SLOT_IS_CONTACTID,
195 .maxcontacts = 2 },
196 { .name = MT_CLS_INRANGE_CONTACTNUMBER, 197 { .name = MT_CLS_INRANGE_CONTACTNUMBER,
197 .quirks = MT_QUIRK_VALID_IS_INRANGE | 198 .quirks = MT_QUIRK_VALID_IS_INRANGE |
198 MT_QUIRK_SLOT_IS_CONTACTNUMBER }, 199 MT_QUIRK_SLOT_IS_CONTACTNUMBER },
199 { .name = MT_CLS_DUAL_CONTACT_NUMBER,
200 .quirks = MT_QUIRK_ALWAYS_VALID |
201 MT_QUIRK_CONTACT_CNT_ACCURATE |
202 MT_QUIRK_SLOT_IS_CONTACTNUMBER,
203 .maxcontacts = 2 },
204 { .name = MT_CLS_DUAL_CONTACT_ID,
205 .quirks = MT_QUIRK_ALWAYS_VALID |
206 MT_QUIRK_CONTACT_CNT_ACCURATE |
207 MT_QUIRK_SLOT_IS_CONTACTID,
208 .maxcontacts = 2 },
209 { .name = MT_CLS_WIN_8, 200 { .name = MT_CLS_WIN_8,
210 .quirks = MT_QUIRK_ALWAYS_VALID | 201 .quirks = MT_QUIRK_ALWAYS_VALID |
211 MT_QUIRK_IGNORE_DUPLICATES | 202 MT_QUIRK_IGNORE_DUPLICATES |
212 MT_QUIRK_HOVERING | 203 MT_QUIRK_HOVERING |
213 MT_QUIRK_CONTACT_CNT_ACCURATE }, 204 MT_QUIRK_CONTACT_CNT_ACCURATE },
205 { .name = MT_CLS_EXPORT_ALL_INPUTS,
206 .quirks = MT_QUIRK_ALWAYS_VALID |
207 MT_QUIRK_CONTACT_CNT_ACCURATE,
208 .export_all_inputs = true },
214 209
215 /* 210 /*
216 * vendor specific classes 211 * vendor specific classes
@@ -223,10 +218,6 @@ static struct mt_class mt_classes[] = {
223 .sn_height = 128, 218 .sn_height = 128,
224 .maxcontacts = 60, 219 .maxcontacts = 60,
225 }, 220 },
226 { .name = MT_CLS_CYPRESS,
227 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
228 MT_QUIRK_CYPRESS,
229 .maxcontacts = 10 },
230 { .name = MT_CLS_EGALAX, 221 { .name = MT_CLS_EGALAX,
231 .quirks = MT_QUIRK_SLOT_IS_CONTACTID | 222 .quirks = MT_QUIRK_SLOT_IS_CONTACTID |
232 MT_QUIRK_VALID_IS_INRANGE, 223 MT_QUIRK_VALID_IS_INRANGE,
@@ -360,45 +351,6 @@ static void mt_store_field(struct hid_usage *usage, struct mt_device *td,
360 f->usages[f->length++] = usage->hid; 351 f->usages[f->length++] = usage->hid;
361} 352}
362 353
363static int mt_pen_input_mapping(struct hid_device *hdev, struct hid_input *hi,
364 struct hid_field *field, struct hid_usage *usage,
365 unsigned long **bit, int *max)
366{
367 struct mt_device *td = hid_get_drvdata(hdev);
368
369 td->pen_report_id = field->report->id;
370
371 return 0;
372}
373
374static int mt_pen_input_mapped(struct hid_device *hdev, struct hid_input *hi,
375 struct hid_field *field, struct hid_usage *usage,
376 unsigned long **bit, int *max)
377{
378 return 0;
379}
380
381static int mt_pen_event(struct hid_device *hid, struct hid_field *field,
382 struct hid_usage *usage, __s32 value)
383{
384 /* let hid-input handle it */
385 return 0;
386}
387
388static void mt_pen_report(struct hid_device *hid, struct hid_report *report)
389{
390 struct hid_field *field = report->field[0];
391
392 input_sync(field->hidinput->input);
393}
394
395static void mt_pen_input_configured(struct hid_device *hdev,
396 struct hid_input *hi)
397{
398 /* force BTN_STYLUS to allow tablet matching in udev */
399 __set_bit(BTN_STYLUS, hi->input->keybit);
400}
401
402static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi, 354static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi,
403 struct hid_field *field, struct hid_usage *usage, 355 struct hid_field *field, struct hid_usage *usage,
404 unsigned long **bit, int *max) 356 unsigned long **bit, int *max)
@@ -415,8 +367,10 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi,
415 * Model touchscreens providing buttons as touchpads. 367 * Model touchscreens providing buttons as touchpads.
416 */ 368 */
417 if (field->application == HID_DG_TOUCHPAD || 369 if (field->application == HID_DG_TOUCHPAD ||
418 (usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON) 370 (usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON) {
419 td->mt_flags |= INPUT_MT_POINTER; 371 td->mt_flags |= INPUT_MT_POINTER;
372 td->inputmode_value = MT_INPUTMODE_TOUCHPAD;
373 }
420 374
421 if (usage->usage_index) 375 if (usage->usage_index)
422 prev_usage = &field->usage[usage->usage_index - 1]; 376 prev_usage = &field->usage[usage->usage_index - 1];
@@ -776,28 +730,52 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
776 struct hid_field *field, struct hid_usage *usage, 730 struct hid_field *field, struct hid_usage *usage,
777 unsigned long **bit, int *max) 731 unsigned long **bit, int *max)
778{ 732{
779 /* Only map fields from TouchScreen or TouchPad collections. 733 struct mt_device *td = hid_get_drvdata(hdev);
780 * We need to ignore fields that belong to other collections 734
781 * such as Mouse that might have the same GenericDesktop usages. */ 735 /*
782 if (field->application != HID_DG_TOUCHSCREEN && 736 * If mtclass.export_all_inputs is not set, only map fields from
737 * TouchScreen or TouchPad collections. We need to ignore fields
738 * that belong to other collections such as Mouse that might have
739 * the same GenericDesktop usages.
740 */
741 if (!td->mtclass.export_all_inputs &&
742 field->application != HID_DG_TOUCHSCREEN &&
783 field->application != HID_DG_PEN && 743 field->application != HID_DG_PEN &&
784 field->application != HID_DG_TOUCHPAD) 744 field->application != HID_DG_TOUCHPAD)
785 return -1; 745 return -1;
786 746
747 /*
748 * some egalax touchscreens have "application == HID_DG_TOUCHSCREEN"
749 * for the stylus.
750 */
787 if (field->physical == HID_DG_STYLUS) 751 if (field->physical == HID_DG_STYLUS)
788 return mt_pen_input_mapping(hdev, hi, field, usage, bit, max); 752 return 0;
789 753
790 return mt_touch_input_mapping(hdev, hi, field, usage, bit, max); 754 if (field->application == HID_DG_TOUCHSCREEN ||
755 field->application == HID_DG_TOUCHPAD)
756 return mt_touch_input_mapping(hdev, hi, field, usage, bit, max);
757
758 /* let hid-core decide for the others */
759 return 0;
791} 760}
792 761
793static int mt_input_mapped(struct hid_device *hdev, struct hid_input *hi, 762static int mt_input_mapped(struct hid_device *hdev, struct hid_input *hi,
794 struct hid_field *field, struct hid_usage *usage, 763 struct hid_field *field, struct hid_usage *usage,
795 unsigned long **bit, int *max) 764 unsigned long **bit, int *max)
796{ 765{
766 /*
767 * some egalax touchscreens have "application == HID_DG_TOUCHSCREEN"
768 * for the stylus.
769 */
797 if (field->physical == HID_DG_STYLUS) 770 if (field->physical == HID_DG_STYLUS)
798 return mt_pen_input_mapped(hdev, hi, field, usage, bit, max); 771 return 0;
799 772
800 return mt_touch_input_mapped(hdev, hi, field, usage, bit, max); 773 if (field->application == HID_DG_TOUCHSCREEN ||
774 field->application == HID_DG_TOUCHPAD)
775 return mt_touch_input_mapped(hdev, hi, field, usage, bit, max);
776
777 /* let hid-core decide for the others */
778 return 0;
801} 779}
802 780
803static int mt_event(struct hid_device *hid, struct hid_field *field, 781static int mt_event(struct hid_device *hid, struct hid_field *field,
@@ -808,25 +786,22 @@ static int mt_event(struct hid_device *hid, struct hid_field *field,
808 if (field->report->id == td->mt_report_id) 786 if (field->report->id == td->mt_report_id)
809 return mt_touch_event(hid, field, usage, value); 787 return mt_touch_event(hid, field, usage, value);
810 788
811 if (field->report->id == td->pen_report_id) 789 return 0;
812 return mt_pen_event(hid, field, usage, value);
813
814 /* ignore other reports */
815 return 1;
816} 790}
817 791
818static void mt_report(struct hid_device *hid, struct hid_report *report) 792static void mt_report(struct hid_device *hid, struct hid_report *report)
819{ 793{
820 struct mt_device *td = hid_get_drvdata(hid); 794 struct mt_device *td = hid_get_drvdata(hid);
795 struct hid_field *field = report->field[0];
821 796
822 if (!(hid->claimed & HID_CLAIMED_INPUT)) 797 if (!(hid->claimed & HID_CLAIMED_INPUT))
823 return; 798 return;
824 799
825 if (report->id == td->mt_report_id) 800 if (report->id == td->mt_report_id)
826 mt_touch_report(hid, report); 801 return mt_touch_report(hid, report);
827 802
828 if (report->id == td->pen_report_id) 803 if (field && field->hidinput && field->hidinput->input)
829 mt_pen_report(hid, report); 804 input_sync(field->hidinput->input);
830} 805}
831 806
832static void mt_set_input_mode(struct hid_device *hdev) 807static void mt_set_input_mode(struct hid_device *hdev)
@@ -841,7 +816,7 @@ static void mt_set_input_mode(struct hid_device *hdev)
841 re = &(hdev->report_enum[HID_FEATURE_REPORT]); 816 re = &(hdev->report_enum[HID_FEATURE_REPORT]);
842 r = re->report_id_hash[td->inputmode]; 817 r = re->report_id_hash[td->inputmode];
843 if (r) { 818 if (r) {
844 r->field[0]->value[td->inputmode_index] = 0x02; 819 r->field[0]->value[td->inputmode_index] = td->inputmode_value;
845 hid_hw_request(hdev, r, HID_REQ_SET_REPORT); 820 hid_hw_request(hdev, r, HID_REQ_SET_REPORT);
846 } 821 }
847} 822}
@@ -907,13 +882,49 @@ static void mt_input_configured(struct hid_device *hdev, struct hid_input *hi)
907 struct mt_device *td = hid_get_drvdata(hdev); 882 struct mt_device *td = hid_get_drvdata(hdev);
908 char *name; 883 char *name;
909 const char *suffix = NULL; 884 const char *suffix = NULL;
885 struct hid_field *field = hi->report->field[0];
910 886
911 if (hi->report->id == td->mt_report_id) 887 if (hi->report->id == td->mt_report_id)
912 mt_touch_input_configured(hdev, hi); 888 mt_touch_input_configured(hdev, hi);
913 889
890 /*
891 * some egalax touchscreens have "application == HID_DG_TOUCHSCREEN"
892 * for the stylus. Check this first, and then rely on the application
893 * field.
894 */
914 if (hi->report->field[0]->physical == HID_DG_STYLUS) { 895 if (hi->report->field[0]->physical == HID_DG_STYLUS) {
915 suffix = "Pen"; 896 suffix = "Pen";
916 mt_pen_input_configured(hdev, hi); 897 /* force BTN_STYLUS to allow tablet matching in udev */
898 __set_bit(BTN_STYLUS, hi->input->keybit);
899 } else {
900 switch (field->application) {
901 case HID_GD_KEYBOARD:
902 suffix = "Keyboard";
903 break;
904 case HID_GD_KEYPAD:
905 suffix = "Keypad";
906 break;
907 case HID_GD_MOUSE:
908 suffix = "Mouse";
909 break;
910 case HID_DG_STYLUS:
911 suffix = "Pen";
912 /* force BTN_STYLUS to allow tablet matching in udev */
913 __set_bit(BTN_STYLUS, hi->input->keybit);
914 break;
915 case HID_DG_TOUCHSCREEN:
916 /* we do not set suffix = "Touchscreen" */
917 break;
918 case HID_GD_SYSTEM_CONTROL:
919 suffix = "System Control";
920 break;
921 case HID_CP_CONSUMER_CONTROL:
922 suffix = "Consumer Control";
923 break;
924 default:
925 suffix = "UNKNOWN";
926 break;
927 }
917 } 928 }
918 929
919 if (suffix) { 930 if (suffix) {
@@ -973,9 +984,9 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
973 td->mtclass = *mtclass; 984 td->mtclass = *mtclass;
974 td->inputmode = -1; 985 td->inputmode = -1;
975 td->maxcontact_report_id = -1; 986 td->maxcontact_report_id = -1;
987 td->inputmode_value = MT_INPUTMODE_TOUCHSCREEN;
976 td->cc_index = -1; 988 td->cc_index = -1;
977 td->mt_report_id = -1; 989 td->mt_report_id = -1;
978 td->pen_report_id = -1;
979 hid_set_drvdata(hdev, td); 990 hid_set_drvdata(hdev, td);
980 991
981 td->fields = devm_kzalloc(&hdev->dev, sizeof(struct mt_fields), 992 td->fields = devm_kzalloc(&hdev->dev, sizeof(struct mt_fields),
@@ -1034,6 +1045,12 @@ static void mt_remove(struct hid_device *hdev)
1034 hid_hw_stop(hdev); 1045 hid_hw_stop(hdev);
1035} 1046}
1036 1047
1048/*
1049 * This list contains only:
1050 * - VID/PID of products not working with the default multitouch handling
1051 * - 2 generic rules.
1052 * So there is no point in adding here any device with MT_CLS_DEFAULT.
1053 */
1037static const struct hid_device_id mt_devices[] = { 1054static const struct hid_device_id mt_devices[] = {
1038 1055
1039 /* 3M panels */ 1056 /* 3M panels */
@@ -1047,33 +1064,25 @@ static const struct hid_device_id mt_devices[] = {
1047 MT_USB_DEVICE(USB_VENDOR_ID_3M, 1064 MT_USB_DEVICE(USB_VENDOR_ID_3M,
1048 USB_DEVICE_ID_3M3266) }, 1065 USB_DEVICE_ID_3M3266) },
1049 1066
1050 /* ActionStar panels */ 1067 /* Anton devices */
1051 { .driver_data = MT_CLS_NSMU, 1068 { .driver_data = MT_CLS_EXPORT_ALL_INPUTS,
1052 MT_USB_DEVICE(USB_VENDOR_ID_ACTIONSTAR, 1069 MT_USB_DEVICE(USB_VENDOR_ID_ANTON,
1053 USB_DEVICE_ID_ACTIONSTAR_1011) }, 1070 USB_DEVICE_ID_ANTON_TOUCH_PAD) },
1054 1071
1055 /* Atmel panels */ 1072 /* Atmel panels */
1056 { .driver_data = MT_CLS_SERIAL, 1073 { .driver_data = MT_CLS_SERIAL,
1057 MT_USB_DEVICE(USB_VENDOR_ID_ATMEL, 1074 MT_USB_DEVICE(USB_VENDOR_ID_ATMEL,
1058 USB_DEVICE_ID_ATMEL_MULTITOUCH) },
1059 { .driver_data = MT_CLS_SERIAL,
1060 MT_USB_DEVICE(USB_VENDOR_ID_ATMEL,
1061 USB_DEVICE_ID_ATMEL_MXT_DIGITIZER) }, 1075 USB_DEVICE_ID_ATMEL_MXT_DIGITIZER) },
1062 1076
1063 /* Baanto multitouch devices */ 1077 /* Baanto multitouch devices */
1064 { .driver_data = MT_CLS_NSMU, 1078 { .driver_data = MT_CLS_NSMU,
1065 MT_USB_DEVICE(USB_VENDOR_ID_BAANTO, 1079 MT_USB_DEVICE(USB_VENDOR_ID_BAANTO,
1066 USB_DEVICE_ID_BAANTO_MT_190W2) }, 1080 USB_DEVICE_ID_BAANTO_MT_190W2) },
1081
1067 /* Cando panels */ 1082 /* Cando panels */
1068 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER, 1083 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
1069 MT_USB_DEVICE(USB_VENDOR_ID_CANDO, 1084 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
1070 USB_DEVICE_ID_CANDO_MULTI_TOUCH) }, 1085 USB_DEVICE_ID_CANDO_MULTI_TOUCH) },
1071 { .driver_data = MT_CLS_DUAL_CONTACT_NUMBER,
1072 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
1073 USB_DEVICE_ID_CANDO_MULTI_TOUCH_10_1) },
1074 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
1075 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
1076 USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6) },
1077 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER, 1086 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
1078 MT_USB_DEVICE(USB_VENDOR_ID_CANDO, 1087 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
1079 USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) }, 1088 USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) },
@@ -1088,16 +1097,6 @@ static const struct hid_device_id mt_devices[] = {
1088 MT_USB_DEVICE(USB_VENDOR_ID_CVTOUCH, 1097 MT_USB_DEVICE(USB_VENDOR_ID_CVTOUCH,
1089 USB_DEVICE_ID_CVTOUCH_SCREEN) }, 1098 USB_DEVICE_ID_CVTOUCH_SCREEN) },
1090 1099
1091 /* Cypress panel */
1092 { .driver_data = MT_CLS_CYPRESS,
1093 HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS,
1094 USB_DEVICE_ID_CYPRESS_TRUETOUCH) },
1095
1096 /* Data Modul easyMaxTouch */
1097 { .driver_data = MT_CLS_DEFAULT,
1098 MT_USB_DEVICE(USB_VENDOR_ID_DATA_MODUL,
1099 USB_VENDOR_ID_DATA_MODUL_EASYMAXTOUCH) },
1100
1101 /* eGalax devices (resistive) */ 1100 /* eGalax devices (resistive) */
1102 { .driver_data = MT_CLS_EGALAX, 1101 { .driver_data = MT_CLS_EGALAX,
1103 MT_USB_DEVICE(USB_VENDOR_ID_DWAV, 1102 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
@@ -1156,11 +1155,6 @@ static const struct hid_device_id mt_devices[] = {
1156 MT_USB_DEVICE(USB_VENDOR_ID_DWAV, 1155 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
1157 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001) }, 1156 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001) },
1158 1157
1159 /* Elo TouchSystems IntelliTouch Plus panel */
1160 { .driver_data = MT_CLS_DUAL_CONTACT_ID,
1161 MT_USB_DEVICE(USB_VENDOR_ID_ELO,
1162 USB_DEVICE_ID_ELO_TS2515) },
1163
1164 /* Flatfrog Panels */ 1158 /* Flatfrog Panels */
1165 { .driver_data = MT_CLS_FLATFROG, 1159 { .driver_data = MT_CLS_FLATFROG,
1166 MT_USB_DEVICE(USB_VENDOR_ID_FLATFROG, 1160 MT_USB_DEVICE(USB_VENDOR_ID_FLATFROG,
@@ -1209,37 +1203,11 @@ static const struct hid_device_id mt_devices[] = {
1209 MT_USB_DEVICE(USB_VENDOR_ID_HANVON_ALT, 1203 MT_USB_DEVICE(USB_VENDOR_ID_HANVON_ALT,
1210 USB_DEVICE_ID_HANVON_ALT_MULTITOUCH) }, 1204 USB_DEVICE_ID_HANVON_ALT_MULTITOUCH) },
1211 1205
1212 /* Ideacom panel */
1213 { .driver_data = MT_CLS_SERIAL,
1214 MT_USB_DEVICE(USB_VENDOR_ID_IDEACOM,
1215 USB_DEVICE_ID_IDEACOM_IDC6650) },
1216 { .driver_data = MT_CLS_SERIAL,
1217 MT_USB_DEVICE(USB_VENDOR_ID_IDEACOM,
1218 USB_DEVICE_ID_IDEACOM_IDC6651) },
1219
1220 /* Ilitek dual touch panel */ 1206 /* Ilitek dual touch panel */
1221 { .driver_data = MT_CLS_NSMU, 1207 { .driver_data = MT_CLS_NSMU,
1222 MT_USB_DEVICE(USB_VENDOR_ID_ILITEK, 1208 MT_USB_DEVICE(USB_VENDOR_ID_ILITEK,
1223 USB_DEVICE_ID_ILITEK_MULTITOUCH) }, 1209 USB_DEVICE_ID_ILITEK_MULTITOUCH) },
1224 1210
1225 /* IRTOUCH panels */
1226 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
1227 MT_USB_DEVICE(USB_VENDOR_ID_IRTOUCHSYSTEMS,
1228 USB_DEVICE_ID_IRTOUCH_INFRARED_USB) },
1229
1230 /* LG Display panels */
1231 { .driver_data = MT_CLS_DEFAULT,
1232 MT_USB_DEVICE(USB_VENDOR_ID_LG,
1233 USB_DEVICE_ID_LG_MULTITOUCH) },
1234
1235 /* Lumio panels */
1236 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
1237 MT_USB_DEVICE(USB_VENDOR_ID_LUMIO,
1238 USB_DEVICE_ID_CRYSTALTOUCH) },
1239 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
1240 MT_USB_DEVICE(USB_VENDOR_ID_LUMIO,
1241 USB_DEVICE_ID_CRYSTALTOUCH_DUAL) },
1242
1243 /* MosArt panels */ 1211 /* MosArt panels */
1244 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE, 1212 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
1245 MT_USB_DEVICE(USB_VENDOR_ID_ASUS, 1213 MT_USB_DEVICE(USB_VENDOR_ID_ASUS,
@@ -1251,11 +1219,6 @@ static const struct hid_device_id mt_devices[] = {
1251 MT_USB_DEVICE(USB_VENDOR_ID_TURBOX, 1219 MT_USB_DEVICE(USB_VENDOR_ID_TURBOX,
1252 USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART) }, 1220 USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART) },
1253 1221
1254 /* Nexio panels */
1255 { .driver_data = MT_CLS_DEFAULT,
1256 MT_USB_DEVICE(USB_VENDOR_ID_NEXIO,
1257 USB_DEVICE_ID_NEXIO_MULTITOUCH_420)},
1258
1259 /* Panasonic panels */ 1222 /* Panasonic panels */
1260 { .driver_data = MT_CLS_PANASONIC, 1223 { .driver_data = MT_CLS_PANASONIC,
1261 MT_USB_DEVICE(USB_VENDOR_ID_PANASONIC, 1224 MT_USB_DEVICE(USB_VENDOR_ID_PANASONIC,
@@ -1269,11 +1232,6 @@ static const struct hid_device_id mt_devices[] = {
1269 MT_USB_DEVICE(USB_VENDOR_ID_NOVATEK, 1232 MT_USB_DEVICE(USB_VENDOR_ID_NOVATEK,
1270 USB_DEVICE_ID_NOVATEK_PCT) }, 1233 USB_DEVICE_ID_NOVATEK_PCT) },
1271 1234
1272 /* PenMount panels */
1273 { .driver_data = MT_CLS_CONFIDENCE,
1274 MT_USB_DEVICE(USB_VENDOR_ID_PENMOUNT,
1275 USB_DEVICE_ID_PENMOUNT_PCI) },
1276
1277 /* PixArt optical touch screen */ 1235 /* PixArt optical touch screen */
1278 { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER, 1236 { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER,
1279 MT_USB_DEVICE(USB_VENDOR_ID_PIXART, 1237 MT_USB_DEVICE(USB_VENDOR_ID_PIXART,
@@ -1287,44 +1245,18 @@ static const struct hid_device_id mt_devices[] = {
1287 1245
1288 /* PixCir-based panels */ 1246 /* PixCir-based panels */
1289 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID, 1247 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
1290 MT_USB_DEVICE(USB_VENDOR_ID_HANVON,
1291 USB_DEVICE_ID_HANVON_MULTITOUCH) },
1292 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
1293 MT_USB_DEVICE(USB_VENDOR_ID_CANDO, 1248 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
1294 USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH) }, 1249 USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH) },
1295 1250
1296 /* Quanta-based panels */ 1251 /* Quanta-based panels */
1297 { .driver_data = MT_CLS_CONFIDENCE_CONTACT_ID, 1252 { .driver_data = MT_CLS_CONFIDENCE_CONTACT_ID,
1298 MT_USB_DEVICE(USB_VENDOR_ID_QUANTA, 1253 MT_USB_DEVICE(USB_VENDOR_ID_QUANTA,
1299 USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH) },
1300 { .driver_data = MT_CLS_CONFIDENCE_CONTACT_ID,
1301 MT_USB_DEVICE(USB_VENDOR_ID_QUANTA,
1302 USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3001) }, 1254 USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3001) },
1303 { .driver_data = MT_CLS_CONFIDENCE_CONTACT_ID,
1304 MT_USB_DEVICE(USB_VENDOR_ID_QUANTA,
1305 USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008) },
1306
1307 /* SiS panels */
1308 { .driver_data = MT_CLS_DEFAULT,
1309 HID_USB_DEVICE(USB_VENDOR_ID_SIS_TOUCH,
1310 USB_DEVICE_ID_SIS9200_TOUCH) },
1311 { .driver_data = MT_CLS_DEFAULT,
1312 HID_USB_DEVICE(USB_VENDOR_ID_SIS_TOUCH,
1313 USB_DEVICE_ID_SIS817_TOUCH) },
1314 { .driver_data = MT_CLS_DEFAULT,
1315 HID_USB_DEVICE(USB_VENDOR_ID_SIS_TOUCH,
1316 USB_DEVICE_ID_SIS1030_TOUCH) },
1317 1255
1318 /* Stantum panels */ 1256 /* Stantum panels */
1319 { .driver_data = MT_CLS_CONFIDENCE, 1257 { .driver_data = MT_CLS_CONFIDENCE,
1320 MT_USB_DEVICE(USB_VENDOR_ID_STANTUM,
1321 USB_DEVICE_ID_MTP)},
1322 { .driver_data = MT_CLS_CONFIDENCE,
1323 MT_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM, 1258 MT_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM,
1324 USB_DEVICE_ID_MTP_STM)}, 1259 USB_DEVICE_ID_MTP_STM)},
1325 { .driver_data = MT_CLS_DEFAULT,
1326 MT_USB_DEVICE(USB_VENDOR_ID_STANTUM_SITRONIX,
1327 USB_DEVICE_ID_MTP_SITRONIX)},
1328 1260
1329 /* TopSeed panels */ 1261 /* TopSeed panels */
1330 { .driver_data = MT_CLS_TOPSEED, 1262 { .driver_data = MT_CLS_TOPSEED,
@@ -1383,11 +1315,6 @@ static const struct hid_device_id mt_devices[] = {
1383 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU, 1315 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
1384 USB_DEVICE_ID_XIROKU_CSR2) }, 1316 USB_DEVICE_ID_XIROKU_CSR2) },
1385 1317
1386 /* Zytronic panels */
1387 { .driver_data = MT_CLS_SERIAL,
1388 MT_USB_DEVICE(USB_VENDOR_ID_ZYTRONIC,
1389 USB_DEVICE_ID_ZYTRONIC_ZXY100) },
1390
1391 /* Generic MT device */ 1318 /* Generic MT device */
1392 { HID_DEVICE(HID_BUS_ANY, HID_GROUP_MULTITOUCH, HID_ANY_ID, HID_ANY_ID) }, 1319 { HID_DEVICE(HID_BUS_ANY, HID_GROUP_MULTITOUCH, HID_ANY_ID, HID_ANY_ID) },
1393 1320
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index b3e82585309e..4d348c069981 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -863,7 +863,7 @@ static void sixaxis_parse_report(struct sony_sc *sc, __u8 *rd, int size)
863 battery_capacity = sixaxis_battery_capacity[index]; 863 battery_capacity = sixaxis_battery_capacity[index];
864 battery_charging = 0; 864 battery_charging = 0;
865 } 865 }
866 cable_state = !((rd[31] >> 4) & 0x01); 866 cable_state = !(rd[31] & 0x04);
867 867
868 spin_lock_irqsave(&sc->lock, flags); 868 spin_lock_irqsave(&sc->lock, flags);
869 sc->cable_state = cable_state; 869 sc->cable_state = cable_state;
@@ -1632,11 +1632,21 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
1632 sc->worker_initialized = 1; 1632 sc->worker_initialized = 1;
1633 INIT_WORK(&sc->state_worker, sixaxis_state_worker); 1633 INIT_WORK(&sc->state_worker, sixaxis_state_worker);
1634 } else if (sc->quirks & SIXAXIS_CONTROLLER_BT) { 1634 } else if (sc->quirks & SIXAXIS_CONTROLLER_BT) {
1635 /*
1636 * The Sixaxis wants output reports sent on the ctrl endpoint
1637 * when connected via Bluetooth.
1638 */
1639 hdev->quirks |= HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP;
1635 ret = sixaxis_set_operational_bt(hdev); 1640 ret = sixaxis_set_operational_bt(hdev);
1636 sc->worker_initialized = 1; 1641 sc->worker_initialized = 1;
1637 INIT_WORK(&sc->state_worker, sixaxis_state_worker); 1642 INIT_WORK(&sc->state_worker, sixaxis_state_worker);
1638 } else if (sc->quirks & DUALSHOCK4_CONTROLLER) { 1643 } else if (sc->quirks & DUALSHOCK4_CONTROLLER) {
1639 if (sc->quirks & DUALSHOCK4_CONTROLLER_BT) { 1644 if (sc->quirks & DUALSHOCK4_CONTROLLER_BT) {
1645 /*
1646 * The DualShock 4 wants output reports sent on the ctrl
1647 * endpoint when connected via Bluetooth.
1648 */
1649 hdev->quirks |= HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP;
1640 ret = dualshock4_set_operational_bt(hdev); 1650 ret = dualshock4_set_operational_bt(hdev);
1641 if (ret < 0) { 1651 if (ret < 0) {
1642 hid_err(hdev, "failed to set the Dualshock 4 operational mode\n"); 1652 hid_err(hdev, "failed to set the Dualshock 4 operational mode\n");
diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c
index 7ed79be2686a..0d078c32db4f 100644
--- a/drivers/hid/uhid.c
+++ b/drivers/hid/uhid.c
@@ -428,6 +428,67 @@ err_free:
428 return ret; 428 return ret;
429} 429}
430 430
431static int uhid_dev_create2(struct uhid_device *uhid,
432 const struct uhid_event *ev)
433{
434 struct hid_device *hid;
435 int ret;
436
437 if (uhid->running)
438 return -EALREADY;
439
440 uhid->rd_size = ev->u.create2.rd_size;
441 if (uhid->rd_size <= 0 || uhid->rd_size > HID_MAX_DESCRIPTOR_SIZE)
442 return -EINVAL;
443
444 uhid->rd_data = kmalloc(uhid->rd_size, GFP_KERNEL);
445 if (!uhid->rd_data)
446 return -ENOMEM;
447
448 memcpy(uhid->rd_data, ev->u.create2.rd_data, uhid->rd_size);
449
450 hid = hid_allocate_device();
451 if (IS_ERR(hid)) {
452 ret = PTR_ERR(hid);
453 goto err_free;
454 }
455
456 strncpy(hid->name, ev->u.create2.name, 127);
457 hid->name[127] = 0;
458 strncpy(hid->phys, ev->u.create2.phys, 63);
459 hid->phys[63] = 0;
460 strncpy(hid->uniq, ev->u.create2.uniq, 63);
461 hid->uniq[63] = 0;
462
463 hid->ll_driver = &uhid_hid_driver;
464 hid->bus = ev->u.create2.bus;
465 hid->vendor = ev->u.create2.vendor;
466 hid->product = ev->u.create2.product;
467 hid->version = ev->u.create2.version;
468 hid->country = ev->u.create2.country;
469 hid->driver_data = uhid;
470 hid->dev.parent = uhid_misc.this_device;
471
472 uhid->hid = hid;
473 uhid->running = true;
474
475 ret = hid_add_device(hid);
476 if (ret) {
477 hid_err(hid, "Cannot register HID device\n");
478 goto err_hid;
479 }
480
481 return 0;
482
483err_hid:
484 hid_destroy_device(hid);
485 uhid->hid = NULL;
486 uhid->running = false;
487err_free:
488 kfree(uhid->rd_data);
489 return ret;
490}
491
431static int uhid_dev_destroy(struct uhid_device *uhid) 492static int uhid_dev_destroy(struct uhid_device *uhid)
432{ 493{
433 if (!uhid->running) 494 if (!uhid->running)
@@ -456,6 +517,17 @@ static int uhid_dev_input(struct uhid_device *uhid, struct uhid_event *ev)
456 return 0; 517 return 0;
457} 518}
458 519
520static int uhid_dev_input2(struct uhid_device *uhid, struct uhid_event *ev)
521{
522 if (!uhid->running)
523 return -EINVAL;
524
525 hid_input_report(uhid->hid, HID_INPUT_REPORT, ev->u.input2.data,
526 min_t(size_t, ev->u.input2.size, UHID_DATA_MAX), 0);
527
528 return 0;
529}
530
459static int uhid_dev_feature_answer(struct uhid_device *uhid, 531static int uhid_dev_feature_answer(struct uhid_device *uhid,
460 struct uhid_event *ev) 532 struct uhid_event *ev)
461{ 533{
@@ -592,12 +664,18 @@ static ssize_t uhid_char_write(struct file *file, const char __user *buffer,
592 case UHID_CREATE: 664 case UHID_CREATE:
593 ret = uhid_dev_create(uhid, &uhid->input_buf); 665 ret = uhid_dev_create(uhid, &uhid->input_buf);
594 break; 666 break;
667 case UHID_CREATE2:
668 ret = uhid_dev_create2(uhid, &uhid->input_buf);
669 break;
595 case UHID_DESTROY: 670 case UHID_DESTROY:
596 ret = uhid_dev_destroy(uhid); 671 ret = uhid_dev_destroy(uhid);
597 break; 672 break;
598 case UHID_INPUT: 673 case UHID_INPUT:
599 ret = uhid_dev_input(uhid, &uhid->input_buf); 674 ret = uhid_dev_input(uhid, &uhid->input_buf);
600 break; 675 break;
676 case UHID_INPUT2:
677 ret = uhid_dev_input2(uhid, &uhid->input_buf);
678 break;
601 case UHID_FEATURE_ANSWER: 679 case UHID_FEATURE_ANSWER:
602 ret = uhid_dev_feature_answer(uhid, &uhid->input_buf); 680 ret = uhid_dev_feature_answer(uhid, &uhid->input_buf);
603 break; 681 break;
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 01a90b8d53bb..720e3a10608c 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -201,6 +201,7 @@ struct hid_item {
201#define HID_GD_VBRZ 0x00010045 201#define HID_GD_VBRZ 0x00010045
202#define HID_GD_VNO 0x00010046 202#define HID_GD_VNO 0x00010046
203#define HID_GD_FEATURE 0x00010047 203#define HID_GD_FEATURE 0x00010047
204#define HID_GD_SYSTEM_CONTROL 0x00010080
204#define HID_GD_UP 0x00010090 205#define HID_GD_UP 0x00010090
205#define HID_GD_DOWN 0x00010091 206#define HID_GD_DOWN 0x00010091
206#define HID_GD_RIGHT 0x00010092 207#define HID_GD_RIGHT 0x00010092
@@ -208,6 +209,8 @@ struct hid_item {
208 209
209#define HID_DC_BATTERYSTRENGTH 0x00060020 210#define HID_DC_BATTERYSTRENGTH 0x00060020
210 211
212#define HID_CP_CONSUMER_CONTROL 0x000c0001
213
211#define HID_DG_DIGITIZER 0x000d0001 214#define HID_DG_DIGITIZER 0x000d0001
212#define HID_DG_PEN 0x000d0002 215#define HID_DG_PEN 0x000d0002
213#define HID_DG_LIGHTPEN 0x000d0003 216#define HID_DG_LIGHTPEN 0x000d0003
diff --git a/include/uapi/linux/uhid.h b/include/uapi/linux/uhid.h
index 414b74be4da1..1e3b09c191cd 100644
--- a/include/uapi/linux/uhid.h
+++ b/include/uapi/linux/uhid.h
@@ -21,6 +21,7 @@
21 21
22#include <linux/input.h> 22#include <linux/input.h>
23#include <linux/types.h> 23#include <linux/types.h>
24#include <linux/hid.h>
24 25
25enum uhid_event_type { 26enum uhid_event_type {
26 UHID_CREATE, 27 UHID_CREATE,
@@ -34,6 +35,8 @@ enum uhid_event_type {
34 UHID_INPUT, 35 UHID_INPUT,
35 UHID_FEATURE, 36 UHID_FEATURE,
36 UHID_FEATURE_ANSWER, 37 UHID_FEATURE_ANSWER,
38 UHID_CREATE2,
39 UHID_INPUT2,
37}; 40};
38 41
39struct uhid_create_req { 42struct uhid_create_req {
@@ -50,6 +53,19 @@ struct uhid_create_req {
50 __u32 country; 53 __u32 country;
51} __attribute__((__packed__)); 54} __attribute__((__packed__));
52 55
56struct uhid_create2_req {
57 __u8 name[128];
58 __u8 phys[64];
59 __u8 uniq[64];
60 __u16 rd_size;
61 __u16 bus;
62 __u32 vendor;
63 __u32 product;
64 __u32 version;
65 __u32 country;
66 __u8 rd_data[HID_MAX_DESCRIPTOR_SIZE];
67} __attribute__((__packed__));
68
53#define UHID_DATA_MAX 4096 69#define UHID_DATA_MAX 4096
54 70
55enum uhid_report_type { 71enum uhid_report_type {
@@ -63,6 +79,11 @@ struct uhid_input_req {
63 __u16 size; 79 __u16 size;
64} __attribute__((__packed__)); 80} __attribute__((__packed__));
65 81
82struct uhid_input2_req {
83 __u16 size;
84 __u8 data[UHID_DATA_MAX];
85} __attribute__((__packed__));
86
66struct uhid_output_req { 87struct uhid_output_req {
67 __u8 data[UHID_DATA_MAX]; 88 __u8 data[UHID_DATA_MAX];
68 __u16 size; 89 __u16 size;
@@ -100,6 +121,8 @@ struct uhid_event {
100 struct uhid_output_ev_req output_ev; 121 struct uhid_output_ev_req output_ev;
101 struct uhid_feature_req feature; 122 struct uhid_feature_req feature;
102 struct uhid_feature_answer_req feature_answer; 123 struct uhid_feature_answer_req feature_answer;
124 struct uhid_create2_req create2;
125 struct uhid_input2_req input2;
103 } u; 126 } u;
104} __attribute__((__packed__)); 127} __attribute__((__packed__));
105 128