aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/uapi/linux/uhid.h101
1 files changed, 62 insertions, 39 deletions
diff --git a/include/uapi/linux/uhid.h b/include/uapi/linux/uhid.h
index 0a08f2bbe642..116536eeae62 100644
--- a/include/uapi/linux/uhid.h
+++ b/include/uapi/linux/uhid.h
@@ -24,37 +24,21 @@
24#include <linux/hid.h> 24#include <linux/hid.h>
25 25
26enum uhid_event_type { 26enum uhid_event_type {
27 UHID_CREATE, 27 __UHID_LEGACY_CREATE,
28 UHID_DESTROY, 28 UHID_DESTROY,
29 UHID_START, 29 UHID_START,
30 UHID_STOP, 30 UHID_STOP,
31 UHID_OPEN, 31 UHID_OPEN,
32 UHID_CLOSE, 32 UHID_CLOSE,
33 UHID_OUTPUT, 33 UHID_OUTPUT,
34 UHID_OUTPUT_EV, /* obsolete! */ 34 __UHID_LEGACY_OUTPUT_EV,
35 UHID_INPUT, 35 __UHID_LEGACY_INPUT,
36 UHID_FEATURE, /* obsolete! use UHID_GET_REPORT */ 36 UHID_GET_REPORT,
37 UHID_GET_REPORT = UHID_FEATURE, 37 UHID_GET_REPORT_REPLY,
38 UHID_FEATURE_ANSWER, /* obsolete! use UHID_GET_REPORT_REPLY */
39 UHID_GET_REPORT_REPLY = UHID_FEATURE_ANSWER,
40 UHID_CREATE2, 38 UHID_CREATE2,
41 UHID_INPUT2, 39 UHID_INPUT2,
42}; 40};
43 41
44struct uhid_create_req {
45 __u8 name[128];
46 __u8 phys[64];
47 __u8 uniq[64];
48 __u8 __user *rd_data;
49 __u16 rd_size;
50
51 __u16 bus;
52 __u32 vendor;
53 __u32 product;
54 __u32 version;
55 __u32 country;
56} __attribute__((__packed__));
57
58struct uhid_create2_req { 42struct uhid_create2_req {
59 __u8 name[128]; 43 __u8 name[128];
60 __u8 phys[64]; 44 __u8 phys[64];
@@ -76,24 +60,67 @@ enum uhid_report_type {
76 UHID_INPUT_REPORT, 60 UHID_INPUT_REPORT,
77}; 61};
78 62
79struct uhid_input_req { 63struct uhid_input2_req {
64 __u16 size;
65 __u8 data[UHID_DATA_MAX];
66} __attribute__((__packed__));
67
68struct uhid_output_req {
80 __u8 data[UHID_DATA_MAX]; 69 __u8 data[UHID_DATA_MAX];
81 __u16 size; 70 __u16 size;
71 __u8 rtype;
82} __attribute__((__packed__)); 72} __attribute__((__packed__));
83 73
84struct uhid_input2_req { 74struct uhid_get_report_req {
75 __u32 id;
76 __u8 rnum;
77 __u8 rtype;
78} __attribute__((__packed__));
79
80struct uhid_get_report_reply_req {
81 __u32 id;
82 __u16 err;
85 __u16 size; 83 __u16 size;
86 __u8 data[UHID_DATA_MAX]; 84 __u8 data[UHID_DATA_MAX];
87} __attribute__((__packed__)); 85} __attribute__((__packed__));
88 86
89struct uhid_output_req { 87/*
88 * Compat Layer
89 * All these commands and requests are obsolete. You should avoid using them in
90 * new code. We support them for backwards-compatibility, but you might not get
91 * access to new feature in case you use them.
92 */
93
94enum uhid_legacy_event_type {
95 UHID_CREATE = __UHID_LEGACY_CREATE,
96 UHID_OUTPUT_EV = __UHID_LEGACY_OUTPUT_EV,
97 UHID_INPUT = __UHID_LEGACY_INPUT,
98 UHID_FEATURE = UHID_GET_REPORT,
99 UHID_FEATURE_ANSWER = UHID_GET_REPORT_REPLY,
100};
101
102/* Obsolete! Use UHID_CREATE2. */
103struct uhid_create_req {
104 __u8 name[128];
105 __u8 phys[64];
106 __u8 uniq[64];
107 __u8 __user *rd_data;
108 __u16 rd_size;
109
110 __u16 bus;
111 __u32 vendor;
112 __u32 product;
113 __u32 version;
114 __u32 country;
115} __attribute__((__packed__));
116
117/* Obsolete! Use UHID_INPUT2. */
118struct uhid_input_req {
90 __u8 data[UHID_DATA_MAX]; 119 __u8 data[UHID_DATA_MAX];
91 __u16 size; 120 __u16 size;
92 __u8 rtype;
93} __attribute__((__packed__)); 121} __attribute__((__packed__));
94 122
95/* Obsolete! Newer kernels will no longer send these events but instead convert 123/* Obsolete! Kernel uses UHID_OUTPUT exclusively now. */
96 * it into raw output reports via UHID_OUTPUT. */
97struct uhid_output_ev_req { 124struct uhid_output_ev_req {
98 __u16 type; 125 __u16 type;
99 __u16 code; 126 __u16 code;
@@ -107,12 +134,6 @@ struct uhid_feature_req {
107 __u8 rtype; 134 __u8 rtype;
108} __attribute__((__packed__)); 135} __attribute__((__packed__));
109 136
110struct uhid_get_report_req {
111 __u32 id;
112 __u8 rnum;
113 __u8 rtype;
114} __attribute__((__packed__));
115
116/* Obsolete! Use ABI compatible UHID_GET_REPORT_REPLY. */ 137/* Obsolete! Use ABI compatible UHID_GET_REPORT_REPLY. */
117struct uhid_feature_answer_req { 138struct uhid_feature_answer_req {
118 __u32 id; 139 __u32 id;
@@ -121,12 +142,14 @@ struct uhid_feature_answer_req {
121 __u8 data[UHID_DATA_MAX]; 142 __u8 data[UHID_DATA_MAX];
122} __attribute__((__packed__)); 143} __attribute__((__packed__));
123 144
124struct uhid_get_report_reply_req { 145/*
125 __u32 id; 146 * UHID Events
126 __u16 err; 147 * All UHID events from and to the kernel are encoded as "struct uhid_event".
127 __u16 size; 148 * The "type" field contains a UHID_* type identifier. All payload depends on
128 __u8 data[UHID_DATA_MAX]; 149 * that type and can be accessed via ev->u.XYZ accordingly.
129} __attribute__((__packed__)); 150 * If user-space writes short events, they're extended with 0s by the kernel. If
151 * the kernel writes short events, user-space shall extend them with 0s.
152 */
130 153
131struct uhid_event { 154struct uhid_event {
132 __u32 type; 155 __u32 type;