1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26#ifndef _UAPI_HIDDEV_H
27#define _UAPI_HIDDEV_H
28
29
30
31#include <linux/types.h>
32
33
34
35
36
37struct hiddev_event {
38 unsigned hid;
39 signed int value;
40};
41
42struct hiddev_devinfo {
43 __u32 bustype;
44 __u32 busnum;
45 __u32 devnum;
46 __u32 ifnum;
47 __s16 vendor;
48 __s16 product;
49 __s16 version;
50 __u32 num_applications;
51};
52
53struct hiddev_collection_info {
54 __u32 index;
55 __u32 type;
56 __u32 usage;
57 __u32 level;
58};
59
60#define HID_STRING_SIZE 256
61struct hiddev_string_descriptor {
62 __s32 index;
63 char value[HID_STRING_SIZE];
64};
65
66struct hiddev_report_info {
67 __u32 report_type;
68 __u32 report_id;
69 __u32 num_fields;
70};
71
72
73
74
75
76
77
78
79#define HID_REPORT_ID_UNKNOWN 0xffffffff
80#define HID_REPORT_ID_FIRST 0x00000100
81#define HID_REPORT_ID_NEXT 0x00000200
82#define HID_REPORT_ID_MASK 0x000000ff
83#define HID_REPORT_ID_MAX 0x000000ff
84
85#define HID_REPORT_TYPE_INPUT 1
86#define HID_REPORT_TYPE_OUTPUT 2
87#define HID_REPORT_TYPE_FEATURE 3
88#define HID_REPORT_TYPE_MIN 1
89#define HID_REPORT_TYPE_MAX 3
90
91struct hiddev_field_info {
92 __u32 report_type;
93 __u32 report_id;
94 __u32 field_index;
95 __u32 maxusage;
96 __u32 flags;
97 __u32 physical;
98 __u32 logical;
99 __u32 application;
100 __s32 logical_minimum;
101 __s32 logical_maximum;
102 __s32 physical_minimum;
103 __s32 physical_maximum;
104 __u32 unit_exponent;
105 __u32 unit;
106};
107
108
109
110
111#define HID_FIELD_CONSTANT 0x001
112#define HID_FIELD_VARIABLE 0x002
113#define HID_FIELD_RELATIVE 0x004
114#define HID_FIELD_WRAP 0x008
115#define HID_FIELD_NONLINEAR 0x010
116#define HID_FIELD_NO_PREFERRED 0x020
117#define HID_FIELD_NULL_STATE 0x040
118#define HID_FIELD_VOLATILE 0x080
119#define HID_FIELD_BUFFERED_BYTE 0x100
120
121struct hiddev_usage_ref {
122 __u32 report_type;
123 __u32 report_id;
124 __u32 field_index;
125 __u32 usage_index;
126 __u32 usage_code;
127 __s32 value;
128};
129
130
131
132#define HID_MAX_MULTI_USAGES 1024
133struct hiddev_usage_ref_multi {
134 struct hiddev_usage_ref uref;
135 __u32 num_values;
136 __s32 values[HID_MAX_MULTI_USAGES];
137};
138
139
140
141
142
143#define HID_FIELD_INDEX_NONE 0xffffffff
144
145
146
147
148
149#define HID_VERSION 0x010004
150
151
152
153
154
155#define HIDIOCGVERSION _IOR('H', 0x01, int)
156#define HIDIOCAPPLICATION _IO('H', 0x02)
157#define HIDIOCGDEVINFO _IOR('H', 0x03, struct hiddev_devinfo)
158#define HIDIOCGSTRING _IOR('H', 0x04, struct hiddev_string_descriptor)
159#define HIDIOCINITREPORT _IO('H', 0x05)
160#define HIDIOCGNAME(len) _IOC(_IOC_READ, 'H', 0x06, len)
161#define HIDIOCGREPORT _IOW('H', 0x07, struct hiddev_report_info)
162#define HIDIOCSREPORT _IOW('H', 0x08, struct hiddev_report_info)
163#define HIDIOCGREPORTINFO _IOWR('H', 0x09, struct hiddev_report_info)
164#define HIDIOCGFIELDINFO _IOWR('H', 0x0A, struct hiddev_field_info)
165#define HIDIOCGUSAGE _IOWR('H', 0x0B, struct hiddev_usage_ref)
166#define HIDIOCSUSAGE _IOW('H', 0x0C, struct hiddev_usage_ref)
167#define HIDIOCGUCODE _IOWR('H', 0x0D, struct hiddev_usage_ref)
168#define HIDIOCGFLAG _IOR('H', 0x0E, int)
169#define HIDIOCSFLAG _IOW('H', 0x0F, int)
170#define HIDIOCGCOLLECTIONINDEX _IOW('H', 0x10, struct hiddev_usage_ref)
171#define HIDIOCGCOLLECTIONINFO _IOWR('H', 0x11, struct hiddev_collection_info)
172#define HIDIOCGPHYS(len) _IOC(_IOC_READ, 'H', 0x12, len)
173
174
175#define HIDIOCGUSAGES _IOWR('H', 0x13, struct hiddev_usage_ref_multi)
176#define HIDIOCSUSAGES _IOW('H', 0x14, struct hiddev_usage_ref_multi)
177
178
179
180
181#define HIDDEV_FLAG_UREF 0x1
182#define HIDDEV_FLAG_REPORT 0x2
183#define HIDDEV_FLAGS 0x3
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213#endif
214