00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00035 #ifndef LIBUSB_HID_REPORT_ITEMS_H_
00036 #define LIBUSB_HID_REPORT_ITEMS_H_
00037
00038 #include <stdint.h>
00039
00040
00041
00042
00043
00044
00046 #define USB_HID_ITEM_SIZE(data) ((uint8_t)(data & 0x3))
00047
00049 #define USB_HID_ITEM_TAG(data) ((uint8_t)((data & 0xF0) >> 4))
00050
00052 #define USB_HID_ITEM_TAG_CLASS(data) ((uint8_t)((data & 0xC) >> 2))
00053
00056 #define USB_HID_ITEM_IS_LONG(data) (data == 0xFE)
00057
00058
00059
00060
00061
00062
00064 #define USB_HID_IS_EXTENDED_USAGE(usage) ((usage & 0xFFFF0000) != 0)
00065
00067 #define USB_HID_EXTENDED_USAGE_PAGE(usage) ((usage & 0xFFFF0000) >> 16)
00068
00070 #define USB_HID_EXTENDED_USAGE(usage) (usage & 0xFFFF)
00071
00072
00073
00074
00075
00082 #define USB_HID_ITEM_FLAG_CONSTANT(flags) ((flags & 0x1) == 0x1)
00083
00088 #define USB_HID_ITEM_FLAG_VARIABLE(flags) ((flags & 0x2) == 0x2)
00089
00096 #define USB_HID_ITEM_FLAG_RELATIVE(flags) ((flags & 0x4) == 0x4)
00097
00104 #define USB_HID_ITEM_FLAG_WRAP(flags) ((flags & 0x8) == 0x8)
00105
00111 #define USB_HID_ITEM_FLAG_LINEAR(flags) ((flags & 0x10) == 0x10)
00112
00118 #define USB_HID_ITEM_FLAG_PREFERRED(flags) ((flags & 0x20) == 0x20)
00119
00126 #define USB_HID_ITEM_FLAG_POSITION(flags) ((flags & 0x40) == 0x40)
00127
00134 #define USB_HID_ITEM_FLAG_VOLATILE(flags) ((flags & 0x80) == 0x80)
00135
00142 #define USB_HID_ITEM_FLAG_BUFFERED(flags) ((flags & 0x100) == 0x100)
00143
00144
00145
00146
00147
00152 #define USB_HID_TAG_CLASS_MAIN 0x0
00153
00160 #define USB_HID_REPORT_TAG_INPUT 0x8
00161
00167 #define USB_HID_REPORT_TAG_OUTPUT 0x9
00168
00173 #define USB_HID_REPORT_TAG_FEATURE 0xB
00174
00179 #define USB_HID_REPORT_TAG_COLLECTION 0xA
00180
00185 #define USB_HID_REPORT_TAG_END_COLLECTION 0xC
00186
00187
00188
00189
00190
00194 #define USB_HID_TAG_CLASS_GLOBAL 0x1
00195
00203 #define USB_HID_REPORT_TAG_USAGE_PAGE 0x0
00204
00211 #define USB_HID_REPORT_TAG_LOGICAL_MINIMUM 0x1
00212
00217 #define USB_HID_REPORT_TAG_LOGICAL_MAXIMUM 0x2
00218
00223 #define USB_HID_REPORT_TAG_PHYSICAL_MINIMUM 0x3
00224
00228 #define USB_HID_REPORT_TAG_PHYSICAL_MAXIMUM 0x4
00229
00234 #define USB_HID_REPORT_TAG_UNIT_EXPONENT 0x5
00235
00239 #define USB_HID_REPORT_TAG_UNIT 0x6
00240
00245 #define USB_HID_REPORT_TAG_REPORT_SIZE 0x7
00246
00255 #define USB_HID_REPORT_TAG_REPORT_ID 0x8
00256
00262 #define USB_HID_REPORT_TAG_REPORT_COUNT 0x9
00263
00267 #define USB_HID_REPORT_TAG_PUSH 0xA
00268
00272 #define USB_HID_REPORT_TAG_POP 0xB
00273
00274
00275
00276
00277
00285 #define USB_HID_TAG_CLASS_LOCAL 0x2
00286
00292 #define USB_HID_REPORT_TAG_USAGE 0x0
00293
00297 #define USB_HID_REPORT_TAG_USAGE_MINIMUM 0x1
00298
00302 #define USB_HID_REPORT_TAG_USAGE_MAXIMUM 0x2
00303
00308 #define USB_HID_REPORT_TAG_DESIGNATOR_INDEX 0x3
00309
00314 #define USB_HID_REPORT_TAG_DESIGNATOR_MINIMUM 0x4
00315
00320 #define USB_HID_REPORT_TAG_DESIGNATOR_MAXIMUM 0x5
00321
00326 #define USB_HID_REPORT_TAG_STRING_INDEX 0x7
00327
00332 #define USB_HID_REPORT_TAG_STRING_MINIMUM 0x8
00333
00338 #define USB_HID_REPORT_TAG_STRING_MAXIMUM 0x9
00339
00347 #define USB_HID_REPORT_TAG_DELIMITER 0xA
00348
00349
00350
00351 #endif
00352