0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 #ifndef _UAPI_HIDDEV_H
0027 #define _UAPI_HIDDEV_H
0028
0029
0030
0031 #include <linux/types.h>
0032
0033
0034
0035
0036
0037 struct hiddev_event {
0038 unsigned hid;
0039 signed int value;
0040 };
0041
0042 struct hiddev_devinfo {
0043 __u32 bustype;
0044 __u32 busnum;
0045 __u32 devnum;
0046 __u32 ifnum;
0047 __s16 vendor;
0048 __s16 product;
0049 __s16 version;
0050 __u32 num_applications;
0051 };
0052
0053 struct hiddev_collection_info {
0054 __u32 index;
0055 __u32 type;
0056 __u32 usage;
0057 __u32 level;
0058 };
0059
0060 #define HID_STRING_SIZE 256
0061 struct hiddev_string_descriptor {
0062 __s32 index;
0063 char value[HID_STRING_SIZE];
0064 };
0065
0066 struct hiddev_report_info {
0067 __u32 report_type;
0068 __u32 report_id;
0069 __u32 num_fields;
0070 };
0071
0072
0073
0074
0075
0076
0077
0078
0079 #define HID_REPORT_ID_UNKNOWN 0xffffffff
0080 #define HID_REPORT_ID_FIRST 0x00000100
0081 #define HID_REPORT_ID_NEXT 0x00000200
0082 #define HID_REPORT_ID_MASK 0x000000ff
0083 #define HID_REPORT_ID_MAX 0x000000ff
0084
0085 #define HID_REPORT_TYPE_INPUT 1
0086 #define HID_REPORT_TYPE_OUTPUT 2
0087 #define HID_REPORT_TYPE_FEATURE 3
0088 #define HID_REPORT_TYPE_MIN 1
0089 #define HID_REPORT_TYPE_MAX 3
0090
0091 struct hiddev_field_info {
0092 __u32 report_type;
0093 __u32 report_id;
0094 __u32 field_index;
0095 __u32 maxusage;
0096 __u32 flags;
0097 __u32 physical;
0098 __u32 logical;
0099 __u32 application;
0100 __s32 logical_minimum;
0101 __s32 logical_maximum;
0102 __s32 physical_minimum;
0103 __s32 physical_maximum;
0104 __u32 unit_exponent;
0105 __u32 unit;
0106 };
0107
0108
0109
0110
0111 #define HID_FIELD_CONSTANT 0x001
0112 #define HID_FIELD_VARIABLE 0x002
0113 #define HID_FIELD_RELATIVE 0x004
0114 #define HID_FIELD_WRAP 0x008
0115 #define HID_FIELD_NONLINEAR 0x010
0116 #define HID_FIELD_NO_PREFERRED 0x020
0117 #define HID_FIELD_NULL_STATE 0x040
0118 #define HID_FIELD_VOLATILE 0x080
0119 #define HID_FIELD_BUFFERED_BYTE 0x100
0120
0121 struct hiddev_usage_ref {
0122 __u32 report_type;
0123 __u32 report_id;
0124 __u32 field_index;
0125 __u32 usage_index;
0126 __u32 usage_code;
0127 __s32 value;
0128 };
0129
0130
0131
0132 #define HID_MAX_MULTI_USAGES 1024
0133 struct hiddev_usage_ref_multi {
0134 struct hiddev_usage_ref uref;
0135 __u32 num_values;
0136 __s32 values[HID_MAX_MULTI_USAGES];
0137 };
0138
0139
0140
0141
0142
0143 #define HID_FIELD_INDEX_NONE 0xffffffff
0144
0145
0146
0147
0148
0149 #define HID_VERSION 0x010004
0150
0151
0152
0153
0154
0155 #define HIDIOCGVERSION _IOR('H', 0x01, int)
0156 #define HIDIOCAPPLICATION _IO('H', 0x02)
0157 #define HIDIOCGDEVINFO _IOR('H', 0x03, struct hiddev_devinfo)
0158 #define HIDIOCGSTRING _IOR('H', 0x04, struct hiddev_string_descriptor)
0159 #define HIDIOCINITREPORT _IO('H', 0x05)
0160 #define HIDIOCGNAME(len) _IOC(_IOC_READ, 'H', 0x06, len)
0161 #define HIDIOCGREPORT _IOW('H', 0x07, struct hiddev_report_info)
0162 #define HIDIOCSREPORT _IOW('H', 0x08, struct hiddev_report_info)
0163 #define HIDIOCGREPORTINFO _IOWR('H', 0x09, struct hiddev_report_info)
0164 #define HIDIOCGFIELDINFO _IOWR('H', 0x0A, struct hiddev_field_info)
0165 #define HIDIOCGUSAGE _IOWR('H', 0x0B, struct hiddev_usage_ref)
0166 #define HIDIOCSUSAGE _IOW('H', 0x0C, struct hiddev_usage_ref)
0167 #define HIDIOCGUCODE _IOWR('H', 0x0D, struct hiddev_usage_ref)
0168 #define HIDIOCGFLAG _IOR('H', 0x0E, int)
0169 #define HIDIOCSFLAG _IOW('H', 0x0F, int)
0170 #define HIDIOCGCOLLECTIONINDEX _IOW('H', 0x10, struct hiddev_usage_ref)
0171 #define HIDIOCGCOLLECTIONINFO _IOWR('H', 0x11, struct hiddev_collection_info)
0172 #define HIDIOCGPHYS(len) _IOC(_IOC_READ, 'H', 0x12, len)
0173
0174
0175 #define HIDIOCGUSAGES _IOWR('H', 0x13, struct hiddev_usage_ref_multi)
0176 #define HIDIOCSUSAGES _IOW('H', 0x14, struct hiddev_usage_ref_multi)
0177
0178
0179
0180
0181 #define HIDDEV_FLAG_UREF 0x1
0182 #define HIDDEV_FLAG_REPORT 0x2
0183 #define HIDDEV_FLAGS 0x3
0184
0185
0186
0187
0188
0189
0190
0191
0192
0193
0194
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204
0205
0206
0207
0208
0209
0210
0211
0212
0213 #endif