hiddev.h
001: #ifndef _HIDDEV_H
002: #define _HIDDEV_H
003:
004:
005:
006:
007:
008:
009:
010:
011:
012:
013:
014:
015:
016:
017:
018:
019:
020:
021:
022:
023:
024:
025:
026: <vojtech@suse.cz>
027:
028:
029:
030: #include <linux/types.h>
031:
032:
033:
034:
035:
036: struct hiddev_event {
037: unsigned hid;
038: signed int value;
039: };
040:
041: struct hiddev_devinfo {
042: __u32 bustype;
043: __u32 busnum;
044: __u32 devnum;
045: __u32 ifnum;
046: __s16 vendor;
047: __s16 product;
048: __s16 version;
049: __u32 num_applications;
050: };
051:
052: struct hiddev_collection_info {
053: __u32 index;
054: __u32 type;
055: __u32 usage;
056: __u32 level;
057: };
058:
059: #define HID_STRING_SIZE 256
060: struct hiddev_string_descriptor {
061: __s32 index;
062: char value[HID_STRING_SIZE];
063: };
064:
065: struct hiddev_report_info {
066: __u32 report_type;
067: __u32 report_id;
068: __u32 num_fields;
069: };
070:
071:
072:
073:
074:
075:
076:
077:
078: #define HID_REPORT_ID_UNKNOWN 0xffffffff
079: #define HID_REPORT_ID_FIRST 0x00000100
080: #define HID_REPORT_ID_NEXT 0x00000200
081: #define HID_REPORT_ID_MASK 0x000000ff
082: #define HID_REPORT_ID_MAX 0x000000ff
083:
084: #define HID_REPORT_TYPE_INPUT 1
085: #define HID_REPORT_TYPE_OUTPUT 2
086: #define HID_REPORT_TYPE_FEATURE 3
087: #define HID_REPORT_TYPE_MIN 1
088: #define HID_REPORT_TYPE_MAX 3
089:
090: struct hiddev_field_info {
091: __u32 report_type;
092: __u32 report_id;
093: __u32 field_index;
094: __u32 maxusage;
095: __u32 flags;
096: __u32 physical;
097: __u32 logical;
098: __u32 application;
099: __s32 logical_minimum;
100: __s32 logical_maximum;
101: __s32 physical_minimum;
102: __s32 physical_maximum;
103: __u32 unit_exponent;
104: __u32 unit;
105: };
106:
107:
108:
109:
110: #define HID_FIELD_CONSTANT 0x001
111: #define HID_FIELD_VARIABLE 0x002
112: #define HID_FIELD_RELATIVE 0x004
113: #define HID_FIELD_WRAP 0x008
114: #define HID_FIELD_NONLINEAR 0x010
115: #define HID_FIELD_NO_PREFERRED 0x020
116: #define HID_FIELD_NULL_STATE 0x040
117: #define HID_FIELD_VOLATILE 0x080
118: #define HID_FIELD_BUFFERED_BYTE 0x100
119:
120: struct hiddev_usage_ref {
121: __u32 report_type;
122: __u32 report_id;
123: __u32 field_index;
124: __u32 usage_index;
125: __u32 usage_code;
126: __s32 value;
127: };
128:
129:
130:
131: #define HID_MAX_MULTI_USAGES 1024
132: struct hiddev_usage_ref_multi {
133: struct hiddev_usage_ref uref;
134: __u32 num_values;
135: __s32 values[HID_MAX_MULTI_USAGES];
136: };
137:
138:
139:
140:
141:
142: #define HID_FIELD_INDEX_NONE 0xffffffff
143:
144:
145:
146:
147:
148: #define HID_VERSION 0x010004
149:
150:
151:
152:
153:
154: #define HIDIOCGVERSION _IOR('H', 0x01, int)
155: #define HIDIOCAPPLICATION _IO('H', 0x02)
156: #define HIDIOCGDEVINFO _IOR('H', 0x03, struct hiddev_devinfo)
157: #define HIDIOCGSTRING _IOR('H', 0x04, struct hiddev_string_descriptor)
158: #define HIDIOCINITREPORT _IO('H', 0x05)
159: #define HIDIOCGNAME(len) _IOC(_IOC_READ, 'H', 0x06, len)
160: #define HIDIOCGREPORT _IOW('H', 0x07, struct hiddev_report_info)
161: #define HIDIOCSREPORT _IOW('H', 0x08, struct hiddev_report_info)
162: #define HIDIOCGREPORTINFO _IOWR('H', 0x09, struct hiddev_report_info)
163: #define HIDIOCGFIELDINFO _IOWR('H', 0x0A, struct hiddev_field_info)
164: #define HIDIOCGUSAGE _IOWR('H', 0x0B, struct hiddev_usage_ref)
165: #define HIDIOCSUSAGE _IOW('H', 0x0C, struct hiddev_usage_ref)
166: #define HIDIOCGUCODE _IOWR('H', 0x0D, struct hiddev_usage_ref)
167: #define HIDIOCGFLAG _IOR('H', 0x0E, int)
168: #define HIDIOCSFLAG _IOW('H', 0x0F, int)
169: #define HIDIOCGCOLLECTIONINDEX _IOW('H', 0x10, struct hiddev_usage_ref)
170: #define HIDIOCGCOLLECTIONINFO _IOWR('H', 0x11, struct hiddev_collection_info)
171: #define HIDIOCGPHYS(len) _IOC(_IOC_READ, 'H', 0x12, len)
172:
173:
174: #define HIDIOCGUSAGES _IOWR('H', 0x13, struct hiddev_usage_ref_multi)
175: #define HIDIOCSUSAGES _IOW('H', 0x14, struct hiddev_usage_ref_multi)
176:
177:
178:
179:
180: #define HIDDEV_FLAG_UREF 0x1
181: #define HIDDEV_FLAG_REPORT 0x2
182: #define HIDDEV_FLAGS 0x3
183:
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: #endif
213:
© Andrew Scott 2006 -
2025,
All Rights Reserved