Ultibo API
C/C++ API for Ultibo Core
Loading...
Searching...
No Matches
hid.h
Go to the documentation of this file.
1/*
2 * This file is part of the Ultibo project, https://ultibo.org/
3 *
4 * The MIT License (MIT)
5 *
6 * Copyright (c) 2026 Garry Wood <garry@softoz.com.au>
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files (the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 * THE SOFTWARE.
25 */
26#ifndef _ULTIBO_HID_H
27#define _ULTIBO_HID_H
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#include "ultibo/globaltypes.h"
34#include "ultibo/globalconst.h"
35#include "ultibo/devices.h"
36
38#define HID_NAME_PREFIX "HID"
39
41#define HID_TYPE_NONE 0
42#define HID_TYPE_USB 1
43
44#define HID_TYPE_MAX 1
45
47#define HID_STATE_DETACHED 0
48#define HID_STATE_DETACHING 1
49#define HID_STATE_ATTACHING 2
50#define HID_STATE_ATTACHED 3
51
52#define HID_STATE_MAX 3
53
55#define HID_FLAG_NONE 0x00000000
56
58#define HID_SUBCLASS_NONE 0
59#define HID_SUBCLASS_BOOT 1
60
62#define HID_BOOT_PROTOCOL_NONE 0
63#define HID_BOOT_PROTOCOL_KEYBOARD 1
64#define HID_BOOT_PROTOCOL_MOUSE 2
65
67#define HID_DESCRIPTOR_TYPE_HID 0x21
68#define HID_DESCRIPTOR_TYPE_REPORT 0x22
69#define HID_DESCRIPTOR_TYPE_PHYSICAL_DESCRIPTOR 0x23
70
72#define HID_REQUEST_GET_REPORT 0x01
73#define HID_REQUEST_GET_IDLE 0x02
74#define HID_REQUEST_GET_PROTOCOL 0x03
75#define HID_REQUEST_SET_REPORT 0x09
76#define HID_REQUEST_SET_IDLE 0x0A
77#define HID_REQUEST_SET_PROTOCOL 0x0B
78
80#define HID_PROTOCOL_BOOT 0
81#define HID_PROTOCOL_REPORT 1
82
84#define HID_REPORT_INPUT 1
85#define HID_REPORT_OUTPUT 2
86#define HID_REPORT_FEATURE 3
87
89#define HID_REPORTID_NONE 0
90
92#define HID_SIZE_0 (0 << 0)
93#define HID_SIZE_1 (1 << 0)
94#define HID_SIZE_2 (2 << 0)
95#define HID_SIZE_4 (3 << 0)
96#define HID_SIZE_MASK 0x03
97
99#define HID_TYPE_MAIN (0 << 2)
100#define HID_TYPE_GLOBAL (1 << 2)
101#define HID_TYPE_LOCAL (2 << 2)
102#define HID_TYPE_RESERVED (3 << 2)
103#define HID_TYPE_MASK 0x0C
104
107#define HID_TAG_MAIN_INPUT 0x80
108#define HID_TAG_MAIN_OUTPUT 0x90
109#define HID_TAG_MAIN_FEATURE 0xB0
110#define HID_TAG_MAIN_COLLECTION 0xA0
111#define HID_TAG_MAIN_END_COLLECTION 0xC0
112
114#define HID_TAG_GLOBAL_USAGE_PAGE 0x04
115#define HID_TAG_GLOBAL_LOGICAL_MINIMUM 0x14
116#define HID_TAG_GLOBAL_LOGICAL_MAXIMUM 0x24
117#define HID_TAG_GLOBAL_PHYSICAL_MINIMUM 0x34
118#define HID_TAG_GLOBAL_PHYSICAL_MAXIMUM 0x44
119#define HID_TAG_GLOBAL_UNIT_EXPONENT 0x54
120#define HID_TAG_GLOBAL_UNIT 0x64
121#define HID_TAG_GLOBAL_REPORT_SIZE 0x74
122#define HID_TAG_GLOBAL_REPORT_ID 0x84
123#define HID_TAG_GLOBAL_REPORT_COUNT 0x94
124#define HID_TAG_GLOBAL_PUSH 0xA4
125#define HID_TAG_GLOBAL_POP 0xB4
126
128#define HID_TAG_LOCAL_USAGE 0x08
129#define HID_TAG_LOCAL_USAGE_MINIMUM 0x18
130#define HID_TAG_LOCAL_USAGE_MAXIMUM 0x28
131#define HID_TAG_LOCAL_DESIGNATOR_INDEX 0x38
132#define HID_TAG_LOCAL_DESIGNATOR_MINIMUM 0x48
133#define HID_TAG_LOCAL_DESIGNATOR_MAXIMUM 0x58
134#define HID_TAG_LOCAL_STRING_INDEX 0x78
135#define HID_TAG_LOCAL_STRING_MINIMUM 0x88
136#define HID_TAG_LOCAL_STRING_MAXIMUM 0x98
137#define HID_TAG_LOCAL_DELIMITER 0xA8
138
139#define HID_TAG_LONG 0xFC
140#define HID_TAG_MASK 0xFC
141
143#define HID_MAIN_ITEM_CONSTANT (1 << 0)
144#define HID_MAIN_ITEM_VARIABLE (1 << 1)
145#define HID_MAIN_ITEM_RELATIVE (1 << 2)
146#define HID_MAIN_ITEM_WRAP (1 << 3)
147#define HID_MAIN_ITEM_NON_LINEAR (1 << 4)
148#define HID_MAIN_ITEM_NO_PREFERRED (1 << 5)
149#define HID_MAIN_ITEM_NULL_STATE (1 << 6)
150#define HID_MAIN_ITEM_RESERVED1 (1 << 7)
151#define HID_MAIN_ITEM_BUFFERED_BYTES (1 << 8)
152#define HID_MAIN_ITEM_RESERVED2 (0xFFFFFE00 << 9)
153
155#define HID_MAIN_COLLECTION_PHYSICAL 0x00
156#define HID_MAIN_COLLECTION_APPLICATION 0x01
157#define HID_MAIN_COLLECTION_LOGICAL 0x02
158#define HID_MAIN_COLLECTION_REPORT 0x03
159#define HID_MAIN_COLLECTION_NAMED_ARRAY 0x04
160#define HID_MAIN_COLLECTION_USAGE_SWITCH 0x05
161#define HID_MAIN_COLLECTION_USAGE_MODIFIER 0x06
164
167#define HID_GLOBAL_UNIT_SYSTEM_MASK 0xF
168#define HID_GLOBAL_UNIT_SYSTEM_SHIFT 0
169
170#define HID_GLOBAL_UNIT_SYSTEM_NONE 0
171#define HID_GLOBAL_UNIT_SYSTEM_SI_LINEAR 1
172#define HID_GLOBAL_UNIT_SYSTEM_SI_ROTATION 2
173#define HID_GLOBAL_UNIT_SYSTEM_ENGLISH_LINEAR 3
174#define HID_GLOBAL_UNIT_SYSTEM_ENGLISH_ROTATION 4
175
176#define HID_GLOBAL_UNIT_LENGTH_MASK 0xF
177#define HID_GLOBAL_UNIT_LENGTH_SHIFT 4
178
179#define HID_GLOBAL_UNIT_ROTATION_MASK 0xF
180#define HID_GLOBAL_UNIT_ROTATION_SHIFT 4
181
182#define HID_GLOBAL_UNIT_MASS_MASK 0xF
183#define HID_GLOBAL_UNIT_MASS_SHIFT 8
184
185#define HID_GLOBAL_UNIT_TIME_MASK 0xF
186#define HID_GLOBAL_UNIT_TIME_SHIFT 12
187
188#define HID_GLOBAL_UNIT_TEMPERATURE_MASK 0xF
189#define HID_GLOBAL_UNIT_TEMPERATURE_SHIFT 16
190
191#define HID_GLOBAL_UNIT_CURRENT_MASK 0xF
192#define HID_GLOBAL_UNIT_CURRENT_SHIFT 20
193
194#define HID_GLOBAL_UNIT_LIGHT_MASK 0xF
195#define HID_GLOBAL_UNIT_LIGHT_SHIFT 24
196
200#define HID_GLOBAL_UNIT_SI_ROTATION 0x00000012
201#define HID_GLOBAL_UNIT_SI_LENGTH 0x00000011
202#define HID_GLOBAL_UNIT_SI_MASS 0x00000101
203#define HID_GLOBAL_UNIT_SI_TIME 0x00001001
204#define HID_GLOBAL_UNIT_SI_TEMPERATURE 0x00010001
205#define HID_GLOBAL_UNIT_SI_CURRENT 0x00100001
206#define HID_GLOBAL_UNIT_SI_LIGHT 0x01000001
207
209#define HID_GLOBAL_UNIT_SI_AREA 0x00000021
210#define HID_GLOBAL_UNIT_SI_VOLUME 0x00000031
211#define HID_GLOBAL_UNIT_SI_VELOCITY 0x0000F011
212#define HID_GLOBAL_UNIT_SI_ACCELERATION 0x0000E011
213
214#define HID_GLOBAL_UNIT_SI_FREQUENCY 0x0000F001
215#define HID_GLOBAL_UNIT_SI_FORCE 0x0000E111
216#define HID_GLOBAL_UNIT_SI_PRESSURE 0x0000E1F1
217#define HID_GLOBAL_UNIT_SI_ENERGY 0x0000E121
218#define HID_GLOBAL_UNIT_SI_POWER 0x0000D121
219
221#define HID_GLOBAL_UNIT_ENGLISH_ROTATION 0x00000014
222#define HID_GLOBAL_UNIT_ENGLISH_LENGTH 0x00000013
223#define HID_GLOBAL_UNIT_ENGLISH_TIME 0x00001003
224#define HID_GLOBAL_UNIT_ENGLISH_TEMPERATURE 0x00010003
225#define HID_GLOBAL_UNIT_ENGLISH_CURRENT 0x00100003
226#define HID_GLOBAL_UNIT_ENGLISH_LIGHT 0x01000003
227
228#define HID_GLOBAL_UNIT_ENGLISH_AREA 0x00000023
229#define HID_GLOBAL_UNIT_ENGLISH_VOLUME 0x00000033
230
232static const unsigned int HID_GLOBAL_UNIT_EXPONENTS[0x10] = {
233 0,
234 1,
235 2,
236 3,
237 4,
238 5,
239 6,
240 7,
241 -8,
242 -7,
243 -6,
244 -5,
245 -4,
246 -3,
247 -2,
248 -1};
249
250static const double_t HID_GLOBAL_UNIT_MULTIPLIERS[0x10] = {
251 1,
252 10,
253 100,
254 1000,
255 10000,
256 100000,
257 1000000,
258 10000000,
259 0.00000001,
260 0.0000001,
261 0.000001,
262 0.00001,
263 0.0001,
264 0.001,
265 0.01,
266 0.1};
267
269#define HID_LOCAL_DELIMITER_CLOSE 0
270#define HID_LOCAL_DELIMITER_OPEN 1
271
273#define HID_PHYSICAL_BIAS_NONE (0 << 5)
274#define HID_PHYSICAL_BIAS_RIGHT_HAND (1 << 5)
275#define HID_PHYSICAL_BIAS_LEFT_HAND (2 << 5)
276#define HID_PHYSICAL_BIAS_BOTH_HANDS (3 << 5)
277#define HID_PHYSICAL_BIAS_EITHER_HAND (4 << 5)
278
280#define HID_PHYSICAL_DESIGNATOR_NONE 0x00
281#define HID_PHYSICAL_DESIGNATOR_HAND 0x01
282#define HID_PHYSICAL_DESIGNATOR_EYEBALL 0x02
283#define HID_PHYSICAL_DESIGNATOR_EYEBROW 0x03
284#define HID_PHYSICAL_DESIGNATOR_EYELID 0x04
285#define HID_PHYSICAL_DESIGNATOR_EAR 0x05
286#define HID_PHYSICAL_DESIGNATOR_NOSE 0x06
287#define HID_PHYSICAL_DESIGNATOR_MOUTH 0x07
288#define HID_PHYSICAL_DESIGNATOR_UPPER_LIP 0x08
289#define HID_PHYSICAL_DESIGNATOR_LOWER_LIP 0x09
290#define HID_PHYSICAL_DESIGNATOR_JAW 0x0A
291#define HID_PHYSICAL_DESIGNATOR_NECK 0x0B
292#define HID_PHYSICAL_DESIGNATOR_UPPER_ARM 0x0C
293#define HID_PHYSICAL_DESIGNATOR_ELBOW 0x0D
294#define HID_PHYSICAL_DESIGNATOR_FOREARM 0x0E
295#define HID_PHYSICAL_DESIGNATOR_WRIST 0x0F
296#define HID_PHYSICAL_DESIGNATOR_PALM 0x10
297#define HID_PHYSICAL_DESIGNATOR_THUMB 0x11
298#define HID_PHYSICAL_DESIGNATOR_INDEX_FINGER 0x12
299#define HID_PHYSICAL_DESIGNATOR_MIDDLE_FINGER 0x13
300#define HID_PHYSICAL_DESIGNATOR_RING_FINGER 0x14
301#define HID_PHYSICAL_DESIGNATOR_LITTLE_FINGER 0x15
302#define HID_PHYSICAL_DESIGNATOR_HEAD 0x16
303#define HID_PHYSICAL_DESIGNATOR_SHOULDER 0x17
304#define HID_PHYSICAL_DESIGNATOR_HIP 0x18
305#define HID_PHYSICAL_DESIGNATOR_WAIST 0x19
306#define HID_PHYSICAL_DESIGNATOR_THIGH 0x1A
307#define HID_PHYSICAL_DESIGNATOR_KNEE 0x1B
308#define HID_PHYSICAL_DESIGNATOR_CALF 0x1C
309#define HID_PHYSICAL_DESIGNATOR_ANKLE 0x1D
310#define HID_PHYSICAL_DESIGNATOR_FOOT 0x1E
311#define HID_PHYSICAL_DESIGNATOR_HEEL 0x1F
312#define HID_PHYSICAL_DESIGNATOR_BALL_OF_FOOT 0x20
313#define HID_PHYSICAL_DESIGNATOR_BIG_TOE 0x21
314#define HID_PHYSICAL_DESIGNATOR_SECOND_TOE 0x22
315#define HID_PHYSICAL_DESIGNATOR_THIRD_TOE 0x23
316#define HID_PHYSICAL_DESIGNATOR_FOURTH_TOE 0x24
317#define HID_PHYSICAL_DESIGNATOR_LITTLE_TOE 0x25
318#define HID_PHYSICAL_DESIGNATOR_BROW 0x26
319#define HID_PHYSICAL_DESIGNATOR_CHEEK 0x27
320
322#define HID_PHYSICAL_QUALIFIER_NONE (0 << 5)
323#define HID_PHYSICAL_QUALIFIER_RIGHT (1 << 5)
324#define HID_PHYSICAL_QUALIFIER_LEFT (2 << 5)
325#define HID_PHYSICAL_QUALIFIER_BOTH (3 << 5)
326#define HID_PHYSICAL_QUALIFIER_EITHER (4 << 5)
327#define HID_PHYSICAL_QUALIFIER_CENTER (5 << 5)
328
330#define HID_PAGE_UNDEFINED 0x00
331#define HID_PAGE_GENERIC_DESKTOP 0x01
332#define HID_PAGE_SIMULATION_CONTROLS 0x02
333#define HID_PAGE_VR_CONTROLS 0x03
334#define HID_PAGE_SPORT_CONTROLS 0x04
335#define HID_PAGE_GAME_CONTROLS 0x05
336#define HID_PAGE_GENERIC_DEVICE_CONTROLS 0x06
337#define HID_PAGE_KEYBOARD_KEYPAD 0x07
338#define HID_PAGE_LED 0x08
339#define HID_PAGE_BUTTON 0x09
340#define HID_PAGE_ORDINAL 0x0A
341#define HID_PAGE_TELEPHONY_DEVICE 0x0B
342#define HID_PAGE_CONSUMER 0x0C
343#define HID_PAGE_DIGITIZERS 0x0D
344#define HID_PAGE_HAPTICS 0x0E
345#define HID_PAGE_PHYSICAL_INPUT_DEVICE 0x0F
346#define HID_PAGE_UNICODE 0x10
348#define HID_PAGE_EYE_AND_HEAD_TRACKERS 0x12
350#define HID_PAGE_AUXILIARY_DISPLAY 0x14
352#define HID_PAGE_SENSORS 0x20
354#define HID_PAGE_MEDICAL_INSTRUMENT 0x40
355#define HID_PAGE_BRAILLE_DISPLAY 0x41
357#define HID_PAGE_LIGHTING_AND_ILLUMINATION 0x59
359#define HID_PAGE_MONITOR 0x80
360#define HID_PAGE_MONITOR_ENUMERATED 0x81
361#define HID_PAGE_VESA_VIRTUAL_CONTROLS 0x82
363#define HID_PAGE_POWER 0x84
364#define HID_PAGE_BATTERY_SYSTEM 0x85
366#define HID_PAGE_BARCODE_SCANNER 0x8C
367#define HID_PAGE_SCALES 0x8D
368#define HID_PAGE_MAGNETIC_STRIPE_READER 0x8E
370#define HID_PAGE_CAMERA_CONTROL 0x90
371#define HID_PAGE_ARCADE 0x91
372#define HID_PAGE_GAMING_DEVICE 0x92
374#define HID_PAGE_FIDO_ALLIANCE 0xF1D0
376#define HID_PAGE_VENDOR_MINIMUM 0xFF00
378#define HID_PAGE_VENDOR_MAXIMUM 0xFFFF
379
382#define HID_DESKTOP_UNDEFINED 0x00
383#define HID_DESKTOP_POINTER 0x01
384#define HID_DESKTOP_MOUSE 0x02
386#define HID_DESKTOP_JOYSTICK 0x04
387#define HID_DESKTOP_GAMEPAD 0x05
388#define HID_DESKTOP_KEYBOARD 0x06
389#define HID_DESKTOP_KEYPAD 0x07
390#define HID_DESKTOP_MULTI_AXIS_CONTROLLER 0x08
391#define HID_DESKTOP_TABLET_PC_SYSTEM_CONTROLS 0x09
392#define HID_DESKTOP_WATER_COOLING_DEVICE 0x0A
393#define HID_DESKTOP_COMPUTER_CHASSIS_DEVICE 0x0B
394#define HID_DESKTOP_WIRELESS_RADIO_CONTROLS 0x0C
395#define HID_DESKTOP_PORTABLE_DEVICE_CONTROL 0x0D
396#define HID_DESKTOP_SYSTEM_MULTI_AXIS_CONTROLLER 0x0E
397#define HID_DESKTOP_SPATIAL_CONTROLLER 0x0F
398#define HID_DESKTOP_ASSISTIVE_CONTROL 0x10
399#define HID_DESKTOP_DEVICE_DOCK 0x11
400#define HID_DESKTOP_DOCKABLE_DEVICE 0x12
401#define HID_DESKTOP_CALL_STATE_MANAGEMENT_CONTROL 0x13
403#define HID_DESKTOP_X 0x30
404#define HID_DESKTOP_Y 0x31
405#define HID_DESKTOP_Z 0x32
406#define HID_DESKTOP_RX 0x33
407#define HID_DESKTOP_RY 0x34
408#define HID_DESKTOP_RZ 0x35
409#define HID_DESKTOP_SLIDER 0x36
410#define HID_DESKTOP_DIAL 0x37
411#define HID_DESKTOP_WHEEL 0x38
412#define HID_DESKTOP_HAT_SWITCH 0x39
413#define HID_DESKTOP_COUNTED_BUFFER 0x3A
414#define HID_DESKTOP_BYTE_COUNT 0x3B
415#define HID_DESKTOP_MOTION_WAKEUP 0x3C
416#define HID_DESKTOP_START 0x3D
417#define HID_DESKTOP_SELECT 0x3E
419#define HID_DESKTOP_VX 0x40
420#define HID_DESKTOP_VY 0x41
421#define HID_DESKTOP_VZ 0x42
422#define HID_DESKTOP_VBRX 0x43
423#define HID_DESKTOP_VBRY 0x44
424#define HID_DESKTOP_VBRZ 0x45
425#define HID_DESKTOP_VNO 0x46
426#define HID_DESKTOP_FEATURE_NOTIFICATION 0x47
427#define HID_DESKTOP_RESOLUTION_MULTIPLIER 0x48
428#define HID_DESKTOP_QX 0x49
429#define HID_DESKTOP_QY 0x4A
430#define HID_DESKTOP_QZ 0x4B
431#define HID_DESKTOP_QW 0x4C
432
435
437#define HID_LED_UNDEFINED 00
438#define HID_LED_NUM_LOCK 01
439#define HID_LED_CAPS_LOCK 02
440#define HID_LED_SCROLL_LOCK 03
441#define HID_LED_COMPOSE 04
442#define HID_LED_KANA 05
443#define HID_LED_POWER 06
444#define HID_LED_SHIFT 07
445#define HID_LED_DO_NOT_DISTURB 08
446#define HID_LED_MUTE 09
447
449#define HID_BUTTON_NONE 0
450#define HID_BUTTON_1 1
451#define HID_BUTTON_2 2
452#define HID_BUTTON_3 3
453#define HID_BUTTON_4 4
454#define HID_BUTTON_5 5
455#define HID_BUTTON_PRIMARY HID_BUTTON_1
456#define HID_BUTTON_SECONDARY HID_BUTTON_2
457#define HID_BUTTON_TERTIARY HID_BUTTON_3
459#define HID_BUTTON_65535 0xFFFF
460
462#define HID_DIGITIZERS_UNDEFINED 0x00
463#define HID_DIGITIZERS_DIGITIZER 0x01
464#define HID_DIGITIZERS_PEN 0x02
465#define HID_DIGITIZERS_LIGHT_PEN 0x03
466#define HID_DIGITIZERS_TOUCH_SCREEN 0x04
467#define HID_DIGITIZERS_TOUCH_PAD 0x05
468#define HID_DIGITIZERS_WHITEBOARD 0x06
469#define HID_DIGITIZERS_COORD_MEASURING 0x07
470#define HID_DIGITIZERS_3D_DIGITIZER 0x08
471#define HID_DIGITIZERS_STEREO_PLOTTER 0x09
472#define HID_DIGITIZERS_ARTICULATED_ARM 0x0A
473#define HID_DIGITIZERS_ARMATURE 0x0B
474#define HID_DIGITIZERS_MULTI_POINT_DIGITIZER 0x0C
475#define HID_DIGITIZERS_FREE_SPACE_WAND 0x0D
476#define HID_DIGITIZERS_DEVICE_CONFIGURATION 0x0E
477#define HID_DIGITIZERS_CAPACITIVE_HEAT_MAP 0x0F
479#define HID_DIGITIZERS_STYLUS 0x20
480#define HID_DIGITIZERS_PUCK 0x21
481#define HID_DIGITIZERS_FINGER 0x22
482#define HID_DIGITIZERS_DEVICE_SETTINGS 0x23
483#define HID_DIGITIZERS_CHARACTER_GESTURE 0x24
485#define HID_DIGITIZERS_TIP_PRESSURE 0x30
486#define HID_DIGITIZERS_BARREL_PRESSURE 0x31
487#define HID_DIGITIZERS_IN_RANGE 0x32
488#define HID_DIGITIZERS_TOUCH 0x33
489#define HID_DIGITIZERS_UNTOUCH 0x34
490#define HID_DIGITIZERS_TAP 0x35
491#define HID_DIGITIZERS_QUALITY 0x36
492#define HID_DIGITIZERS_DATA_VALID 0x37
493#define HID_DIGITIZERS_TRANSDUCER_INDEX 0x38
494#define HID_DIGITIZERS_TABLET_FUNCTION_KEYS 0x39
495#define HID_DIGITIZERS_PROGRAM_CHANGE_KEYS 0x3A
496#define HID_DIGITIZERS_BATTERY_STRENGTH 0x3B
497#define HID_DIGITIZERS_INVERT 0x3C
498#define HID_DIGITIZERS_X_TILT 0x3D
499#define HID_DIGITIZERS_Y_TILT 0x3E
500#define HID_DIGITIZERS_AZIMUTH 0x3F
501#define HID_DIGITIZERS_ALTITUDE 0x40
502#define HID_DIGITIZERS_TWIST 0x41
503#define HID_DIGITIZERS_TIP_SWITCH 0x42
504#define HID_DIGITIZERS_SECONDARY_TIP_SWITCH 0x43
505#define HID_DIGITIZERS_BARREL_SWITCH 0x44
506#define HID_DIGITIZERS_ERASER 0x45
507#define HID_DIGITIZERS_TABLET_PICK 0x46
508#define HID_DIGITIZERS_TOUCH_VALID 0x47
509#define HID_DIGITIZERS_WIDTH 0x48
510#define HID_DIGITIZERS_HEIGHT 0x49
512#define HID_DIGITIZERS_CONTACT_IDENTIFIER 0x51
513#define HID_DIGITIZERS_DEVICE_MODE 0x52
514#define HID_DIGITIZERS_DEVICE_IDENTIFIER 0x53
515#define HID_DIGITIZERS_CONTACT_COUNT 0x54
516#define HID_DIGITIZERS_CONTACT_COUNT_MAXIMUM 0x55
517#define HID_DIGITIZERS_SCAN_TIME 0x56
518
523{
524 uint8_t blength;
526 uint16_t bcdhid;
531 // Note: Up to two optional bHIDDescriptorType/wHIDDescriptorLength pairs after the Report descriptor details
533
534
537
541{
542 uint8_t bdesignator;
543 uint8_t bflags;
544} PACKED;
545
546
549{
550 uint8_t bnumber;
551 uint16_t wlength;
552} PACKED;
553
554
561
562
565typedef struct _HID_STATE HID_STATE;
567{
568 // Local State
569 uint32_t usage;
570 uint32_t usagecount;
573 uint32_t stringindex;
574 uint32_t stringcount;
576 // Global State
577 uint16_t usagepage;
582 uint32_t unittype;
583 uint32_t unitexponent;
584 uint32_t reportsize;
585 uint32_t reportid;
586 uint32_t reportcount;
587};
588
589
591typedef struct _HID_STACK HID_STACK;
597
598
600typedef struct _HID_USAGE HID_USAGE;
601typedef struct _HID_REPORT HID_REPORT;
603
604typedef struct _HID_DEVICE HID_DEVICE;
606
608{
609 uint16_t page;
610 uint16_t usage;
611 uint16_t count;
612 uint32_t index;
613 uint32_t stringindex;
614 uint32_t stringcount;
621 uint32_t unittype;
622 uint32_t unitexponent;
624 uint32_t aliascount;
626};
627
628
631{
632 uint8_t id;
633 uint8_t kind;
634 uint32_t flags;
635 uint32_t size;
636 uint32_t count;
637 uint32_t index;
638 uint32_t sequence;
640 uint32_t usagecount;
642};
643
644
661
663
665typedef uint32_t STDCALL (*hid_device_enumerate_cb)(HID_DEVICE *device, void *data);
666
668typedef uint32_t STDCALL (*hid_device_notification_cb)(DEVICE *device, void *data, uint32_t notification);
669
671typedef uint32_t STDCALL (*hid_device_get_idle_proc)(HID_DEVICE *device, uint16_t *duration, uint8_t reportid);
672typedef uint32_t STDCALL (*hid_device_set_idle_proc)(HID_DEVICE *device, uint16_t duration, uint8_t reportid);
673
674typedef uint32_t STDCALL (*hid_device_get_report_proc)(HID_DEVICE *device, uint8_t reporttype, uint8_t reportid, void *reportdata, uint32_t reportsize);
675typedef uint32_t STDCALL (*hid_device_set_report_proc)(HID_DEVICE *device, uint8_t reporttype, uint8_t reportid, void *reportdata, uint32_t reportsize);
676
677typedef uint32_t STDCALL (*hid_device_allocate_report_proc)(HID_DEVICE *device, HID_COLLECTION *collection, uint8_t reportid, uint32_t reportsize);
678typedef uint32_t STDCALL (*hid_device_release_report_proc)(HID_DEVICE *device, uint8_t reportid);
679
680typedef uint32_t STDCALL (*hid_device_submit_report_proc)(HID_DEVICE *device, uint8_t reportid);
681typedef uint32_t STDCALL (*hid_device_cancel_report_proc)(HID_DEVICE *device, uint8_t reportid);
682
683typedef uint32_t STDCALL (*hid_device_get_protocol_proc)(HID_DEVICE *device, uint8_t *protocol);
684typedef uint32_t STDCALL (*hid_device_set_protocol_proc)(HID_DEVICE *device, uint8_t protocol);
685
686typedef uint32_t STDCALL (*hid_device_get_interval_proc)(HID_DEVICE *device, uint32_t *interval);
687typedef uint32_t STDCALL (*hid_device_set_interval_proc)(HID_DEVICE *device, uint32_t interval);
688
689typedef uint32_t STDCALL (*hid_device_get_report_descriptor_proc)(HID_DEVICE *device, HID_REPORT_DESCRIPTOR *descriptor, uint32_t size);
691typedef uint32_t STDCALL (*hid_device_get_physical_descriptor_set_proc)(HID_DEVICE *device, HID_PHYSICAL_DESCRIPTOR_SET *descriptor, uint8_t index, uint32_t size);
692
730
731
733
735typedef uint32_t STDCALL (*hid_consumer_enumerate_cb)(HID_CONSUMER *consumer, void *data);
736
738typedef uint32_t STDCALL (*hid_device_bind_proc)(HID_DEVICE *device);
739typedef uint32_t STDCALL (*hid_device_unbind_proc)(HID_DEVICE *device);
740
741typedef uint32_t STDCALL (*hid_collection_bind_proc)(HID_DEVICE *device, HID_COLLECTION *collection);
742typedef uint32_t STDCALL (*hid_collection_unbind_proc)(HID_DEVICE *device, HID_COLLECTION *collection);
743
744typedef uint32_t STDCALL (*hid_report_receive_proc)(HID_COLLECTION *collection, uint8_t reportid, void *reportdata, uint32_t reportsize);
745
762
763
766typedef struct _HID_EXTENT HID_EXTENT;
768{
769 int32_t minimum;
770 int32_t maximum;
771};
772
773
775typedef struct _HID_FIELD HID_FIELD;
777{
778 uint16_t page;
779 uint16_t usage;
780 uint32_t count;
781 uint32_t flags;
782 uint32_t size;
783 uint32_t bits;
784 uint32_t offset;
785 uint32_t shift;
788 double_t multiplier;
789 double_t resolution;
791};
792
793
797{
798 uint8_t id;
799 uint8_t kind;
800 uint32_t size;
803};
804
806
814uint32_t STDCALL hid_parser_parse_collections(HID_DEVICE *device, HID_COLLECTION **collections, uint32_t *count);
815
822uint32_t STDCALL hid_parser_free_collections(HID_COLLECTION *collections, uint32_t count);
823
831
839
847
857HID_COLLECTION * STDCALL hid_parser_allocate_collection(HID_DEVICE *device, HID_COLLECTION *parent, HID_STATE *state, uint32_t flags, uint32_t start);
858
870HID_REPORT * STDCALL hid_parser_allocate_report(HID_DEVICE *device, HID_COLLECTION *collection, HID_STATE *state, uint8_t kind, uint32_t flags, uint32_t index, uint32_t sequence);
871
880HID_USAGE * STDCALL hid_parser_allocate_usage(HID_DEVICE *device, HID_REPORT *report, HID_STATE *state, uint32_t index);
881
893
901
909
916
923
930
937
945HID_COLLECTION * STDCALL hid_find_collection(HID_DEVICE *device, uint16_t page, uint16_t usage);
946
955uint32_t STDCALL hid_find_report_ids(HID_DEVICE *device, HID_COLLECTION *collection, uint8_t *minid, uint8_t *maxid);
956
966uint32_t STDCALL hid_find_report_sizes(HID_DEVICE *device, HID_COLLECTION *collection, uint8_t kind, uint32_t *minsize, uint32_t *maxsize);
967
977uint32_t STDCALL hid_count_reports(HID_DEVICE *device, HID_COLLECTION *collection, uint8_t kind, uint8_t id, uint32_t *count);
978
993uint32_t STDCALL hid_find_reports(HID_DEVICE *device, HID_COLLECTION *collection, uint8_t kind, uint8_t id, HID_REPORT *reports, uint32_t count);
994
1003HID_DEFINITION * STDCALL hid_allocate_definition(HID_DEVICE *device, HID_COLLECTION *collection, uint8_t kind, uint8_t id);
1004
1011
1020uint32_t STDCALL hid_insert_bit_field(HID_FIELD *field, void *buffer, uint32_t size, BOOL value);
1021
1030uint32_t STDCALL hid_insert_signed_field(HID_FIELD *field, void *buffer, uint32_t size, int32_t value);
1031
1040uint32_t STDCALL hid_insert_unsigned_field(HID_FIELD *field, void *buffer, uint32_t size, uint32_t value);
1041
1050uint32_t STDCALL hid_extract_bit_field(HID_FIELD *field, void *buffer, uint32_t size, BOOL *value);
1051
1060uint32_t STDCALL hid_extract_signed_field(HID_FIELD *field, void *buffer, uint32_t size, int32_t *value);
1061
1070uint32_t STDCALL hid_extract_unsigned_field(HID_FIELD *field, void *buffer, uint32_t size, uint32_t *value);
1071
1073
1080uint32_t STDCALL hid_device_set_state(HID_DEVICE *device, uint32_t state);
1081
1089uint32_t STDCALL hid_device_get_idle(HID_DEVICE *device, uint16_t *duration, uint8_t reportid);
1090
1098uint32_t STDCALL hid_device_set_idle(HID_DEVICE *device, uint16_t duration, uint8_t reportid);
1099
1109uint32_t STDCALL hid_device_get_report(HID_DEVICE *device, uint8_t reporttype, uint8_t reportid, void *reportdata, uint32_t reportsize);
1110
1120uint32_t STDCALL hid_device_set_report(HID_DEVICE *device, uint8_t reporttype, uint8_t reportid, void *reportdata, uint32_t reportsize);
1121
1131uint32_t STDCALL hid_device_allocate_report(HID_DEVICE *device, HID_COLLECTION *collection, uint8_t reportid, uint32_t reportsize);
1132
1140uint32_t STDCALL hid_device_release_report(HID_DEVICE *device, uint8_t reportid);
1141
1149uint32_t STDCALL hid_device_submit_report(HID_DEVICE *device, uint8_t reportid);
1150
1158uint32_t STDCALL hid_device_cancel_report(HID_DEVICE *device, uint8_t reportid);
1159
1166uint32_t STDCALL hid_device_get_protocol(HID_DEVICE *device, uint8_t *protocol);
1167
1174uint32_t STDCALL hid_device_set_protocol(HID_DEVICE *device, uint8_t protocol);
1175
1182uint32_t STDCALL hid_device_get_interval(HID_DEVICE *device, uint32_t *interval);
1183
1190uint32_t STDCALL hid_device_set_interval(HID_DEVICE *device, uint32_t interval);
1191
1199uint32_t STDCALL hid_device_get_report_descriptor(HID_DEVICE *device, HID_REPORT_DESCRIPTOR *descriptor, uint32_t size);
1200
1208
1217uint32_t STDCALL hid_device_get_physical_descriptor_set(HID_DEVICE *device, HID_PHYSICAL_DESCRIPTOR_SET *descriptor, uint8_t index, uint32_t size);
1218
1225
1233
1240
1248
1254
1261
1268
1275
1282
1289
1296
1303
1311
1320uint32_t STDCALL hid_device_notification(HID_DEVICE *device, hid_device_notification_cb callback, void *data, uint32_t notification, uint32_t flags);
1321
1323
1329
1336
1341
1346
1351
1356
1361
1366
1368
1373
1378
1383
1388
1393
1397uint32_t STDCALL hid_page_to_string(uint16_t page, char *string, uint32_t len);
1398
1402uint32_t STDCALL hid_usage_to_string(uint16_t page, uint16_t usage, uint16_t count, char *string, uint32_t len);
1403
1407uint32_t STDCALL hid_unit_type_to_string(uint32_t unittype, char *string, uint32_t len);
1408
1412uint32_t STDCALL hid_report_kind_to_string(uint8_t kind, char *string, uint32_t len);
1413
1417uint32_t STDCALL hid_report_flags_to_string(uint32_t flags, char *string, uint32_t len);
1418
1422uint32_t STDCALL hid_collection_flags_to_string(uint32_t flags, char *string, uint32_t len);
1423
1425
1430
1435
1439uint32_t STDCALL hid_device_type_to_string(uint32_t hidtype, char *string, uint32_t len);
1440
1444uint32_t STDCALL hid_device_state_to_string(uint32_t hidstate, char *string, uint32_t len);
1445
1450
1452
1457
1462
1463#ifdef __cplusplus
1464}
1465#endif
1466
1467#endif // _ULTIBO_HID_H
struct _DEVICE DEVICE
Definition devices.h:373
struct _DRIVER DRIVER
Definition devices.h:465
#define STDCALL
Definition globaltypes.h:45
#define PACKED
Definition globaltypes.h:48
_Bool BOOL
Built in Boolean type (1 byte) (Redeclared here for flexibility).
Definition globaltypes.h:55
HANDLE MUTEX_HANDLE
Definition globaltypes.h:105
BOOL STDCALL hid_is_byte_field(HID_FIELD *field)
Return True if the supplied HID field contains a 1 byte value.
uint32_t STDCALL hid_device_destroy(HID_DEVICE *device)
Destroy an existing HID device entry.
uint32_t STDCALL hid_device_type_to_string(uint32_t hidtype, char *string, uint32_t len)
Return a string describing the HID device type (eg HID_TYPE_USB).
uint32_t STDCALL hid_device_set_report(HID_DEVICE *device, uint8_t reporttype, uint8_t reportid, void *reportdata, uint32_t reportsize)
Write a report by type and id to a HID device.
uint32_t STDCALL hid_device_unbind_device(HID_DEVICE *device, HID_CONSUMER *consumer)
Unbind a HID device from a consumer.
HID_DEVICE *STDCALL hid_device_find_by_description(const char *description)
Find a HID device by description in the device table.
HID_COLLECTION *STDCALL hid_parser_allocate_collection(HID_DEVICE *device, HID_COLLECTION *parent, HID_STATE *state, uint32_t flags, uint32_t start)
Allocate a HID collection to contain a set of reports and usages from a HID report descriptor.
struct _HID_PHYSICAL_DESCRIPTOR_SET0 HID_PHYSICAL_DESCRIPTOR_SET0
Definition hid.h:547
struct _HID_DEVICE HID_DEVICE
Forward declared to satisfy HIDCollection.
Definition hid.h:604
HID_DEVICE *STDCALL hid_device_find_by_name(const char *name)
Find a HID device by name in the device table.
HID_DEVICE *STDCALL hid_device_create_ex(uint32_t size)
Create a new HID device entry.
uint32_t STDCALL(* hid_device_unbind_proc)(HID_DEVICE *device)
Definition hid.h:739
HID_CONSUMER *STDCALL hid_consumer_create_ex(uint32_t size)
Create a new HID Consumer entry.
uint32_t STDCALL hid_consumer_get_count(void)
Get the current HID Consumer count.
uint32_t STDCALL hid_device_register(HID_DEVICE *device)
Register a new HID device in the HID device table.
uint32_t STDCALL hid_usage_to_string(uint16_t page, uint16_t usage, uint16_t count, char *string, uint32_t len)
Return a string describing a HID usage within the given page.
uint32_t STDCALL hid_device_get_count(void)
Get the current HID Device count.
struct _HID_CONSUMER HID_CONSUMER
Forward declared to satisfy HIDCollection.
Definition hid.h:605
uint32_t STDCALL hid_device_deregister(HID_DEVICE *device)
Deregister a HID device from the HID device table.
uint32_t STDCALL hid_consumer_enumerate(hid_consumer_enumerate_cb callback, void *data)
Enumerate all consumers in the HID Consumer table.
uint32_t STDCALL hid_find_report_sizes(HID_DEVICE *device, HID_COLLECTION *collection, uint8_t kind, uint32_t *minsize, uint32_t *maxsize)
Find the minimum and maximum report sizes contained in the specified HID collection or all collection...
uint32_t STDCALL(* hid_device_notification_cb)(DEVICE *device, void *data, uint32_t notification)
Definition hid.h:668
uint32_t STDCALL hid_find_report_ids(HID_DEVICE *device, HID_COLLECTION *collection, uint8_t *minid, uint8_t *maxid)
Find the minimum and maximum report ids contained in the specified HID collection or all collections.
struct _HID_STATE HID_STATE
Definition hid.h:565
uint32_t STDCALL hid_page_to_string(uint16_t page, char *string, uint32_t len)
Return a string describing a HID usage page.
HID_CONSUMER *STDCALL hid_consumer_find(uint32_t consumerid)
Find a consumer by Id in the HID Consumer table.
struct _HID_PHYSICAL_DESCRIPTOR HID_PHYSICAL_DESCRIPTOR
Definition hid.h:539
uint32_t STDCALL(* hid_device_allocate_report_proc)(HID_DEVICE *device, HID_COLLECTION *collection, uint8_t reportid, uint32_t reportsize)
Definition hid.h:677
BOOL STDCALL hid_parser_free_usage(HID_DEVICE *device, HID_USAGE *usage)
Free a HID usage and any associated usage aliases.
uint32_t STDCALL hid_consumer_destroy(HID_CONSUMER *consumer)
Destroy an existing HID Consumer entry.
struct _HID_REPORT HID_REPORT
Forward declared to satisfy HIDUsage.
Definition hid.h:601
uint32_t STDCALL hid_parser_count_collections(HID_DEVICE *device, HID_COLLECTION *parent)
Count the number of collections found in the HID report descriptor of the provided device.
uint32_t STDCALL hid_parser_reset_state(HID_STATE *state)
Clear the Local and Global HID parser state.
uint32_t STDCALL(* hid_device_get_report_proc)(HID_DEVICE *device, uint8_t reporttype, uint8_t reportid, void *reportdata, uint32_t reportsize)
Definition hid.h:674
uint32_t STDCALL hid_insert_signed_field(HID_FIELD *field, void *buffer, uint32_t size, int32_t value)
Insert a signed field value into a report buffer.
HID_CONSUMER *STDCALL hid_consumer_check(HID_CONSUMER *consumer)
Check if the supplied HID Consumer is in the consumer table.
uint32_t STDCALL(* hid_device_release_report_proc)(HID_DEVICE *device, uint8_t reportid)
Definition hid.h:678
uint32_t STDCALL hid_device_allocate_report(HID_DEVICE *device, HID_COLLECTION *collection, uint8_t reportid, uint32_t reportsize)
Allocate and initialize an input report by id on a HID device.
uint32_t STDCALL(* hid_device_bind_proc)(HID_DEVICE *device)
Definition hid.h:738
uint32_t STDCALL hid_device_set_interval(HID_DEVICE *device, uint32_t interval)
Set the polling interval for a HID device.
BOOL STDCALL hid_is_signed_field(HID_FIELD *field)
Return True if the supplied HID field contains a signed value.
void HID_REPORT_DESCRIPTOR
Definition hid.h:536
uint32_t STDCALL(* hid_device_set_interval_proc)(HID_DEVICE *device, uint32_t interval)
Definition hid.h:687
BOOL STDCALL hid_is_word_field(HID_FIELD *field)
Return True if the supplied HID field contains a 2 byte value.
uint32_t STDCALL hid_collection_flags_to_string(uint32_t flags, char *string, uint32_t len)
Return a string describing the flags of a HID collection.
uint32_t STDCALL(* hid_device_cancel_report_proc)(HID_DEVICE *device, uint8_t reportid)
Definition hid.h:681
uint32_t STDCALL hid_parser_parse_collections(HID_DEVICE *device, HID_COLLECTION **collections, uint32_t *count)
Parse the HID report descriptor of the provided device and populate the collections,...
uint32_t STDCALL hid_count_reports(HID_DEVICE *device, HID_COLLECTION *collection, uint8_t kind, uint8_t id, uint32_t *count)
Count the number of HID reports of the specified type and id in the specified collection.
struct _HID_DEFINITION HID_DEFINITION
Definition hid.h:795
uint32_t STDCALL hid_parser_free_stack(HID_STACK *stack)
Free the HID parser stack and state.
HID_REPORT *STDCALL hid_parser_allocate_report(HID_DEVICE *device, HID_COLLECTION *collection, HID_STATE *state, uint8_t kind, uint32_t flags, uint32_t index, uint32_t sequence)
Allocate a HID report to contain a set of usages from a HID report descriptor.
struct _HID_DESCRIPTOR HID_DESCRIPTOR
Definition hid.h:521
uint32_t STDCALL hid_consumer_deregister(HID_CONSUMER *consumer)
Deregister a Consumer from the HID Consumer table.
uint32_t STDCALL hid_parser_count_usages(HID_DEVICE *device, HID_REPORT *report)
Count the number of usages found in the HID report descriptor for the supplied device and report.
uint32_t STDCALL hid_device_state_to_string(uint32_t hidstate, char *string, uint32_t len)
Return a string describing the HID device state (eg HID_STATE_ATTACHED).
uint32_t STDCALL(* hid_device_enumerate_cb)(HID_DEVICE *device, void *data)
Definition hid.h:665
uint32_t STDCALL hid_parser_pop_stack(HID_STACK *stack, HID_STATE *state)
Replace the current HID parser state with the top item from the parser stack.
uint32_t STDCALL(* hid_device_get_interval_proc)(HID_DEVICE *device, uint32_t *interval)
Definition hid.h:686
uint32_t STDCALL hid_extract_unsigned_field(HID_FIELD *field, void *buffer, uint32_t size, uint32_t *value)
Extract an unsigned field value from a report buffer.
uint32_t STDCALL hid_extract_bit_field(HID_FIELD *field, void *buffer, uint32_t size, BOOL *value)
Extract a bit field value from a report buffer.
uint32_t STDCALL(* hid_device_set_protocol_proc)(HID_DEVICE *device, uint8_t protocol)
Definition hid.h:684
struct _HID_PHYSICAL_DESCRIPTOR_SET HID_PHYSICAL_DESCRIPTOR_SET
Definition hid.h:555
uint32_t STDCALL(* hid_device_get_physical_descriptor_set0_proc)(HID_DEVICE *device, HID_PHYSICAL_DESCRIPTOR_SET0 *descriptor)
Definition hid.h:690
HID_CONSUMER *STDCALL hid_consumer_create(void)
Create a new HID Consumer entry.
HID_COLLECTION *STDCALL hid_find_collection(HID_DEVICE *device, uint16_t page, uint16_t usage)
Find the first HID collection matching the specified page and usage.
BOOL STDCALL hid_is_bit_field(HID_FIELD *field)
Return True if the supplied field contains a 1 bit value.
uint32_t STDCALL(* hid_device_set_idle_proc)(HID_DEVICE *device, uint16_t duration, uint8_t reportid)
Definition hid.h:672
uint32_t STDCALL hid_device_set_state(HID_DEVICE *device, uint32_t state)
Set the state of the specified HID device and send a notification.
struct _HID_EXTENT HID_EXTENT
Definition hid.h:766
uint32_t STDCALL(* hid_consumer_enumerate_cb)(HID_CONSUMER *consumer, void *data)
Definition hid.h:735
HID_USAGE *STDCALL hid_parser_allocate_usage(HID_DEVICE *device, HID_REPORT *report, HID_STATE *state, uint32_t index)
Allocate a HID usage from a HID report descriptor.
HID_DEVICE *STDCALL hid_device_check(HID_DEVICE *device)
Check if the supplied HID Device is in the device table.
uint32_t STDCALL hid_device_get_physical_descriptor_set0(HID_DEVICE *device, HID_PHYSICAL_DESCRIPTOR_SET0 *descriptor)
Get the HID Physical Descriptor Set 0 for a HID device.
uint32_t STDCALL hid_device_get_protocol(HID_DEVICE *device, uint8_t *protocol)
Get the report protocol from a HID device.
struct _HID_COLLECTION HID_COLLECTION
Forward declared to satisfy HIDReport.
Definition hid.h:602
uint32_t STDCALL(* hid_device_get_protocol_proc)(HID_DEVICE *device, uint8_t *protocol)
Definition hid.h:683
uint32_t STDCALL(* hid_collection_unbind_proc)(HID_DEVICE *device, HID_COLLECTION *collection)
Definition hid.h:742
uint32_t STDCALL hid_device_submit_report(HID_DEVICE *device, uint8_t reportid)
Submit an input report by id on a HID device.
HID_DEVICE *STDCALL hid_device_create(void)
Create a new HID device entry.
uint32_t STDCALL(* hid_device_set_report_proc)(HID_DEVICE *device, uint8_t reporttype, uint8_t reportid, void *reportdata, uint32_t reportsize)
Definition hid.h:675
BOOL STDCALL hid_is_long_field(HID_FIELD *field)
Return True if the supplied HID field contains a 3 or 4 byte value.
uint32_t STDCALL hid_device_notification(HID_DEVICE *device, hid_device_notification_cb callback, void *data, uint32_t notification, uint32_t flags)
Register a notification for HID device changes.
uint32_t STDCALL hid_parser_clean_state(HID_STATE *state)
Clear the Local HID parser state.
struct _HID_FIELD HID_FIELD
Definition hid.h:775
HID_DEFINITION *STDCALL hid_allocate_definition(HID_DEVICE *device, HID_COLLECTION *collection, uint8_t kind, uint8_t id)
Allocate a HID definition to describe an input, output or feature report contained in the specified c...
uint32_t STDCALL hid_device_unbind_collections(HID_DEVICE *device, HID_CONSUMER *consumer)
Unbind the HID collections in the specified device from a consumer.
BOOL STDCALL hid_parser_update_usage(HID_DEVICE *device, HID_REPORT *report, HID_STATE *state, HID_USAGE *usage)
Update a HID usage from a HID report descriptor.
uint32_t STDCALL(* hid_collection_bind_proc)(HID_DEVICE *device, HID_COLLECTION *collection)
Definition hid.h:741
HID_CONSUMER *STDCALL hid_consumer_find_by_name(const char *name)
Find a consumer by name in the Driver table.
uint32_t STDCALL hid_insert_bit_field(HID_FIELD *field, void *buffer, uint32_t size, BOOL value)
Insert a bit field value into a report buffer.
uint32_t STDCALL(* hid_device_get_report_descriptor_proc)(HID_DEVICE *device, HID_REPORT_DESCRIPTOR *descriptor, uint32_t size)
Definition hid.h:689
uint32_t STDCALL(* hid_device_submit_report_proc)(HID_DEVICE *device, uint8_t reportid)
Definition hid.h:680
uint32_t STDCALL hid_device_get_report_descriptor(HID_DEVICE *device, HID_REPORT_DESCRIPTOR *descriptor, uint32_t size)
Get the Report Descriptor for a HID device.
uint32_t STDCALL(* hid_device_get_idle_proc)(HID_DEVICE *device, uint16_t *duration, uint8_t reportid)
Definition hid.h:671
uint32_t STDCALL hid_device_cancel_report(HID_DEVICE *device, uint8_t reportid)
Cancel an input report by id on a HID device.
uint32_t STDCALL hid_find_reports(HID_DEVICE *device, HID_COLLECTION *collection, uint8_t kind, uint8_t id, HID_REPORT *reports, uint32_t count)
Find all HID reports of the specified type and id in the specified collection.
struct _HID_USAGE HID_USAGE
Definition hid.h:600
uint32_t STDCALL hid_parser_push_stack(HID_STACK *stack)
Place a copy of the current HID parser state on top of the parser stack.
uint32_t STDCALL hid_free_definition(HID_DEFINITION *definition)
Free a HID definition describing an input, output or feature report.
uint32_t STDCALL hid_extract_signed_field(HID_FIELD *field, void *buffer, uint32_t size, int32_t *value)
Extract a signed field value from a report buffer.
uint32_t STDCALL hid_consumer_register(HID_CONSUMER *consumer)
Register a new Consumer in the HID Consumer table.
uint32_t STDCALL hid_device_set_idle(HID_DEVICE *device, uint16_t duration, uint8_t reportid)
Set the idle rate on a HID device for the specified report id.
uint32_t STDCALL hid_device_enumerate(hid_device_enumerate_cb callback, void *data)
Enumerate all HID devices in the HID device table.
uint32_t STDCALL hid_report_kind_to_string(uint8_t kind, char *string, uint32_t len)
Return a string describing a HID report type.
uint32_t STDCALL hid_device_get_physical_descriptor_set(HID_DEVICE *device, HID_PHYSICAL_DESCRIPTOR_SET *descriptor, uint8_t index, uint32_t size)
Get a HID Physical Descriptor Set for a HID device.
uint32_t STDCALL hid_device_state_to_notification(uint32_t state)
Convert a Device state value into the notification code for device notifications.
uint32_t STDCALL hid_device_release_report(HID_DEVICE *device, uint8_t reportid)
Release an input report by id from a HID device.
uint32_t STDCALL hid_device_bind_collections(HID_DEVICE *device)
Attempt to bind the HID collections in the specified device to one of the registered consumers.
uint32_t STDCALL hid_unit_type_to_string(uint32_t unittype, char *string, uint32_t len)
Return a string describing a HID unit type.
HID_DEVICE *STDCALL hid_device_find(uint32_t hidid)
Find a HID device by ID in the HID device table.
uint32_t STDCALL hid_parser_count_reports(HID_DEVICE *device, HID_COLLECTION *collection)
Count the number of reports found in the HID report descriptor of the supplied device and collection.
uint32_t STDCALL hid_device_bind_device(HID_DEVICE *device)
Attempt to bind a HID device to one of the registered consumers.
uint32_t STDCALL hid_device_get_idle(HID_DEVICE *device, uint16_t *duration, uint8_t reportid)
Get the idle rate from a HID device for the specified report id.
uint32_t STDCALL hid_device_get_interval(HID_DEVICE *device, uint32_t *interval)
Get the polling interval from a HID device.
uint32_t STDCALL hid_device_set_protocol(HID_DEVICE *device, uint8_t protocol)
Set the report protocol for a HID device.
uint32_t STDCALL(* hid_device_get_physical_descriptor_set_proc)(HID_DEVICE *device, HID_PHYSICAL_DESCRIPTOR_SET *descriptor, uint8_t index, uint32_t size)
Definition hid.h:691
uint32_t STDCALL hid_device_get_report(HID_DEVICE *device, uint8_t reporttype, uint8_t reportid, void *reportdata, uint32_t reportsize)
Read a report by type and id from a HID device.
uint32_t STDCALL(* hid_report_receive_proc)(HID_COLLECTION *collection, uint8_t reportid, void *reportdata, uint32_t reportsize)
Definition hid.h:744
uint32_t STDCALL hid_parser_free_collections(HID_COLLECTION *collections, uint32_t count)
Free the collections, reports and usages parsed from a HID report descriptor.
struct _HID_STACK HID_STACK
Definition hid.h:591
uint32_t STDCALL hid_report_flags_to_string(uint32_t flags, char *string, uint32_t len)
Return a string describing the flags of a HID report.
uint32_t STDCALL hid_insert_unsigned_field(HID_FIELD *field, void *buffer, uint32_t size, uint32_t value)
Insert an unsigned field value into a report buffer.
Definition hid.h:647
uint16_t usage
The usage within the usage page (eg HID_DESKTOP_MOUSE).
Definition hid.h:649
void * privatedata
Private data for the consumer of this collection.
Definition hid.h:659
HID_CONSUMER * consumer
The consumer which is bound to this collection (or nil if not bound).
Definition hid.h:658
uint32_t start
The first byte of this collection in the report descriptor.
Definition hid.h:651
uint32_t flags
The main item flags for this collection (eg HID_MAIN_COLLECTION_APPLICATION).
Definition hid.h:650
HID_DEVICE * device
The device this collection belongs to.
Definition hid.h:657
HID_COLLECTION * collections
The list of collections contained in this collection.
Definition hid.h:654
uint16_t page
The usage page this collection refers to (eg HID_PAGE_GENERIC_DESKTOP).
Definition hid.h:648
uint32_t reportcount
The number of reports contained in this collection.
Definition hid.h:653
HID_COLLECTION * parent
The parent collection or nil if this is a top level collection.
Definition hid.h:656
HID_REPORT * reports
The list of reports contained in this collection.
Definition hid.h:652
uint32_t collectioncount
The number of collections contained in this collection.
Definition hid.h:655
Definition hid.h:747
hid_report_receive_proc reportreceive
A Report Receive method to be called when a HID input report is received by a provider (Mandatory).
Definition hid.h:755
MUTEX_HANDLE lock
Consumer lock.
Definition hid.h:757
DRIVER driver
The Driver entry for this HID Consumer.
Definition hid.h:749
hid_device_unbind_proc deviceunbind
A Device Ubind method to be called when a HID device unbind is requested by a provider (Optional).
Definition hid.h:752
hid_collection_bind_proc collectionbind
A Collection Bind method to be called when a HID collection bind is requested by a provider (Mandator...
Definition hid.h:753
HID_CONSUMER * prev
Previous entry in Consumer table.
Definition hid.h:759
hid_device_bind_proc devicebind
A Device Bind method to be called when a HID device bind is requested by a provider (Optional).
Definition hid.h:751
hid_collection_unbind_proc collectionunbind
A Collection Unbind method to be called when a HID collection unbind is requested by a provider (Mand...
Definition hid.h:754
HID_CONSUMER * next
Next entry in Consumer table.
Definition hid.h:760
Definition hid.h:797
uint8_t id
The Id of this report.
Definition hid.h:798
HID_FIELD * fields
Linked list of fields in this input, output or feature report.
Definition hid.h:801
uint8_t kind
The type of this report (Input, Output or Feature).
Definition hid.h:799
uint32_t size
The total length of this input, output or feature report in bytes (Including the Id byte).
Definition hid.h:800
HID_DEFINITION * next
The next definition in the list.
Definition hid.h:802
Definition hid.h:523
uint16_t whiddescriptorlength
Definition hid.h:530
uint8_t bnumdescriptors
Definition hid.h:528
uint16_t bcdhid
Definition hid.h:526
uint8_t bdescriptortype
Definition hid.h:525
uint8_t bhiddescriptortype
Definition hid.h:529
uint8_t blength
Definition hid.h:524
uint8_t bcountrycode
Definition hid.h:527
Definition hid.h:694
HID_DEVICE * prev
Previous entry in Device table.
Definition hid.h:727
uint32_t hidstate
HID device state (eg HID_STATE_ATTACHED).
Definition hid.h:699
MUTEX_HANDLE lock
HID device lock.
Definition hid.h:717
void * privatedata
Private data for the consumer of this HID device (If applicable).
Definition hid.h:718
HID_CONSUMER * consumer
The consumer which is bound to this device (or nil if not bound).
Definition hid.h:700
uint32_t receiveerrors
Definition hid.h:725
HID_REPORT_DESCRIPTOR * descriptor
The raw report descriptor obtained from the device.
Definition hid.h:721
HID_DEVICE * next
Next entry in Device table.
Definition hid.h:728
DEVICE device
The Device entry for this HID.
Definition hid.h:696
uint32_t descriptorsize
The size of the data pointed to by Descriptor.
Definition hid.h:722
uint32_t receivecount
Definition hid.h:724
hid_device_set_protocol_proc devicesetprotocol
A device specific SetProtocol method (If supported by provider).
Definition hid.h:710
hid_device_cancel_report_proc devicecancelreport
A device specific CancelReport method (If supported by provider).
Definition hid.h:708
hid_device_set_interval_proc devicesetinterval
A device specific SetInterval method (If supported by provider).
Definition hid.h:712
hid_device_get_physical_descriptor_set_proc devicegetphysicaldescriptorset
A device specific GetPhysicalDescriptorSet method (If supported by provider).
Definition hid.h:715
hid_device_release_report_proc devicereleasereport
A device specific ReleaseReport method (If supported by provider).
Definition hid.h:706
uint32_t hidid
Unique Id of this HID in the HID device table.
Definition hid.h:698
HID_COLLECTION * collections
The parsed report descriptor with collections, reports and usages.
Definition hid.h:719
hid_device_set_report_proc devicesetreport
A device specific SetReport method (If supported by provider).
Definition hid.h:704
hid_device_get_report_proc devicegetreport
A device specific GetReport method (If supported by provider).
Definition hid.h:703
hid_device_get_report_descriptor_proc devicegetreportdescriptor
A device specific GetReportDescriptor method (If supported by provider).
Definition hid.h:713
hid_device_get_interval_proc devicegetinterval
A device specific GetInterval method (If supported by provider).
Definition hid.h:711
hid_device_get_idle_proc devicegetidle
A device specific GetIdle method (If supported by provider).
Definition hid.h:701
hid_device_set_idle_proc devicesetidle
A device specific SetIdle method (If supported by provider).
Definition hid.h:702
hid_device_allocate_report_proc deviceallocatereport
A device specific AllocateReport method (If supported by provider).
Definition hid.h:705
hid_device_get_physical_descriptor_set0_proc devicegetphysicaldescriptorset0
A device specific GetPhysicalDescriptorSet0 method (If supported by provider).
Definition hid.h:714
hid_device_get_protocol_proc devicegetprotocol
A device specific GetProtocol method (If supported by provider).
Definition hid.h:709
uint32_t collectioncount
The number of top level collections contained in the report descriptor.
Definition hid.h:720
hid_device_submit_report_proc devicesubmitreport
A device specific SubmitReport method (If supported by provider).
Definition hid.h:707
Definition hid.h:768
int32_t maximum
The maximum value for this extent.
Definition hid.h:770
int32_t minimum
The minimum value for this extent.
Definition hid.h:769
Definition hid.h:777
uint16_t usage
The usage within the usage page.
Definition hid.h:779
double_t multiplier
The conversion multiplier for this field from logical to physical units.
Definition hid.h:788
HID_EXTENT logical
The minimum and maximum logical values for this field.
Definition hid.h:786
uint32_t flags
The flags for this field.
Definition hid.h:781
double_t resolution
The unit resolution for this field in counts per physical unit.
Definition hid.h:789
uint32_t count
The total number of sequential usages where Usage represents the minimum value or 1 for a single usag...
Definition hid.h:780
uint32_t offset
The byte offset of this field within the input, output or feature report.
Definition hid.h:784
uint16_t page
The usage page of this field.
Definition hid.h:778
uint32_t size
The length in bytes of this field within the input, output or feature report.
Definition hid.h:782
uint32_t shift
The number shift bits to access this field in the input, output or feature report.
Definition hid.h:785
HID_EXTENT physical
The minimum and maximum physical values for this field.
Definition hid.h:787
uint32_t bits
The length in bits of this field within the input, output or feature report.
Definition hid.h:783
HID_FIELD * next
The next field in the list.
Definition hid.h:790
Definition hid.h:549
uint8_t bnumber
Number of Physical Descriptor sets not including Physical Descriptor set 0.
Definition hid.h:550
uint16_t wlength
Length of each Physical descriptor set.
Definition hid.h:551
Definition hid.h:557
HID_PHYSICAL_DESCRIPTOR wphysicaldescriptor[1]
Physical descriptor data.
Definition hid.h:559
uint8_t bphysicalinfo
Bits specifying physical information (7..5 Bias / 4..0 Preference).
Definition hid.h:558
Definition hid.h:541
uint8_t bflags
Bits specifying flags (7..5 Qualifier / 4..0 Effort).
Definition hid.h:543
uint8_t bdesignator
Indicates which part of the body affects the item.
Definition hid.h:542
Definition hid.h:631
HID_COLLECTION * collection
The collection this report belongs to.
Definition hid.h:641
uint32_t sequence
The sequence of this report in all collections (First report is 0).
Definition hid.h:638
uint8_t id
The Id of this report.
Definition hid.h:632
HID_USAGE * usages
The list of usages contained in this report.
Definition hid.h:639
uint32_t flags
The main item flags for this report (eg HID_MAIN_ITEM_VARIABLE).
Definition hid.h:634
uint32_t count
The number of fields in this report.
Definition hid.h:636
uint8_t kind
The type of report (Input, Output or Feature) (eg HID_REPORT_INPUT).
Definition hid.h:633
uint32_t index
The index of this report in the collection (First report is 0).
Definition hid.h:637
uint32_t size
The number of bits per field in this report.
Definition hid.h:635
uint32_t usagecount
The number of usages contained in this report.
Definition hid.h:640
Definition hid.h:593
HID_STATE * state
Definition hid.h:594
HID_STACK * next
Definition hid.h:595
Definition hid.h:567
uint32_t reportid
Definition hid.h:585
int32_t physicalmaximum
Definition hid.h:581
BOOL delimiter
Definition hid.h:575
uint32_t stringindex
Definition hid.h:573
uint16_t usagepage
Definition hid.h:577
int32_t logicalminimum
Definition hid.h:578
int32_t physicalminimum
Definition hid.h:580
uint32_t designatorindex
Definition hid.h:571
uint32_t usage
Definition hid.h:569
uint32_t stringcount
Provides StringMinimum/StringMaximum.
Definition hid.h:574
uint32_t unitexponent
Definition hid.h:583
uint32_t reportcount
Definition hid.h:586
uint32_t unittype
Definition hid.h:582
uint32_t designatorcount
Provides DesignatorMinimum/DesignatorMaximum.
Definition hid.h:572
uint32_t reportsize
Definition hid.h:584
int32_t logicalmaximum
Definition hid.h:579
uint32_t usagecount
Provides UsageMinimum/UsageMaximum.
Definition hid.h:570
Definition hid.h:608
uint16_t usage
The usage within the usage page.
Definition hid.h:610
int32_t physicalmaximum
The physical maximum value for this usage (in Units).
Definition hid.h:620
uint32_t stringindex
The string index for this usage.
Definition hid.h:613
int32_t logicalminimum
The logical minimum value for this usage.
Definition hid.h:617
int32_t physicalminimum
The physical minimum value for this usage (in Units).
Definition hid.h:619
uint32_t aliascount
The number of aliased usages contained for this control.
Definition hid.h:624
uint32_t designatorindex
The designator index for this usage.
Definition hid.h:615
HID_USAGE * aliases
The list of aliased usages for this control (See Delimiters in Section 6.2.2.8).
Definition hid.h:623
uint32_t index
The index of this usage in the report (First usage is 0).
Definition hid.h:612
uint16_t page
The usage page this usage refers to.
Definition hid.h:609
uint32_t stringcount
The total number of sequential string index values where string index represents the minimum value or...
Definition hid.h:614
HID_REPORT * report
The report this usage belongs to.
Definition hid.h:625
uint32_t unitexponent
The unit exponent index for this usage.
Definition hid.h:622
uint32_t unittype
The unit type for this usage.
Definition hid.h:621
uint32_t designatorcount
The total number of sequential designator index values where designator index represents the minimum ...
Definition hid.h:616
uint16_t count
The total number of sequential usages where Usage represents the minimum value or 1 for a single usag...
Definition hid.h:611
int32_t logicalmaximum
The logical maximum value for this usage.
Definition hid.h:618