Difference between revisions of "Unit HID"

From Ultibo.org
Jump to: navigation, search
(Created page with "Return to Unit Reference === Description === ---- ''To be documented'' === Constants === ---- ''To be documented'' === Type definitions === ---- ''To...")
 
 
(17 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
----
 
----
  
''To be documented''
+
'''Ultibo Human Interface Device (HID) Interface unit'''
 +
 
 +
The Human Interface Device (HID) class is intended to provide a flexible model that allows a wide range of control types to be expressed using a standard set of tags in a report descriptor that each device provides during initialization.
 +
 
 +
HID devices can represent common items such as mice, keyboards, touchscreens, gamepads and joysticks but can also appear as controls within many other types of devices.
 +
 +
A headset for example will primarily be an audio device but the volume and mute buttons can be defined using the HID standard and easily recognized by software without requiring a custom driver for each and every device.
 +
 +
The Ultibo HID implementation creates an intermediate device layer that is mostly agnostic to both the bus type being used by an underlying provider (such as USB) and the devices recognized by HID consumers such as mice and keyboards.
 +
 +
A provider such as USB HID locates devices from the provider specific bus and creates HID devices to represent them along with obtaining report descriptors and other information.
 +
 +
These HID devices are then passed to registered HID consumers (drivers) to determine if they recognize the collections, reports and usages described by the device. A consumer can accept a device and bind to it during this process and create its own devices to represent the functionality described by the HID device.
 +
 +
While HID itself is intended to be bus agnostic this implementation is based heavily on the USB HID standards as those are the most widely adopted at this time. It is anticipated that HID adoption will expand over time to include a range other bus types, Bluetooth is already using HID and there are existing implementations of HID over I2C, SPI and PCI.
 +
 +
Expanding the Ultibo HID support to other bus types simply requires a new HID provider for that bus to be written along with any necessary changes or extensions to the HID layer itself.
  
 
=== Constants ===
 
=== Constants ===
 
----
 
----
  
''To be documented''
+
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HID specific constants''' <code> HID_NAME_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>HID_NAME_PREFIX = 'HID';</code>
 +
| Name prefix for HID Devices
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HID device type''' <code> HID_TYPE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>HID_TYPE_NONE = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>HID_TYPE_USB = 1;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>HID_TYPE_MAX = 1;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''HID device type name''
 +
|-
 +
|colspan="2"|<code>HID_TYPE_NAMES:array[HID_TYPE_NONE..HID_TYPE_MAX] of String = (</code>
 +
|-
 +
| <code>'HID_TYPE_NONE',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'HID_TYPE_USB');</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HID device state''' <code> HID_STATE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>HID_STATE_DETACHED = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>HID_STATE_DETACHING = 1;</code>
 +
| &nbsp;
 +
|-
 +
| <code>HID_STATE_ATTACHING = 2;</code>
 +
| &nbsp;
 +
|-
 +
| <code>HID_STATE_ATTACHED = 3;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>HID_STATE_MAX = 3;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|''HID device state name''
 +
|-
 +
|colspan="2"|<code>HID_STATE_NAMES:array[HID_STATE_DETACHED..HID_STATE_MAX] of String = (</code>
 +
|-
 +
| <code>'HID_STATE_DETACHED',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'HID_STATE_DETACHING',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'HID_STATE_ATTACHING',</code>
 +
| &nbsp;
 +
|-
 +
| <code>'HID_STATE_ATTACHED');</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HID device flag''' <code> HID_FLAG_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>HID_FLAG_NONE = $00000000;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HID interface subclass''' <code> HID_SUBCLASS_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See USB HID v1.11 specification (Section 4.2)
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>HID_SUBCLASS_NONE = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>HID_SUBCLASS_BOOT = 1;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HID interface protocol''' <code> HID_BOOT_PROTOCOL_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See USB HID v1.11 specification (Section 4.3)
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>HID_BOOT_PROTOCOL_NONE = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>HID_BOOT_PROTOCOL_KEYBOARD = 1;</code>
 +
| &nbsp;
 +
|-
 +
| <code>HID_BOOT_PROTOCOL_MOUSE = 2;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HID class descriptor''' <code> HID_DESCRIPTOR_TYPE* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See USB HID v1.11 specification (Section 7.1)
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>HID_DESCRIPTOR_TYPE_HID = $21;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>HID_DESCRIPTOR_TYPE_REPORT = $22;</code>
 +
| &nbsp;
 +
|-
 +
| <code>HID_DESCRIPTOR_TYPE_PHYSICAL_DESCRIPTOR = $23;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HID request''' <code> HID_REQUEST_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Section 7.2
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>HID_REQUEST_GET_REPORT = $01;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>HID_REQUEST_GET_IDLE = $02;</code>
 +
| &nbsp;
 +
|-
 +
| <code>HID_REQUEST_GET_PROTOCOL = $03;</code>
 +
| &nbsp;
 +
|-
 +
| <code>HID_REQUEST_SET_REPORT = $09;</code>
 +
| &nbsp;
 +
|-
 +
| <code>HID_REQUEST_SET_IDLE = $0A;</code>
 +
| &nbsp;
 +
|-
 +
| <code>HID_REQUEST_SET_PROTOCOL = $0B;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HID protocol''' <code> HID_PROTOCOL_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Section 7.2.5
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>HID_PROTOCOL_BOOT = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>HID_PROTOCOL_REPORT = 1;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HID report''' <code> HID_REPORT_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Section 7.2.1
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>HID_REPORT_INPUT = 1;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>HID_REPORT_OUTPUT = 2;</code>
 +
| &nbsp;
 +
|-
 +
| <code>HID_REPORT_FEATURE = 3;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HID report ID''' <code> HID_REPORTID_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Section 7.2.1
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>HID_REPORTID_NONE = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HID item size''' <code> HID_SIZE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Section 6.2.2.2
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>HID_SIZE_0 = (0 shl 0);</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>HID_SIZE_1 = (1 shl 0);</code>
 +
| &nbsp;
 +
|-
 +
| <code>HID_SIZE_2 = (2 shl 0);</code>
 +
| &nbsp;
 +
|-
 +
| <code>HID_SIZE_4 = (3 shl 0);</code>
 +
| &nbsp;
 +
|-
 +
| <code>HID_SIZE_MASK = $03;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HID item type''' <code> HID_TYPE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Section 6.2.2.2
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>HID_TYPE_MAIN = (0 shl 2);</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>HID_TYPE_GLOBAL = (1 shl 2);</code>
 +
| &nbsp;
 +
|-
 +
| <code>HID_TYPE_LOCAL = (2 shl 2);</code>
 +
| &nbsp;
 +
|-
 +
| <code>HID_TYPE_RESERVED = (3 shl 2);</code>
 +
| &nbsp;
 +
|-
 +
| <code>HID_TYPE_MASK = $0C;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HID main item tag''' <code> HID_TAG_MAIN_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Section 6.2.2.1 and Section 6.2.2.4
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>HID_TAG_MAIN_INPUT = $80;</code>
 +
| Input
 +
|-
 +
| <code>HID_TAG_MAIN_OUTPUT = $90;</code>
 +
| Output
 +
|-
 +
| <code>HID_TAG_MAIN_FEATURE = $B0;</code>
 +
| Feature
 +
|-
 +
| <code>HID_TAG_MAIN_COLLECTION = $A0;</code>
 +
| Collection
 +
|-
 +
| <code>HID_TAG_MAIN_END_COLLECTION = $C0;</code>
 +
| End Collection
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HID global item tag''' <code> HID_TAG_GLOBAL_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Section 6.2.2.7
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>HID_TAG_GLOBAL_USAGE_PAGE = $04;</code>
 +
| Usage Page
 +
|-
 +
| <code>HID_TAG_GLOBAL_LOGICAL_MINIMUM = $14;</code>
 +
| Logical Minimum
 +
|-
 +
| <code>HID_TAG_GLOBAL_LOGICAL_MAXIMUM = $24;</code>
 +
| Logical Maximum
 +
|-
 +
| <code>HID_TAG_GLOBAL_PHYSICAL_MINIMUM = $34;</code>
 +
| Physical Minimum
 +
|-
 +
| <code>HID_TAG_GLOBAL_PHYSICAL_MAXIMUM = $44;</code>
 +
| Physical Maximum
 +
|-
 +
| <code>HID_TAG_GLOBAL_UNIT_EXPONENT = $54;</code>
 +
| Unit Exponent
 +
|-
 +
| <code>HID_TAG_GLOBAL_UNIT = $64;</code>
 +
| Unit
 +
|-
 +
| <code>HID_TAG_GLOBAL_REPORT_SIZE = $74;</code>
 +
| Report Size
 +
|-
 +
| <code>HID_TAG_GLOBAL_REPORT_ID = $84;</code>
 +
| Report ID
 +
|-
 +
| <code>HID_TAG_GLOBAL_REPORT_COUNT = $94;</code>
 +
| Report Count
 +
|-
 +
| <code>HID_TAG_GLOBAL_PUSH = $A4;</code>
 +
| Push
 +
|-
 +
| <code>HID_TAG_GLOBAL_POP = $B4;</code>
 +
| Pop
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HID local item tag ''' <code> HID_TAG_LOCAL_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Section 6.2.2.8
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>HID_TAG_LOCAL_USAGE = $08;</code>
 +
| Usage
 +
|-
 +
| <code>HID_TAG_LOCAL_USAGE_MINIMUM = $18;</code>
 +
| Usage Minimum
 +
|-
 +
| <code>HID_TAG_LOCAL_USAGE_MAXIMUM = $28;</code>
 +
| Usage Maximum
 +
|-
 +
| <code>HID_TAG_LOCAL_DESIGNATOR_INDEX = $38;</code>
 +
| Designator Index
 +
|-
 +
| <code>HID_TAG_LOCAL_DESIGNATOR_MINIMUM = $48;</code>
 +
| Designator Minimum
 +
|-
 +
| <code>HID_TAG_LOCAL_DESIGNATOR_MAXIMUM = $58;</code>
 +
| Designator Maximum
 +
|-
 +
| <code>HID_TAG_LOCAL_STRING_INDEX = $78;</code>
 +
| String Index
 +
|-
 +
| <code>HID_TAG_LOCAL_STRING_MINIMUM = $88;</code>
 +
| String Minimum
 +
|-
 +
| <code>HID_TAG_LOCAL_STRING_MAXIMUM = $98;</code>
 +
| String Maximum
 +
|-
 +
| <code>HID_TAG_LOCAL_DELIMITER = $A8;</code>
 +
| Delimiter
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>HID_TAG_LONG  = $FC;</code>
 +
| Always HID_SIZE_2 (Followed by 1 byte DataSize / 1 byte LongItemTag / n bytes Data)
 +
|-
 +
| <code>HID_TAG_MASK = $FC;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HID main item input, ouput and feature''' <code> HID_MAIN_ITEM_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Section 6.2.2.5
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>HID_MAIN_ITEM_CONSTANT = (1 shl 0);</code>
 +
| Data (0) | Constant (1)
 +
|-
 +
| <code>HID_MAIN_ITEM_VARIABLE = (1 shl 1);</code>
 +
| Array (0) | Variable (1)
 +
|-
 +
| <code>HID_MAIN_ITEM_RELATIVE = (1 shl 2);</code>
 +
| Absolute (0) | Relative (1)
 +
|-
 +
| <code>HID_MAIN_ITEM_WRAP = (1 shl 3);</code>
 +
| No Wrap (0) | Wrap (1)
 +
|-
 +
| <code>HID_MAIN_ITEM_NON_LINEAR = (1 shl 4);</code>
 +
| Linear (0) | Non Linear (1)
 +
|-
 +
| <code>HID_MAIN_ITEM_NO_PREFERRED = (1 shl 5);</code>
 +
| Preferred State (0) | No Preferred (1)
 +
|-
 +
| <code>HID_MAIN_ITEM_NULL_STATE = (1 shl 6);</code>
 +
| No Null position (0) | Null state(1)
 +
|-
 +
| <code>HID_MAIN_ITEM_RESERVED1 = (1 shl 7);</code>
 +
| Reserved (0)
 +
|-
 +
| <code>HID_MAIN_ITEM_BUFFERED_BYTES = (1 shl 8);</code>
 +
| Bit Field (0) | Buffered Bytes (1)
 +
|-
 +
| <code>HID_MAIN_ITEM_RESERVED2 = ($FFFFFE00 shl 9);</code>
 +
| Reserved (0)
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HID main item collection''' <code> HID_MAIN_COLLECTION_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Section 6.2.2.6
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>HID_MAIN_COLLECTION_PHYSICAL = $00;</code>
 +
| Physical (Group of axes)
 +
|-
 +
| <code>HID_MAIN_COLLECTION_APPLICATION = $01;</code>
 +
| Application (Mouse, Keyboard)
 +
|-
 +
| <code>HID_MAIN_COLLECTION_LOGICAL = $02;</code>
 +
| Logical (Interrelated data)
 +
|-
 +
| <code>HID_MAIN_COLLECTION_REPORT = $03;</code>
 +
| Report
 +
|-
 +
| <code>HID_MAIN_COLLECTION_NAMED_ARRAY = $04;</code>
 +
| Named Array
 +
|-
 +
| <code>HID_MAIN_COLLECTION_USAGE_SWITCH = $05;</code>
 +
| Usage Switch
 +
|-
 +
| <code>HID_MAIN_COLLECTION_USAGE_MODIFIER = $06;</code>
 +
| Usage Modifier
 +
|-
 +
|colspan="2"|''0x07 to 0x7F Reserved''
 +
|-
 +
|colspan="2"|''0x80 to 0xFF Vendor Defined''
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HID global item unit''' <code> HID_GLOBAL_UNIT_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Section 6.2.2.7 For more information see https://physics.nist.gov/cuu/Units/units.html
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>HID_GLOBAL_UNIT_SYSTEM_MASK = $F;</code>
 +
| System of Measurement
 +
|-
 +
| <code>HID_GLOBAL_UNIT_SYSTEM_SHIFT = 0;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>HID_GLOBAL_UNIT_SYSTEM_NONE = 0;</code>
 +
| &nbsp;
 +
|-
 +
| <code>HID_GLOBAL_UNIT_SYSTEM_SI_LINEAR = 1;</code>
 +
| SI linear unit
 +
|-
 +
| <code>HID_GLOBAL_UNIT_SYSTEM_SI_ROTATION = 2;</code>
 +
| SI rotational units
 +
|-
 +
| <code>HID_GLOBAL_UNIT_SYSTEM_ENGLISH_LINEAR = 3;</code>
 +
| English (Imperial) linear units
 +
|-
 +
| <code>HID_GLOBAL_UNIT_SYSTEM_ENGLISH_ROTATION = 4;</code>
 +
| English (Imperial) rotational units
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>HID_GLOBAL_UNIT_LENGTH_MASK = $F;</code>
 +
| Length (Centimeters in SI, Inches in English)
 +
|-
 +
| <code>HID_GLOBAL_UNIT_LENGTH_SHIFT = 4;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>HID_GLOBAL_UNIT_ROTATION_MASK = $F;</code>
 +
| Rotation (Radians in SI, Degrees in English)
 +
|-
 +
| <code>HID_GLOBAL_UNIT_ROTATION_SHIFT = 4;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>HID_GLOBAL_UNIT_MASS_MASK = $F;</code>
 +
| Mass (Grams in SI, Slugs in English)
 +
|-
 +
| <code>HID_GLOBAL_UNIT_MASS_SHIFT = 8;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>HID_GLOBAL_UNIT_TIME_MASK = $F;</code>
 +
| Time (Seconds)
 +
|-
 +
| <code>HID_GLOBAL_UNIT_TIME_SHIFT = 12;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>HID_GLOBAL_UNIT_TEMPERATURE_MASK = $F;</code>
 +
| Temperature (Kelvin in SI, Fahrenheit in English)
 +
|-
 +
| <code>HID_GLOBAL_UNIT_TEMPERATURE_SHIFT = 16;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>HID_GLOBAL_UNIT_CURRENT_MASK = $F;</code>
 +
| Current (Amperes)
 +
|-
 +
| <code>HID_GLOBAL_UNIT_CURRENT_SHIFT = 20;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>HID_GLOBAL_UNIT_LIGHT_MASK = $F;</code>
 +
| Luminous Intensity (Candelas)
 +
|-
 +
| <code>HID_GLOBAL_UNIT_LIGHT_SHIFT = 24;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|Common HID Global Item Unit Value
 +
|-
 +
|colspan="2"|For a more detailed list see the k.0UNIT definitions in https://github.com/abend0c1/hidrdd/blob/master/rd.rex
 +
|-
 +
|colspan="2"|''SI Base Units''
 +
|-
 +
| <code>HID_GLOBAL_UNIT_SI_ROTATION = $00000012;</code>
 +
| Rotation (Radians)
 +
|-
 +
| <code>HID_GLOBAL_UNIT_SI_LENGTH = $00000011;</code>
 +
| Length (Centimeters)
 +
|-
 +
| <code>HID_GLOBAL_UNIT_SI_MASS = $00000101;</code>
 +
| Mass (Grams)
 +
|-
 +
| <code>HID_GLOBAL_UNIT_SI_TIME = $00001001;</code>
 +
| Time (Seconds)
 +
|-
 +
| <code>HID_GLOBAL_UNIT_SI_TEMPERATURE = $00010001;</code>
 +
| Temperature (Kelvin)
 +
|-
 +
| <code>HID_GLOBAL_UNIT_SI_CURRENT = $00100001;</code>
 +
| Current (Amperes)
 +
|-
 +
| <code>HID_GLOBAL_UNIT_SI_LIGHT = $01000001;</code>
 +
| Luminous Intensity (Candelas)
 +
|-
 +
|colspan="2"|''SI Derived Unit''
 +
|-
 +
| <code>HID_GLOBAL_UNIT_SI_AREA = $00000021;</code>
 +
| Area (Square Centimeters)
 +
|-
 +
| <code>HID_GLOBAL_UNIT_SI_VOLUME = $00000031;</code>
 +
| Volume (Cubic Centimeters)
 +
|-
 +
| <code>HID_GLOBAL_UNIT_SI_VELOCITY = $0000F011;</code>
 +
| Velocity (Centimeters per second)
 +
|-
 +
| <code>HID_GLOBAL_UNIT_SI_ACCELERATION = $0000E011;</code>
 +
| Acceleration (Centimeters per second squared)
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>HID_GLOBAL_UNIT_SI_FREQUENCY = $0000F001;</code>
 +
| Frequency (Hertz)
 +
|-
 +
| <code>HID_GLOBAL_UNIT_SI_FORCE = $0000E111;</code>
 +
| Force (Newtons)
 +
|-
 +
| <code>HID_GLOBAL_UNIT_SI_PRESSURE = $0000E1F1;</code>
 +
| Pressure (Pascals)
 +
|-
 +
| <code>HID_GLOBAL_UNIT_SI_ENERGY = $0000E121;</code>
 +
| Energy (Joules)
 +
|-
 +
| <code>HID_GLOBAL_UNIT_SI_POWER = $0000D121;</code>
 +
| Power (Watts)
 +
|-
 +
|colspan="2"|''English Base Unit''
 +
|-
 +
| <code>HID_GLOBAL_UNIT_ENGLISH_ROTATION = $00000014;</code>
 +
| Rotation (Degrees)
 +
|-
 +
| <code>HID_GLOBAL_UNIT_ENGLISH_LENGTH = $00000013;</code>
 +
| Length (Inches)
 +
|-
 +
| <code>HID_GLOBAL_UNIT_ENGLISH_TIME = $00001003;</code>
 +
| Time (Seconds)
 +
|-
 +
| <code>HID_GLOBAL_UNIT_ENGLISH_TEMPERATURE = $00010003;</code>
 +
| Temperature (Fahrenheit)
 +
|-
 +
| <code>HID_GLOBAL_UNIT_ENGLISH_CURRENT = $00100003;</code>
 +
| Current (Amperes)
 +
|-
 +
| <code>HID_GLOBAL_UNIT_ENGLISH_LIGHT = $01000003;</code>
 +
| Luminous Intensity (Candelas)
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>HID_GLOBAL_UNIT_ENGLISH_AREA = $00000023;</code>
 +
| Area (Square Inches)
 +
|-
 +
| <code>HID_GLOBAL_UNIT_ENGLISH_VOLUME = $00000033;</code>
 +
| Volume (Cubic Inches)
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|HID Global Item Unit Exponent Values
 +
|-
 +
|colspan="2"|See Section 6.2.2.7
 +
|-
 +
|colspan="2"|HID_GLOBAL_UNIT_EXPONENTS:array[$0..$F] of LongInt = (
 +
|-
 +
| <code>0,</code>
 +
| &nbsp;
 +
|-
 +
| <code>1,</code>
 +
| &nbsp;
 +
|-
 +
| <code>2,</code>
 +
| &nbsp;
 +
|-
 +
| <code>3,</code>
 +
| &nbsp;
 +
|-
 +
| <code>4,</code>
 +
| &nbsp;
 +
|-
 +
| <code>5,</code>
 +
| &nbsp;
 +
|-
 +
| <code>6,</code>
 +
| &nbsp;
 +
|-
 +
| <code>7,</code>
 +
| &nbsp;
 +
|-
 +
| <code>-8,</code>
 +
| &nbsp;
 +
|-
 +
| <code>-7,</code>
 +
| &nbsp;
 +
|-
 +
| <code>-6,</code>
 +
| &nbsp;
 +
|-
 +
| <code>-5,</code>
 +
| &nbsp;
 +
|-
 +
| <code>-4,</code>
 +
| &nbsp;
 +
|-
 +
| <code>-3,</code>
 +
| &nbsp;
 +
|-
 +
| <code>-2,</code>
 +
| &nbsp;
 +
|-
 +
| <code>-1);</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
|colspan="2"|HID_GLOBAL_UNIT_MULTIPLIERS:array[$0..$F] of Double = (
 +
|-
 +
| <code>1,</code>
 +
| 10^0
 +
|-
 +
| <code>10,</code>
 +
| 10^1
 +
|-
 +
| <code>100,</code>
 +
| 10^2
 +
|-
 +
| <code>1000,</code>
 +
| 10^3
 +
|-
 +
| <code>10000,</code>
 +
| 10^4
 +
|-
 +
| <code>100000,</code>
 +
| 10^5
 +
|-
 +
| <code>1000000,</code>
 +
| 10^6
 +
|-
 +
| <code>10000000,</code>
 +
| 10^7
 +
|-
 +
| <code>0.00000001,</code>
 +
| 10^-8
 +
|-
 +
| <code>0.0000001,</code>
 +
| 10^-7
 +
|-
 +
| <code>0.000001,</code>
 +
| 10^-6
 +
|-
 +
| <code>0.00001,</code>
 +
| 10^-5
 +
|-
 +
| <code>0.0001,</code>
 +
| 10^-4
 +
|-
 +
| <code>0.001,</code>
 +
| 10^-3
 +
|-
 +
| <code>0.01,</code>
 +
| 10^-2
 +
|-
 +
| <code>0.1);</code>
 +
| 10^-1
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HID local item delimiter''' <code> HID_LOCAL_DELIMITER_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Section 6.2.2.8
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>HID_LOCAL_DELIMITER_CLOSE = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>HID_LOCAL_DELIMITER_OPEN = 1;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HID physical descriptor bias''' <code> HID_PHYSICAL_BIAS_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Section 6.2.3
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>HID_PHYSICAL_BIAS_NONE = (0 shl 5);</code>
 +
| Not applicable
 +
|-
 +
| <code>HID_PHYSICAL_BIAS_RIGHT_HAND = (1 shl 5);</code>
 +
| Right hand
 +
|-
 +
| <code>HID_PHYSICAL_BIAS_LEFT_HAND = (2 shl 5);</code>
 +
| Left hand
 +
|-
 +
| <code>HID_PHYSICAL_BIAS_BOTH_HANDS = (3 shl 5);</code>
 +
| Both hands
 +
|-
 +
| <code>HID_PHYSICAL_BIAS_EITHER_HAND = (4 shl 5);</code>
 +
| Either hand
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HID physical descriptor designator ''' <code> HID_PHYSICAL_DESIGNATOR_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Section 6.2.3
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_NONE = $00;</code>
 +
| None
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_HAND = $01;</code>
 +
| Hand
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_EYEBALL = $02;</code>
 +
| Eyeball
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_EYEBROW = $03;</code>
 +
| Eyebrow
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_EYELID = $04;</code>
 +
| Eyelid
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_EAR = $05;</code>
 +
| Ear
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_NOSE = $06;</code>
 +
| Nose
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_MOUTH = $07;</code>
 +
| Mouth
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_UPPER_LIP = $08;</code>
 +
| Upper lip
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_LOWER_LIP = $09;</code>
 +
| Lower lip
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_JAW = $0A;</code>
 +
| Jaw
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_NECK = $0B;</code>
 +
| Neck
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_UPPER_ARM = $0C;</code>
 +
| Upper arm
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_ELBOW = $0D;</code>
 +
| Elbow
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_FOREARM = $0E;</code>
 +
| Forearm
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_WRIST = $0F;</code>
 +
| Wrist
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_PALM = $10;</code>
 +
| Palm
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_THUMB = $11;</code>
 +
| Thumb
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_INDEX_FINGER = $12;</code>
 +
| Index finger
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_MIDDLE_FINGER = $13;</code>
 +
| Middle finger
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_RING_FINGER = $14;</code>
 +
| Ring finger
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_LITTLE_FINGER = $15;</code>
 +
| Little finger
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_HEAD = $16;</code>
 +
| Head
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_SHOULDER = $17;</code>
 +
| Shoulder
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_HIP = $18;</code>
 +
| Hip
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_WAIST = $19;</code>
 +
| Waist
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_THIGH = $1A;</code>
 +
| Thigh
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_KNEE = $1B;</code>
 +
| Knee
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_CALF = $1C;</code>
 +
| Calf
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_ANKLE = $1D;</code>
 +
| Ankle
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_FOOT = $1E;</code>
 +
| Foot
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_HEEL = $1F;</code>
 +
| Heel
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_BALL_OF_FOOT = $20;</code>
 +
| Ball of foot
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_BIG_TOE = $21;</code>
 +
| Big toe
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_SECOND_TOE = $22;</code>
 +
| Second toe
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_THIRD_TOE = $23;</code>
 +
| Third toe
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_FOURTH_TOE = $24;</code>
 +
| Fourth toe
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_LITTLE_TOE = $25;</code>
 +
| Little toe
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_BROW = $26;</code>
 +
| Brow
 +
|-
 +
| <code>HID_PHYSICAL_DESIGNATOR_CHEEK = $27;</code>
 +
| Cheek
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HID physical descriptor qualifier''' <code> HID_PHYSICAL_QUALIFIER_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Section 6.2.3
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>HID_PHYSICAL_QUALIFIER_NONE = (0 shl 5);</code>
 +
| Not applicable
 +
|-
 +
| <code>HID_PHYSICAL_QUALIFIER_RIGHT = (1 shl 5);</code>
 +
| Right
 +
|-
 +
| <code>HID_PHYSICAL_QUALIFIER_LEFT = (2 shl 5);</code>
 +
| Left
 +
|-
 +
| <code>HID_PHYSICAL_QUALIFIER_BOTH = (3 shl 5);</code>
 +
| Both
 +
|-
 +
| <code>HID_PHYSICAL_QUALIFIER_EITHER = (4 shl 5);</code>
 +
| Either
 +
|-
 +
| <code>HID_PHYSICAL_QUALIFIER_CENTER = (5 shl 5);</code>
 +
| Center
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HID usage page''' <code> HID_PAGE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See HID Usage Tables 1.3
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>HID_PAGE_UNDEFINED = $00;</code>
 +
| Undefined
 +
|-
 +
| <code>HID_PAGE_GENERIC_DESKTOP = $01;</code>
 +
| Generic Desktop Page
 +
|-
 +
| <code>HID_PAGE_SIMULATION_CONTROLS = $02;</code>
 +
| Simulation Controls Page
 +
|-
 +
| <code>HID_PAGE_VR_CONTROLS = $03;</code>
 +
| VR Controls Page
 +
|-
 +
| <code>HID_PAGE_SPORT_CONTROLS = $04;</code>
 +
| Sport Controls Page
 +
|-
 +
| <code>HID_PAGE_GAME_CONTROLS = $05;</code>
 +
| Game Controls Page
 +
|-
 +
| <code>HID_PAGE_GENERIC_DEVICE_CONTROLS = $06;</code>
 +
| Generic Device Controls Page
 +
|-
 +
| <code>HID_PAGE_KEYBOARD_KEYPAD = $07;</code>
 +
| Keyboard/Keypad Page
 +
|-
 +
| <code>HID_PAGE_LED = $08;</code>
 +
| LED Page
 +
|-
 +
| <code>HID_PAGE_BUTTON = $09;</code>
 +
| Button Page
 +
|-
 +
| <code>HID_PAGE_ORDINAL = $0A;</code>
 +
| Ordinal Page
 +
|-
 +
| <code>HID_PAGE_TELEPHONY_DEVICE = $0B;</code>
 +
| Telephony Device Page
 +
|-
 +
| <code>HID_PAGE_CONSUMER = $0C;</code>
 +
| Consumer Page
 +
|-
 +
| <code>HID_PAGE_DIGITIZERS = $0D;</code>
 +
| Digitizers Page
 +
|-
 +
| <code>HID_PAGE_HAPTICS = $0E;</code>
 +
| Haptics Page
 +
|-
 +
| <code>HID_PAGE_PHYSICAL_INPUT_DEVICE = $0F;</code>
 +
| Physical Input Device Page
 +
|-
 +
| <code>HID_PAGE_UNICODE = $10;</code>
 +
| Unicode Page
 +
|-
 +
|colspan="2"|''0x11-0x11 Reserved''
 +
|-
 +
| <code>HID_PAGE_EYE_AND_HEAD_TRACKERS = $12;</code>
 +
| Eye and Head Trackers Page
 +
|-
 +
|colspan="2"|''0x13-0x13 Reserved''
 +
|-
 +
| <code>HID_PAGE_AUXILIARY_DISPLAY = $14;</code>
 +
| Auxiliary Display Page
 +
|-
 +
|colspan="2"|''0x15-0x1F Reserved''
 +
|-
 +
| <code>HID_PAGE_SENSORS = $20;</code>
 +
| Sensors Page
 +
|-
 +
|colspan="2"|''0x21-0x3F Reserved''
 +
|-
 +
| <code>HID_PAGE_MEDICAL_INSTRUMENT = $40;</code>
 +
| Medical Instrument Page
 +
|-
 +
| <code>HID_PAGE_BRAILLE_DISPLAY = $41;</code>
 +
| Braille Display Page
 +
|-
 +
|colspan="2"|''0x42-0x58 Reserved''
 +
|-
 +
| <code>HID_PAGE_LIGHTING_AND_ILLUMINATION = $59;</code>
 +
| Lighting And Illumination Page
 +
|-
 +
|colspan="2"|''0x5A-0x7F Reserved''
 +
|-
 +
| <code>HID_PAGE_MONITOR = $80;</code>
 +
| Monitor Page
 +
|-
 +
| <code>HID_PAGE_MONITOR_ENUMERATED = $81;</code>
 +
| Monitor Enumerated Page
 +
|-
 +
| <code>HID_PAGE_VESA_VIRTUAL_CONTROLS = $82;</code>
 +
| VESA Virtual Controls Page
 +
|-
 +
|colspan="2"|''0x83-0x83 Reserved''
 +
|-
 +
| <code>HID_PAGE_POWER = $84;</code>
 +
| Power Page
 +
|-
 +
| <code>HID_PAGE_BATTERY_SYSTEM = $85;</code>
 +
| Battery System Page
 +
|-
 +
|colspan="2"|''0x86-0x8B Reserved''
 +
|-
 +
| <code>HID_PAGE_BARCODE_SCANNER = $8C;</code>
 +
| Barcode Scanner Page
 +
|-
 +
| <code>HID_PAGE_SCALES = $8D;</code>
 +
| Scales Page
 +
|-
 +
| <code>HID_PAGE_MAGNETIC_STRIPE_READER = $8E;</code>
 +
| Magnetic Stripe Reader Page
 +
|-
 +
|colspan="2"|''0x8F-0x8F Reserved''
 +
|-
 +
| <code>HID_PAGE_CAMERA_CONTROL = $90;</code>
 +
| Camera Control Page
 +
|-
 +
| <code>HID_PAGE_ARCADE = $91;</code>
 +
| Arcade Page
 +
|-
 +
| <code>HID_PAGE_GAMING_DEVICE = $92;</code>
 +
| Gaming Device Page
 +
|-
 +
|colspan="2"|''0x93-0xF1CF Reserved
 +
|-
 +
| <code>HID_PAGE_FIDO_ALLIANCE = $F1D0;</code>
 +
| FIDO Alliance Page
 +
|-
 +
|colspan="2"|''0xF1D1-0xFEFF Reserved''
 +
|-
 +
|colspan="2"|''0xFF00-0xFFFF Vendor-defined''
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HID usage table''' <code> HID_DESKTOP_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See HID Usage Tables 1.3)
 +
|-
 +
|colspan="2"|HID Generic Desktop Page (Partial)
 +
|-
 +
| <code>HID_DESKTOP_UNDEFINED = $00;</code>
 +
| Undefined
 +
|-
 +
| <code>HID_DESKTOP_POINTER = $01;</code>
 +
| Pointer
 +
|-
 +
| <code>HID_DESKTOP_MOUSE = $02;</code>
 +
| Mouse
 +
|-
 +
|colspan="2"|''0x03-0x03 Reserved''
 +
|-
 +
| <code>HID_DESKTOP_JOYSTICK = $04;</code>
 +
| Joystick
 +
|-
 +
| <code>HID_DESKTOP_GAMEPAD = $05;</code>
 +
| Gamepad
 +
|-
 +
| <code>HID_DESKTOP_KEYBOARD = $06;</code>
 +
| Keyboard
 +
|-
 +
| <code>HID_DESKTOP_KEYPAD = $07;</code>
 +
| Keypad
 +
|-
 +
| <code>HID_DESKTOP_MULTI_AXIS_CONTROLLER = $08;</code>
 +
| Multi-axis Controller
 +
|-
 +
| <code>HID_DESKTOP_TABLET_PC_SYSTEM_CONTROLS = $09;</code>
 +
| Tablet PC System Controls
 +
|-
 +
| <code>HID_DESKTOP_WATER_COOLING_DEVICE = $0A;</code>
 +
| Water Cooling Device
 +
|-
 +
| <code>HID_ID_DESKTOP_COMPUTER_CHASSIS_DEVICE = $0B;</code>
 +
| Computer Chassis Device
 +
|-
 +
| <code>HHID_DESKTOP_WIRELESS_RADIO_CONTROLS = $0C;</code>
 +
| Wireless Radio Controls
 +
|-
 +
| <code>HID_DESKTOP_PORTABLE_DEVICE_CONTROL = $0D;</code>
 +
| Portable Device Control
 +
|-
 +
| <code>HID_DESKTOP_SYSTEM_MULTI_AXIS_CONTROLLER = $0E;</code>
 +
| System Multi-Axis Controller
 +
|-
 +
| <code>HID_DESKTOP_SPATIAL_CONTROLLER = $0F;</code>
 +
| Spatial Controller
 +
|-
 +
| <code>HID_DESKTOP_ASSISTIVE_CONTROL = $10;</code>
 +
| Assistive Control
 +
|-
 +
| <code>HID_DESKTOP_DEVICE_DOCK = $11;</code>
 +
| Device Dock
 +
|-
 +
| <code>HID_DESKTOP_DOCKABLE_DEVICE = $12;</code>
 +
| Dockable Device
 +
|-
 +
| <code>HID_DESKTOP_CALL_STATE_MANAGEMENT_CONTROL = $13;</code>
 +
| Call State Management Control
 +
|-
 +
|colspan="2"|''0x14-0x2F Reserved''
 +
|-
 +
| <code>HID_DESKTOP_X = $30;</code>
 +
| X
 +
|-
 +
| <code>HID_DESKTOP_Y = $31;</code>
 +
| Y
 +
|-
 +
| <code>HID_DESKTOP_Z = $32;</code>
 +
| Z
 +
|-
 +
| <code>HID_DESKTOP_RX = $33;</code>
 +
| Rx
 +
|-
 +
| <code>HID_DESKTOP_RY = $34;</code>
 +
| Ry
 +
|-
 +
| <code>HID_DESKTOP_RZ = $35;</code>
 +
| Rz
 +
|-
 +
| <code>HID_DESKTOP_SLIDER = $36;</code>
 +
| Slider
 +
|-
 +
| <code>HID_DESKTOP_DIAL = $37;</code>
 +
| Dial
 +
|-
 +
| <code>HID_DESKTOP_WHEEL = $38;</code>
 +
| Wheel
 +
|-
 +
| <code>HID_DESKTOP_HAT_SWITCH = $39;</code>
 +
| Hat Switch
 +
|-
 +
| <code>HID_DESKTOP_COUNTED_BUFFER = $3A;</code>
 +
| Counted Buffer
 +
|-
 +
| <code>HID_DESKTOP_BYTE_COUNT = $3B;</code>
 +
| Byte Count
 +
|-
 +
| <code>HID_DESKTOP_MOTION_WAKEUP = $3C;</code>
 +
| Motion Wakeup
 +
|-
 +
| <code>HID_DESKTOP_START = $3D;</code>
 +
| Start
 +
|-
 +
| <code>HID_DESKTOP_SELECT = $3E;</code>
 +
| Select
 +
|-
 +
|colspan="2"|''0x3F-0x3F Reserved
 +
|-
 +
| <code>HID_DESKTOP_VX = $40;</code>
 +
| Vx
 +
|-
 +
| <code>HID_DESKTOP_VY = $41;</code>
 +
| Vy
 +
|-
 +
| <code>HID_DESKTOP_VZ = $42;</code>
 +
| Vz
 +
|-
 +
| <code>HID_DESKTOP_VBRX = $43;</code>
 +
| Vbrx
 +
|-
 +
| <code>HID_DESKTOP_VBRY = $44;</code>
 +
| Vbry
 +
|-
 +
| <code>HID_DESKTOP_VBRZ = $45;</code>
 +
| Vbrz
 +
|-
 +
| <code>HID_DESKTOP_VNO = $46;</code>
 +
| Vno
 +
|-
 +
| <code>HID_DESKTOP_FEATURE_NOTIFICATION = $47;</code>
 +
| Feature Notification
 +
|-
 +
| <code>HID_DESKTOP_RESOLUTION_MULTIPLIER = $48;</code>
 +
| Resolution Multiplier
 +
|-
 +
| <code>HID_DESKTOP_QX = $49;</code>
 +
| Qx
 +
|-
 +
| <code>HID_DESKTOP_QY = $4A;</code>
 +
| Qy
 +
|-
 +
| <code>HID_DESKTOP_QZ = $4B;</code>
 +
| Qz
 +
|-
 +
| <code>HID_DESKTOP_QW = $4C;</code>
 +
| Qw
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HID keyboard/keypad''' <code> SCAN_CODE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: These are the same as the SCAN_CODE_* values in GlobalConst
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HID LED (Partial)''' <code> HID_LED_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>HID_LED_UNDEFINED = 00;</code>
 +
| Undefined
 +
|-
 +
| <code>HID_LED_NUM_LOCK = 01;</code>
 +
| Num Lock
 +
|-
 +
| <code>HID_LED_CAPS_LOCK = 02;</code>
 +
| Caps Lock
 +
|-
 +
| <code>HID_LED_SCROLL_LOCK = 03;</code>
 +
| Scroll Lock
 +
|-
 +
| <code>HID_LED_COMPOSE = 04;</code>
 +
| Compose
 +
|-
 +
| <code>HID_LED_KANA = 05;</code>
 +
| Kana
 +
|-
 +
| <code>HID_LED_POWER = 06;</code>
 +
| Power
 +
|-
 +
| <code>HID_LED_SHIFT = 07;</code>
 +
| Shift
 +
|-
 +
| <code>HID_LED_DO_NOT_DISTURB = 08;</code>
 +
| Do Not Disturb
 +
|-
 +
| <code>HID_LED_MUTE = 09;</code>
 +
| Mute
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HID button (Partial)''' <code> HID_BUTTON_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>HID_BUTTON_NONE = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>HID_BUTTON_1 = 1;</code>
 +
| &nbsp;
 +
|-
 +
| <code>HID_BUTTON_2 = 2;</code>
 +
| &nbsp;
 +
|-
 +
| <code>HID_BUTTON_3 = 3;</code>
 +
| &nbsp;
 +
|-
 +
| <code>HID_BUTTON_4 = 4;</code>
 +
| &nbsp;
 +
|-
 +
| <code>HID_BUTTON_5 = 5;</code>
 +
| &nbsp;
 +
|-
 +
| <code>HID_BUTTON_PRIMARY = HID_BUTTON_1;</code>
 +
| &nbsp;
 +
|-
 +
| <code>HID_BUTTON_SECONDARY = HID_BUTTON_2;</code>
 +
| &nbsp;
 +
|-
 +
| <code>HID_BUTTON_TERTIARY = HID_BUTTON_3;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|Note: Buttons are defined as Button 1 to Button 65535
 +
|-
 +
| <code>HID_BUTTON_65535 = $FFFF;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HID digitizers (Partial)''' <code> HID_DIGITIZERS_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>HID_DIGITIZERS_UNDEFINED = $00;</code>
 +
| Undefined
 +
|-
 +
| <code>HID_DIGITIZERS_DIGITIZER = $01;</code>
 +
| Digitizer
 +
|-
 +
| <code>HID_DIGITIZERS_PEN = $02;</code>
 +
| Pen
 +
|-
 +
| <code>HID_DIGITIZERS_LIGHT_PEN = $03;</code>
 +
| Light Pen
 +
|-
 +
| <code>HID_DIGITIZERS_TOUCH_SCREEN = $04;</code>
 +
| Touch Screen
 +
|-
 +
| <code>HID_DIGITIZERS_TOUCH_PAD = $05;</code>
 +
| Touch Pad
 +
|-
 +
| <code>HID_DIGITIZERS_WHITEBOARD = $06;</code>
 +
| Whiteboard
 +
|-
 +
| <code>HID_DIGITIZERS_COORD_MEASURING = $07;</code>
 +
| Coordinate Measuring Machine
 +
|-
 +
| <code>HID_DIGITIZERS_3D_DIGITIZER = $08;</code>
 +
| 3D Digitizer
 +
|-
 +
| <code>HID_DIGITIZERS_STEREO_PLOTTER = $09;</code>
 +
| Stereo Plotter
 +
|-
 +
| <code>HID_DIGITIZERS_ARTICULATED_ARM = $0A;</code>
 +
| Articulated Arm
 +
|-
 +
| <code>HID_DIGITIZERS_ARMATURE = $0B;</code>
 +
| Armature
 +
|-
 +
| <code>HID_DIGITIZERS_MULTI_POINT_DIGITIZER = $0C;</code>
 +
| Multiple Point Digitizer
 +
|-
 +
| <code>HID_DIGITIZERS_FREE_SPACE_WAND = $0D;</code>
 +
| Free Space Wand
 +
|-
 +
| <code>HID_DIGITIZERS_DEVICE_CONFIGURATION = $0E;</code>
 +
| Device Configuration
 +
|-
 +
| <code>HID_DIGITIZERS_CAPACITIVE_HEAT_MAP = $0F;</code>
 +
| Capacitive Heat Map Digitizer
 +
|-
 +
|colspan="2"|''0x10-0x1F Reserved''
 +
|-
 +
| <code>HID_DIGITIZERS_STYLUS = $20;</code>
 +
| Stylus
 +
|-
 +
| <code>HID_DIGITIZERS_PUCK = $21;</code>
 +
| Puck
 +
|-
 +
| <code>HID_DIGITIZERS_FINGER = $22;</code>
 +
| Finger
 +
|-
 +
| <code>HID_DIGITIZERS_DEVICE_SETTINGS = $23;</code>
 +
| Device settings
 +
|-
 +
| <code>HID_DIGITIZERS_CHARACTER_GESTURE = $24;</code>
 +
| Character Gesture
 +
|-
 +
|colspan="2"|''0x25-0x2F Reserved''
 +
|-
 +
| <code>HID_DIGITIZERS_TIP_PRESSURE = $30;</code>
 +
| Tip Pressure
 +
|-
 +
| <code>HID_DIGITIZERS_BARREL_PRESSURE = $31;</code>
 +
| Barrel Pressure
 +
|-
 +
| <code>HID_DIGITIZERS_IN_RANGE = $32;</code>
 +
| In Range
 +
|-
 +
| <code>HID_DIGITIZERS_TOUCH = $33;</code>
 +
| Touch
 +
|-
 +
| <code>HID_DIGITIZERS_UNTOUCH = $34;</code>
 +
| Untouch
 +
|-
 +
| <code>HID_DIGITIZERS_TAP = $35;</code>
 +
| Tap
 +
|-
 +
| <code>HID_DIGITIZERS_QUALITY = $36;</code>
 +
| Quality
 +
|-
 +
| <code>HID_DIGITIZERS_DATA_VALID = $37;</code>
 +
| Data Valid
 +
|-
 +
| <code>HID_DIGITIZERS_TRANSDUCER_INDEX = $38;</code>
 +
| Transducer Index
 +
|-
 +
| <code>HID_DIGITIZERS_TABLET_FUNCTION_KEYS = $39;</code>
 +
| Tablet Function Keys
 +
|-
 +
| <code>HID_DIGITIZERS_PROGRAM_CHANGE_KEYS = $3A;</code>
 +
| Program Change Keys
 +
|-
 +
| <code>HID_DIGITIZERS_BATTERY_STRENGTH = $3B;</code>
 +
| Battery Strength
 +
|-
 +
| <code>HID_DIGITIZERS_INVERT = $3C;</code>
 +
| Invert
 +
|-
 +
| <code>HID_DIGITIZERS_X_TILT = $3D;</code>
 +
| X Tilt
 +
|-
 +
| <code>HID_DIGITIZERS_Y_TILT = $3E;</code>
 +
| Y Tilt
 +
|-
 +
| <code>HID_DIGITIZERS_AZIMUTH = $3F;</code>
 +
| Azimuth
 +
|-
 +
| <code>HID_DIGITIZERS_ALTITUDE = $40;</code>
 +
| Altitude
 +
|-
 +
| <code>HID_DIGITIZERS_TWIST = $41;</code>
 +
| Twist
 +
|-
 +
| <code>HID_DIGITIZERS_TIP_SWITCH = $42;</code>
 +
| Tip Switch
 +
|-
 +
| <code>HID_DIGITIZERS_SECONDARY_TIP_SWITCH = $43;</code>
 +
| Secondary Tip Switch
 +
|-
 +
| <code>HID_DIGITIZERS_BARREL_SWITCH = $44;</code>
 +
| Barrel Switch
 +
|-
 +
| <code>HID_DIGITIZERS_ERASER = $45;</code>
 +
| Eraser
 +
|-
 +
| <code>HID_DIGITIZERS_TABLET_PICK = $46;</code>
 +
| Tablet Pick
 +
|-
 +
| <code>HID_DIGITIZERS_TOUCH_VALID = $47;</code>
 +
| Touch Valid (Confidence)
 +
|-
 +
| <code>HID_DIGITIZERS_WIDTH = $48;</code>
 +
| Width
 +
|-
 +
| <code>HID_DIGITIZERS_HEIGHT = $49;</code>
 +
| Height
 +
|-
 +
|colspan="2"|''0x4A-0x50 Reserved''
 +
|-
 +
| <code>HID_DIGITIZERS_CONTACT_IDENTIFIER = $51;</code>
 +
| Contact Identifier
 +
|-
 +
| <code>HID_DIGITIZERS_DEVICE_MODE = $52;</code>
 +
| Device Mode
 +
|-
 +
| <code>HID_DIGITIZERS_DEVICE_IDENTIFIER = $53;</code>
 +
| Device Identifier
 +
|-
 +
| <code>HID_DIGITIZERS_CONTACT_COUNT = $54;</code>
 +
| Contact Count
 +
|-
 +
| <code>HID_DIGITIZERS_CONTACT_COUNT_MAXIMUM = $55;</code>
 +
| Contact Count Maximum
 +
|-
 +
| <code>HID_DIGITIZERS_SCAN_TIME = $56;</code>
 +
| Scan Time
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HID logging''' <code> HID_LOG_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>HID_LOG_LEVEL_DEBUG = LOG_LEVEL_DEBUG;</code>
 +
| HID debugging messages
 +
|-
 +
| <code>HID_LOG_LEVEL_INFO = LOG_LEVEL_INFO;</code>
 +
| HID informational messages, such as a device being attached or detached.
 +
|-
 +
| <code>HID_LOG_LEVEL_WARN = LOG_LEVEL_WARN;</code>
 +
| HID warning messages
 +
|-
 +
| <code>HID_LOG_LEVEL_ERROR = LOG_LEVEL_ERROR;</code>
 +
| HID error messages
 +
|-
 +
| <code>HID_LOG_LEVEL_NONE = LOG_LEVEL_NONE;</code>
 +
| No HID messages
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
=== Type definitions ===
 
=== Type definitions ===
 
----
 
----
  
''To be documented''
+
 
 +
'''HID descriptor'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PHIDDescriptor = ^THIDDescriptor;</code>
 +
 
 +
<code>THIDDescriptor = packed record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Section 6.2.1
 +
|-
 +
| <code>bLength:Byte;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>bDescriptorType:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>bcdHID:Word;</code>
 +
| &nbsp;
 +
|-
 +
| <code>bCountryCode:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>bNumDescriptors:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>bHIDDescriptorType:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>wHIDDescriptorLength:Word;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|Note: Up to two optional bHIDDescriptorType/wHIDDescriptorLength pairs after the Report descriptor details
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''HID report descriptor'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
 
 +
<code>PHIDReportDescriptor = Pointer;</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Section 6.2.2
 +
|-
 +
| &nbsp;
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''HID physical descriptor'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PHIDPhysicalDescriptor = ^THIDPhysicalDescriptor;</code>
 +
 
 +
<code>THIDPhysicalDescriptor = packed record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See Section 6.2.3
 +
|-
 +
| <code>bDesignator:Byte;</code>
 +
| Indicates which part of the body affects the item
 +
|-
 +
| <code>bFlags:Byte;</code>
 +
| Bits specifying flags (7..5 Qualifier / 4..0 Effort)
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''HID physical descriptor set0'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PHIDPhysicalDescriptorSet0 = ^THIDPhysicalDescriptorSet0;</code>
 +
 
 +
<code>THIDPhysicalDescriptorSet0 = packed record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>bNumber:Byte;</code>
 +
| Number of Physical Descriptor sets not including Physical Descriptor set 0
 +
|-
 +
| <code>wLength:Word;</code>
 +
| Length of each Physical descriptor set
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''HID physical descriptor set'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PHIDPhysicalDescriptorSet = ^THIDPhysicalDescriptorSet;</code>
 +
 
 +
<code>THIDPhysicalDescriptorSet = packed record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>bPhysicalInfo:Byte;</code>
 +
| Bits specifying physical information (7..5 Bias / 4..0 Preference)
 +
|-
 +
| <code>wPhysicalDescriptor:array[0..0] of THIDPhysicalDescriptor;</code>
 +
| Physical descriptor data
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''HID state'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PHIDState = ^THIDState;</code>
 +
 
 +
<code>THIDState = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Local State
 +
|-
 +
| <code>Usage:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>UsageCount:LongWord;</code>
 +
| Provides UsageMinimum/UsageMaximum
 +
|-
 +
| <code>DesignatorIndex:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>DesignatorCount:LongWord;</code>
 +
| Provides DesignatorMinimum/DesignatorMaximum
 +
|-
 +
| <code>StringIndex:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>StringCount:LongWord;</code>
 +
| Provides StringMinimum/StringMaximum
 +
|-
 +
| <code>Delimiter:Boolean;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|Global State
 +
|-
 +
| <code>UsagePage:Word;</code>
 +
| &nbsp;
 +
|-
 +
| <code>LogicalMinimum:LongInt;</code>
 +
| &nbsp;
 +
|-
 +
| <code>LogicalMaximum:LongInt;</code>
 +
| &nbsp;
 +
|-
 +
| <code>PhysicalMinimum:LongInt;</code>
 +
| &nbsp;
 +
|-
 +
| <code>PhysicalMaximum:LongInt;</code>
 +
| &nbsp;
 +
|-
 +
| <code>UnitType:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>UnitExponent:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>ReportSize:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>ReportId:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>ReportCount:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''HID stack'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PHIDStack = ^THIDStack;</code>
 +
 
 +
<code>THIDStack = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>State:PHIDState;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>Next:PHIDStack;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''HID usages'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PHIDUsages = ^THIDUsages;</code>
 +
 
 +
<code>THIDUsages = array[0..0] of PHIDUsage;</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| &nbsp;
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''HID usage'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PHIDUsage = ^THIDUsage;</code>
 +
 
 +
<code>THIDUsage = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>Page:Word;</code>
 +
| The usage page this usage refers to
 +
|-
 +
| <code>Usage:Word;</code>
 +
| The usage within the usage page
 +
|-
 +
| <code>Count:Word;</code>
 +
| The total number of sequential usages where Usage represents the minimum value or 1 for a single usage (Usage range is from Usage to Usage + Count - 1)
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>Index:LongWord;</code>
 +
| The index of this usage in the report (First usage is 0)
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>StringIndex:LongWord;</code>
 +
| The string index for this usage
 +
|-
 +
| <code>StringCount:LongWord;</code>
 +
| The total number of sequential string index values where string index represents the minimum value or 1 for a single string
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>DesignatorIndex:LongWord;</code>
 +
| The designator index for this usage
 +
|-
 +
| <code>DesignatorCount:LongWord;</code>
 +
| The total number of sequential designator index values where designator index represents the minimum value or 1 for a single designator
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>LogicalMinimum:LongInt;</code>
 +
| The logical minimum value for this usage
 +
|-
 +
| <code>LogicalMaximum:LongInt;</code>
 +
| The logical maximum value for this usage
 +
|-
 +
| <code>PhysicalMinimum:LongInt;</code>
 +
| The physical minimum value for this usage (in Units)
 +
|-
 +
| <code>PhysicalMaximum:LongInt;</code>
 +
| The physical maximum value for this usage (in Units)
 +
|-
 +
| <code>UnitType:LongWord;</code>
 +
| The unit type for this usage
 +
|-
 +
| <code>UnitExponent:LongWord;</code>
 +
| The unit exponent index for this usage
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>Aliases:PHIDUsages;</code>
 +
| The list of aliased usages for this control (See Delimiters in Section 6.2.2.8)
 +
|-
 +
| <code>AliasCount:LongWord;</code>
 +
| The number of aliased usages contained for this control
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>Report:PHIDReport;</code>
 +
| The report this usage belongs to
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''HID reports'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PHIDReports = ^THIDReports;</code>
 +
 
 +
<code>THIDReports = array[0..0] of PHIDReport;</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| &nbsp;
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''HID report'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PHIDReport = ^THIDReport;</code>
 +
 
 +
<code>THIDReport = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>Id:Byte;</code>
 +
| The Id of this report
 +
|-
 +
| <code>Kind:Byte;</code>
 +
| The type of report (Input, Output or Feature) (eg HID_REPORT_INPUT)
 +
|-
 +
| <code>Flags:LongWord;</code>
 +
| The main item flags for this report (eg HID_MAIN_ITEM_VARIABLE)
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>Size:LongWord;</code>
 +
| The number of bits per field in this report
 +
|-
 +
| <code>Count:LongWord;</code>
 +
| The number of fields in this report
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>Index:LongWord;</code>
 +
| The index of this report in the collection (First report is 0)
 +
|-
 +
| <code>Sequence:LongWord;</code>
 +
| The sequence of this report in all collections (First report is 0)
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>Usages:PHIDUsages;</code>
 +
| The list of usages contained in this report
 +
|-
 +
| <code>UsageCount:LongWord;</code>
 +
| The number of usages contained in this report
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>Collection:PHIDCollection;</code>
 +
| The collection this report belongs to
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''HID collections'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PHIDCollections = ^THIDCollections;</code>
 +
 
 +
<code>THIDCollections = array[0..0] of PHIDCollection;</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| &nbsp;
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''HID collection'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PHIDCollection = ^THIDCollection;</code>
 +
 
 +
<code>THIDCollection = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>Page:Word;</code>
 +
| The usage page this collection refers to (eg HID_PAGE_GENERIC_DESKTOP)
 +
|-
 +
| <code>Usage:Word;</code>
 +
| The usage within the usage page (eg HID_DESKTOP_MOUSE)
 +
|-
 +
| <code>Flags:LongWord;</code>
 +
| The main item flags for this collection (eg HID_MAIN_COLLECTION_APPLICATION)
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>Start:LongWord;</code>
 +
| The first byte of this collection in the report descriptor
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>Reports:PHIDReports;</code>
 +
| The list of reports contained in this collection
 +
|-
 +
| <code>ReportCount:LongWord;</code>
 +
| The number of reports contained in this collection
 +
|-
 +
| <code>Collections:PHIDCollections;</code>
 +
| The list of collections contained in this collection
 +
|-
 +
| <code>CollectionCount:LongWord;</code>
 +
| The number of collections contained in this collection
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>Parent:PHIDCollection;</code>
 +
| The parent collection or nil if this is a top level collection
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>Device:PHIDDevice;</code>
 +
| The device this collection belongs to
 +
|-
 +
| <code>Consumer:PHIDConsumer;</code>
 +
| The consumer which is bound to this collection (or nil if not bound)
 +
|-
 +
| <code>PrivateData:Pointer;</code>
 +
| Private data for the consumer of this collection
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''HID device enumeration callback'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>THIDDeviceEnumerate = function(Device:PHIDDevice;Data:Pointer):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''HID device notification callback'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>THIDDeviceNotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''HID device get idle'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>THIDDeviceGetIdle = function(Device:PHIDDevice; var Duration:Word; ReportId:Byte):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''HID device set idle'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>THIDDeviceSetIdle = function(Device:PHIDDevice; Duration:Word; ReportId:Byte):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''HID device get report'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>THIDDeviceGetReport = function(Device:PHIDDevice; ReportType,ReportId:Byte; ReportData:Pointer; ReportSize:LongWord):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''HID device set report'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>THIDDeviceSetReport = function(Device:PHIDDevice; ReportType,ReportId:Byte; ReportData:Pointer; ReportSize:LongWord):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''HID device allocate report'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>THIDDeviceAllocateReport = function(Device:PHIDDevice; Collection:PHIDCollection; ReportId:Byte; ReportSize:LongWord):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''HID device release report'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>THIDDeviceReleaseReport = function(Device:PHIDDevice; ReportId:Byte):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''HID device submit report'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>THIDDeviceSubmitReport = function(Device:PHIDDevice; ReportId:Byte):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 +
'''HID device cancel report'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>THIDDeviceCancelReport = function(Device:PHIDDevice; ReportId:Byte):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''HID device get protocol'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>THIDDeviceGetProtocol = function(Device:PHIDDevice; var Protocol:Byte):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''HID device set protocol'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>THIDDeviceSetProtocol = function(Device:PHIDDevice; Protocol:Byte):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''HID device get interval'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>THIDDeviceGetInterval = function(Device:PHIDDevice; var Interval:LongWord):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''HID device set interval'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>THIDDeviceSetInterval = function(Device:PHIDDevice; Interval:LongWord):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''HID device get report descriptor'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>THIDDeviceGetReportDescriptor = function(Device:PHIDDevice; Descriptor:PHIDReportDescriptor; Size:LongWord):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''HID device get physical descriptor set0'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>THIDDeviceGetPhysicalDescriptorSet0 = function(Device:PHIDDevice; Descriptor:PHIDPhysicalDescriptorSet0):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 +
'''HID device get physical descriptor set'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>THIDDeviceGetPhysicalDescriptorSet = function(Device:PHIDDevice; Descriptor:PHIDPhysicalDescriptorSet; Index:Byte; Size:LongWord):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''HID device'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PHIDDevice = ^THIDDevice;</code>
 +
 
 +
<code>THIDDevice = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|''Device Properties''
 +
|-
 +
| <code>Device:TDevice;</code>
 +
| The Device entry for this HID
 +
|-
 +
|colspan="2"|''HID Properties''
 +
|-
 +
| <code>HIDId:LongWord;</code>
 +
| Unique Id of this HID in the HID device table
 +
|-
 +
| <code>HIDState:LongWord;</code>
 +
| HID device state (eg HID_STATE_ATTACHED)
 +
|-
 +
| <code>Consumer:PHIDConsumer;</code>
 +
| The consumer which is bound to this device (or nil if not bound)
 +
|-
 +
| <code>DeviceGetIdle:THIDDeviceGetIdle;</code>
 +
| A device specific GetIdle method (If supported by provider)
 +
|-
 +
| <code>DeviceSetIdle:THIDDeviceSetIdle;</code>
 +
| A device specific SetIdle method (If supported by provider)
 +
|-
 +
| <code>DeviceGetReport:THIDDeviceGetReport;</code>
 +
| A device specific GetReport method (If supported by provider)
 +
|-
 +
| <code>DeviceSetReport:THIDDeviceSetReport;</code>
 +
| A device specific SetReport method (If supported by provider)
 +
|-
 +
| <code>DeviceAllocateReport:THIDDeviceAllocateReport;</code>
 +
| A device specific AllocateReport method (If supported by provider)
 +
|-
 +
| <code>DeviceReleaseReport:THIDDeviceReleaseReport;</code>
 +
| A device specific ReleaseReport method (If supported by provider)
 +
|-
 +
| <code>DeviceSubmitReport:THIDDeviceSubmitReport;</code>
 +
| A device specific SubmitReport method (If supported by provider)
 +
|-
 +
| <code>DeviceCancelReport:THIDDeviceCancelReport;</code>
 +
| A device specific CancelReport method (If supported by provider)
 +
|-
 +
| <code>DeviceGetProtocol:THIDDeviceGetProtocol;</code>
 +
| A device specific GetProtocol method (If supported by provider)
 +
|-
 +
| <code>DeviceSetProtocol:THIDDeviceSetProtocol;</code>
 +
| A device specific SetProtocol method (If supported by provider)
 +
|-
 +
| <code>DeviceGetInterval:THIDDeviceGetInterval;</code>
 +
| A device specific GetInterval method (If supported by provider)
 +
|-
 +
| <code>DeviceSetInterval:THIDDeviceSetInterval;</code>
 +
| A device specific SetInterval method (If supported by provider)
 +
|-
 +
| <code>DeviceGetReportDescriptor:THIDDeviceGetReportDescriptor;</code>
 +
| A device specific GetReportDescriptor method (If supported by provider)
 +
|-
 +
| <code>DeviceGetPhysicalDescriptorSet0:THIDDeviceGetPhysicalDescriptorSet0;</code>
 +
| A device specific GetPhysicalDescriptorSet0 method (If supported by provider)
 +
|-
 +
| <code>DeviceGetPhysicalDescriptorSet:THIDDeviceGetPhysicalDescriptorSet;</code>
 +
| A device specific GetPhysicalDescriptorSet method (If supported by provider)
 +
|-
 +
|colspan="2"|''Driver Properties''
 +
|-
 +
| <code>Lock:TMutexHandle;</code>
 +
| HID device lock
 +
|-
 +
| <code>PrivateData:Pointer;</code>
 +
| Private data for the consumer of this HID device (If applicable)
 +
|-
 +
| <code>Collections:PHIDCollections;</code>
 +
| The parsed report descriptor with collections, reports and usages
 +
|-
 +
| <code>CollectionCount:LongWord;</code>
 +
| The number of top level collections contained in the report descriptor
 +
|-
 +
| <code>Descriptor:PHIDReportDescriptor;</code>
 +
| The raw report descriptor obtained from the device
 +
|-
 +
| <code>DescriptorSize:LongWord;</code>
 +
| The size of the data pointed to by Descriptor
 +
|-
 +
|colspan="2"|''Statistics Properties''
 +
|-
 +
| <code>ReceiveCount:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>ReceiveErrors:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|''Internal Properties''
 +
|-
 +
| <code>Prev:PHIDDevice;</code>
 +
| Previous entry in Device table
 +
|-
 +
| <code>Next:PHIDDevice;</code>
 +
| Next entry in Device table
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''HID consumer enumeration callback'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>THIDConsumerEnumerate = function(Consumer:PHIDConsumer; Data:Pointer):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 +
'''HID device bind'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>THIDDeviceBind = function(Device:PHIDDevice):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 +
'''HID device unbind'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>THIDDeviceUnbind = function(Device:PHIDDevice):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''HID collection bind'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>THIDCollectionBind = function(Device:PHIDDevice; Collection:PHIDCollection):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''HID collection unbind'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>THIDCollectionUnbind = function(Device:PHIDDevice; Collection:PHIDCollection):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''HID report receive'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>THIDReportReceive = function(Collection:PHIDCollection; ReportId:Byte; ReportData:Pointer; ReportSize:LongWord):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''HID consumer'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PHIDConsumer = ^THIDConsumer;</code>
 +
 
 +
<code>THIDConsumer = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|''Driver Properties''
 +
|-
 +
| <code>Driver:TDriver;</code>
 +
| The Driver entry for this HID Consumer
 +
|-
 +
|colspan="2"|''Consumer Properties''
 +
|-
 +
| <code>DeviceBind:THIDDeviceBind;</code>
 +
| A Device Bind method to be called when a HID device bind is requested by a provider (Optional)
 +
|-
 +
| <code>DeviceUnbind:THIDDeviceUnbind;</code>
 +
| A Device Ubind method to be called when a HID device unbind is requested by a provider (Optional)
 +
|-
 +
| <code>CollectionBind:THIDCollectionBind;</code>
 +
| A Collection Bind method to be called when a HID collection bind is requested by a provider (Mandatory)
 +
|-
 +
| <code>CollectionUnbind:THIDCollectionUnbind;</code>
 +
| A Collection Unbind method to be called when a HID collection unbind is requested by a provider (Mandatory)
 +
|-
 +
| <code>ReportReceive:THIDReportReceive;</code>
 +
| A Report Receive method to be called when a HID input report is received by a provider (Mandatory)
 +
|-
 +
|colspan="2"|''Interface Properties''
 +
|-
 +
| <code>Lock:TMutexHandle;</code>
 +
| Consumer lock
 +
|-
 +
|colspan="2"|''Internal Properties''
 +
|-
 +
| <code>Prev:PHIDConsumer;</code>
 +
| Previous entry in Consumer table
 +
|-
 +
| <code>Next:PHIDConsumer;</code>
 +
| Next entry in Consumer table
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''HID report extent'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PHIDExtent = ^THIDExtent;</code>
 +
 
 +
<code>THIDExtent = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>Minimum:LongInt;</code>
 +
| The minimum value for this extent
 +
|-
 +
| <code>Maximum:LongInt;</code>
 +
| The maximum value for this extent
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''HID report field'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PHIDField = ^THIDField;</code>
 +
 
 +
<code>THIDField = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>Page:Word;</code>
 +
| The usage page of this field
 +
|-
 +
| <code>Usage:Word;</code>
 +
| The usage within the usage page
 +
|-
 +
| <code>Count:LongWord;</code>
 +
| The total number of sequential usages where Usage represents the minimum value or 1 for a single usage (Usage range is from Usage to Usage + Count - 1)
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>Flags:LongWord;</code>
 +
| The flags for this field
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>Size:LongWord;</code>
 +
| The length in bytes of this field within the input, output or feature report
 +
|-
 +
| <code>Bits:LongWord;</code>
 +
| The length in bits of this field within the input, output or feature report
 +
|-
 +
| <code>Offset:LongWord;</code>
 +
| The byte offset of this field within the input, output or feature report
 +
|-
 +
| <code>Shift:LongWord;</code>
 +
| The number shift bits to access this field in the input, output or feature report
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>Logical:THIDExtent;</code>
 +
| The minimum and maximum logical values for this field
 +
|-
 +
| <code>Physical:THIDExtent;</code>
 +
| The minimum and maximum physical values for this field
 +
|-
 +
| <code>Multiplier:Double;</code>
 +
| The conversion multiplier for this field from logical to physical units
 +
|-
 +
| <code>Resolution:Double;</code>
 +
| The unit resolution for this field in counts per physical unit
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>Next:PHIDField;</code>
 +
| The next field in the list
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''HID report definition'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PHIDDefinition = ^THIDDefinition;</code>
 +
 
 +
<code>THIDDefinition = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>Id:Byte;</code>
 +
| The Id of this report
 +
|-
 +
| <code>Kind:Byte;</code>
 +
| The type of this report (Input, Output or Feature)
 +
|-
 +
| <code>Size:LongWord;</code>
 +
| The total length of this input, output or feature report in bytes (Including the Id byte)
 +
|-
 +
| <code>Fields:PHIDField;</code>
 +
| Linked list of fields in this input, output or feature report
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>Next:PHIDDefinition;</code>
 +
| The next definition in the list
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
=== Public variables ===
 
=== Public variables ===
 
----
 
----
  
''To be documented''
+
 
 +
'''HID logging'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>HID_DEFAULT_LOG_LEVEL:LongWord = HID_LOG_LEVEL_DEBUG;</code>
 +
| style="width: 40%;"|Minimum level for HID messages. Only messages with level greater than or equal to this will be printed.
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>HID_LOG_ENABLED:Boolean;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
<br />
  
 
=== Function declarations ===
 
=== Function declarations ===
 
----
 
----
  
''To be documented''
 
  
 +
'''Initialization functions'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">procedure HIDInit;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Initialize the HID unit, device and consumer tables</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| Called only during system startup
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
 +
'''HID functions'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDParserParseCollections(Device:PHIDDevice; var Collections:PHIDCollections; var Count:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Parse the HID report descriptor of the provided device and populate the collections, reports and usages</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device to parse collections for
 +
|-
 +
! Collections
 +
| A pointer to the top level collections array to be populated
 +
|-
 +
! Count
 +
| A variable to return the number of top level collections
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDParserFreeCollections(Collections:PHIDCollections; Count:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Free the collections, reports and usages parsed from a HID report descriptor</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Collections
 +
| A pointer to the top level collections array to be freed
 +
|-
 +
! Count
 +
| The number of top level collections in the array
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDParserCountCollections(Device:PHIDDevice; Parent:PHIDCollection):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Count the number of collections found in the HID report descriptor of the provided device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device to count collections for
 +
|-
 +
! Parent
 +
| The parent HID collection, if supplied count child collections else count top level collections
 +
|-
 +
! Return
 +
| The number of collections found, 0 if none for or on error
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDParserCountReports(Device:PHIDDevice; Collection:PHIDCollection):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Count the number of reports found in the HID report descriptor of the supplied device and collection</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device to count reports for
 +
|-
 +
! Collection
 +
| The HID collection to count reports for
 +
|-
 +
! Return
 +
| The number of reports found, 0 if none for or on error
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDParserCountUsages(Device:PHIDDevice; Report:PHIDReport):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Count the number of usages found in the HID report descriptor for the supplied device and report</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device to count usages for
 +
|-
 +
! Report
 +
| The HID report to count usages for
 +
|-
 +
! Return
 +
| The number of usages found, 0 if none for or on error
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDParserAllocateCollection(Device:PHIDDevice; Parent:PHIDCollection; State:PHIDState; Flags,Start:LongWord):PHIDCollection;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Allocate a HID collection to contain a set of reports and usages from a HID report descriptor</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device containing the collection
 +
|-
 +
! Parent
 +
| The HID collection containing the collection (or nil for a top level collection)
 +
|-
 +
! State
 +
| The current HID parser state
 +
|-
 +
! Flags
 +
| The flags for the collection from the HID report descriptor
 +
|-
 +
! Start
 +
| The starting byte offset of the collection in the HID report descriptor
 +
|-
 +
! Return
 +
| A pointer to the HID collection or nil on error
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDParserAllocateReport(Device:PHIDDevice; Collection:PHIDCollection; State:PHIDState; Kind:Byte; Flags,Index,Sequence:LongWord):PHIDReport;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Allocate a HID report to contain a set of usages from a HID report descriptor</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device containing the report
 +
|-
 +
! Collection
 +
| The HID collection containing the report
 +
|-
 +
! State
 +
| The current HID parser state
 +
|-
 +
! Kind
 +
| The report kind (eg HID_REPORT_INPUT)
 +
|-
 +
! Flags
 +
| The flags for the report from the HID report descriptor
 +
|-
 +
! Index
 +
| The index of this report in the collection (First report is 0)
 +
|-
 +
! Sequence
 +
| The sequence of this report in all collections (First report is 0)
 +
|-
 +
! Return
 +
| A pointer to the HID report or nil on error
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDParserAllocateUsage(Device:PHIDDevice; Report:PHIDReport; State:PHIDState; Index:LongWord):PHIDUsage;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Allocate a HID usage from a HID report descriptor</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device containing the usage
 +
|-
 +
! Report
 +
| The HID report containing the usage
 +
|-
 +
! State
 +
| The current HID parser state
 +
|-
 +
! Index
 +
| The index of this usage in the report (First usage is 0)
 +
|-
 +
! Return
 +
| A pointer to the HID usage or nil on error
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDParserUpdateUsage(Device:PHIDDevice; Report:PHIDReport; State:PHIDState; Usage:PHIDUsage):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Update a HID usage from a HID report descriptor</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device containing the usage
 +
|-
 +
! Report
 +
| The HID report containing the usage
 +
|-
 +
! State
 +
| The current HID parser state
 +
|-
 +
! Usage
 +
| The HID usage to update
 +
|-
 +
! Return
 +
| True if completed or False on error
 +
|-
 +
! Note
 +
| As usages must precede the main item they relate to in the HID report descriptor they need to be allocated before all the required information is known, this function updates the usage after the main item is found.
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDParserFreeUsage(Device:PHIDDevice;Usage:PHIDUsage):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Free a HID usage and any associated usage aliases</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device containing the usage
 +
|-
 +
! Usage
 +
| The HID usage to free
 +
|-
 +
! Return
 +
| True if completed or False on error
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDParserPopStack(var Stack:PHIDStack; var State:PHIDState):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Replace the current HID parser state with the top item from the parser stack</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Stack
 +
| The HID parser stack
 +
|-
 +
! State
 +
| The HID parser state to replace
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDParserPushStack(Stack:PHIDStack):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Place a copy of the current HID parser state on top of the parser stack</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Stack
 +
| The HID parser stack
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDParserFreeStack(Stack:PHIDStack):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Free the HID parser stack and state</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Stack
 +
| The HID parser stack
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDParserResetState(State:PHIDState):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Clear the Local and Global HID parser state</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! State
 +
| The HID parser state to reset
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDParserCleanState(State:PHIDState):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Clear the Local HID parser state</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! State
 +
| The HID parser state to clean
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDFindCollection(Device:PHIDDevice; Page,Usage:Word):PHIDCollection;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find the first HID collection matching the specified page and usage</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device to find collections from
 +
|-
 +
! Page
 +
| The HID Usage Page to match (eg HID_PAGE_GENERIC_DESKTOP)
 +
|-
 +
! Usage
 +
| The HID Usage to match (eg HID_DESKTOP_MOUSE)
 +
|-
 +
! Return
 +
| A pointer to the first matching collection or nil if not matched
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDFindReportIds(Device:PHIDDevice; Collection:PHIDCollection; var MinId,MaxId:Byte):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find the minimum and maximum report ids contained in the specified HID collection or all collections</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device to find report ids from
 +
|-
 +
! Collection
 +
| The HID collection to find report ids from (or nil to find from all collections)
 +
|-
 +
! MinId
 +
| A variable to receive the minimum report id number
 +
|-
 +
! MaxId
 +
| A variable to receive the maximum report id number
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDFindReportSizes(Device:PHIDDevice; Collection:PHIDCollection; Kind:Byte; var MinSize,MaxSize:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find the minimum and maximum report sizes contained in the specified HID collection or all collections</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device to find report sizes from
 +
|-
 +
! Collection
 +
| The HID collection to find report sizes from (or nil to find from all collections)
 +
|-
 +
! Kind
 +
| The report kind to find sizes for (eg HID_REPORT_INPUT)
 +
|-
 +
! MinSize
 +
| A variable to receive the minimum report size
 +
|-
 +
! MaxSize
 +
| A variable to receive the maximum report size
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDCountReports(Device:PHIDDevice; Collection:PHIDCollection; Kind,Id:Byte; var Count:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Count the number of HID reports of the specified type and id in the specified collection</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device to get the report count from
 +
|-
 +
! Collection
 +
| The HID collection to get the report count from
 +
|-
 +
! Kind
 +
| The report kind to count reports for (eg HID_REPORT_INPUT)
 +
|-
 +
! Id
 +
| The report id to count reports for (must be less than or equal to the maximum report id)
 +
|-
 +
! Count
 +
| A variable to return the number of reports
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDFindReports(Device:PHIDDevice; Collection:PHIDCollection; Kind,Id:Byte; Reports:PHIDReports; Count:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find all HID reports of the specified type and id in the specified collection</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device to get the reports from
 +
|-
 +
! Collection
 +
| The HID collection to get the reports from
 +
|-
 +
! Kind
 +
| The report kind to get reports for (eg HID_REPORT_INPUT)
 +
|-
 +
! Id
 +
| The report id to get reports for (must be less than or equal to the maximum report id)
 +
|-
 +
! Reports
 +
| A pointer to an array to return the list of reports
 +
|-
 +
! Count
 +
| The number of reports able to be returned in the reports array
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
! Note
 +
| The caller is responsible for allocating the reports array which must be large enough to hold a pointer to every report in the returned list. When finished the array should be freed by the caller but not the reports themselves. Call HIDCountReports first to obtain the correct size to be allocated for the array.
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDAllocateDefinition(Device:PHIDDevice; Collection:PHIDCollection; Kind,Id:Byte):PHIDDefinition;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Allocate a HID definition to describe an input, output or feature report contained in the specified collection</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device to create the report definition from
 +
|-
 +
! Collection
 +
| The HID collection to create the report definition from
 +
|-
 +
! Kind
 +
| The report kind to create a definition for (eg HID_REPORT_INPUT)
 +
|-
 +
! Id
 +
| The report id to create a definition for (must be less than or equal to the maximum report id)
 +
|-
 +
! Return
 +
| A pointer to the allocated definition or nil on error
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDFreeDefinition(Definition:PHIDDefinition):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Free a HID definition describing an input, output or feature report</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Definition
 +
| The HID definition to be freed
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDInsertBitField(Field:PHIDField; Buffer:Pointer; Size:LongWord; Value:Boolean):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Insert a bit field value into a report buffer</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Field
 +
| The field to insert into the report
 +
|-
 +
! Buffer
 +
| A pointer to the report buffer
 +
|-
 +
! Size
 +
| The size in bytes of the report buffer
 +
|-
 +
! Value
 +
| The value to insert into the buffer
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDInsertSignedField(Field:PHIDField; Buffer:Pointer; Size:LongWord; Value:LongInt):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Insert a signed field value into a report buffer</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Field
 +
| The field to insert into the report
 +
|-
 +
! Buffer
 +
| A pointer to the report buffer
 +
|-
 +
! Size
 +
| The size in bytes of the report buffer
 +
|-
 +
! Value
 +
| The value to insert into the buffer
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDInsertUnsignedField(Field:PHIDField; Buffer:Pointer; Size,Value:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Insert an unsigned field value into a report buffer</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Field
 +
| The field to insert into the report
 +
|-
 +
! Buffer
 +
| A pointer to the report buffer
 +
|-
 +
! Size
 +
| The size in bytes of the report buffer
 +
|-
 +
! Value
 +
| The value to insert into the buffer
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDExtractBitField(Field:PHIDField; Buffer:Pointer; Size:LongWord; var Value:Boolean):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Extract a bit field value from a report buffer</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Field
 +
| The field to extract from the report
 +
|-
 +
! Buffer
 +
| A pointer to the report buffer
 +
|-
 +
! Size
 +
| The size in bytes of the report buffer
 +
|-
 +
! Value
 +
| A variable to receive the extracted value
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDExtractSignedField(Field:PHIDField; Buffer:Pointer; Size:LongWord; var Value:LongInt):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Extract a signed field value from a report buffer</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Field
 +
| The field to extract from the report
 +
|-
 +
! Buffer
 +
| A pointer to the report buffer
 +
|-
 +
! Size
 +
| The size in bytes of the report buffer
 +
|-
 +
! Value
 +
| A variable to receive the extracted value
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDExtractUnsignedField(Field:PHIDField; Buffer:Pointer; Size:LongWord; var Value:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Extract an unsigned field value from a report buffer</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Field
 +
| The field to extract from the report
 +
|-
 +
! Buffer
 +
| A pointer to the report buffer
 +
|-
 +
! Size
 +
| The size in bytes of the report buffer
 +
|-
 +
! Value
 +
| A variable to receive the extracted value
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
 +
'''HID Device functions'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceSetState(Device:PHIDDevice; State:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the state of the specified HID device and send a notification</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device to set the state for
 +
|-
 +
! State
 +
| The new state to set and notify (eg HID_STATE_ATTACHED)
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceGetIdle(Device:PHIDDevice; var Duration:Word; ReportId:Byte):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the idle rate from a HID device for the specified report id</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device to get the idle rate from
 +
|-
 +
! Duration
 +
| A variable to receive the idle rate (in Milliseconds)
 +
|-
 +
! ReportId
 +
| The report id to get the idle rate from
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceSetIdle(Device:PHIDDevice; Duration:Word; ReportId:Byte):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the idle rate on a HID device for the specified report id</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device to set the idle rate for
 +
|-
 +
! Duration
 +
| The idle rate to set (in Milliseconds)
 +
|-
 +
! ReportId
 +
| The report id to set the idle rate for
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceGetReport(Device:PHIDDevice; ReportType,ReportId:Byte; ReportData:Pointer; ReportSize:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Read a report by type and id from a HID device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device to read the report from
 +
|-
 +
! ReportType
 +
| The report type to read (eg HID_REPORT_INPUT)
 +
|-
 +
! ReportId
 +
| The report id to read (eg HID_REPORTID_NONE)
 +
|-
 +
! ReportData
 +
| A pointer to a buffer to receive the report data
 +
|-
 +
! ReportSize
 +
| The size in bytes of the buffer pointed to by report data
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceSetReport(Device:PHIDDevice; ReportType,ReportId:Byte; ReportData:Pointer; ReportSize:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Write a report by type and id to a HID device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device to write the report to
 +
|-
 +
! ReportType
 +
| The report type to write (eg HID_REPORT_OUTPUT)
 +
|-
 +
! ReportId
 +
| The report id to write (eg HID_REPORTID_NONE)
 +
|-
 +
! ReportData
 +
| A pointer to a buffer containing the report data
 +
|-
 +
! ReportSize
 +
| The size in bytes of the buffer pointed to by report data
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceAllocateReport(Device:PHIDDevice; Collection:PHIDCollection; ReportId:Byte; ReportSize:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Allocate and initialize an input report by id on a HID device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device to allocate the report on
 +
|-
 +
! Collection
 +
| The HID collection this request corresponds to
 +
|-
 +
! ReportId
 +
| The report id to allocate (eg HID_REPORTID_NONE)
 +
|-
 +
! ReportSize
 +
| The size in bytes to allocate for the report (Provider will handle alignment and other requirements)
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
! Note
 +
| An allocated report must be submitted before reports will be received from the device
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceReleaseReport(Device:PHIDDevice; ReportId:Byte):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Release an input report by id from a HID device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device to release the report from
 +
|-
 +
! ReportId
 +
| The report id to allocate (eg HID_REPORTID_NONE)
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
! Note
 +
| If the report has been submitted it must be cancelled before being released
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceSubmitReport(Device:PHIDDevice; ReportId:Byte):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Submit an input report by id on a HID device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device to submit the report on
 +
|-
 +
! ReportId
 +
| The report id to submit (eg HID_REPORTID_NONE)
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
! Note
 +
| The report must be allocated then submitted before reports will be received from the device
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceCancelReport(Device:PHIDDevice; ReportId:Byte):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Cancel an input report by id on a HID device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device to cancel the report on
 +
|-
 +
! ReportId
 +
| The report id to cancel (eg HID_REPORTID_NONE)
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
! Note
 +
| The report should be cancelled then released to stop receiving reports from the device
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceGetProtocol(Device:PHIDDevice; var Protocol:Byte):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the report protocol from a HID device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device to get the report protocol from
 +
|-
 +
! Protocol
 +
| A variable to receive the report protocol (eg HID_PROTOCOL_REPORT)
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceSetProtocol(Device:PHIDDevice; Protocol:Byte):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the report protocol for a HID device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device to set the report protocol for
 +
|-
 +
! Protocol
 +
| The report protocol to set (eg HID_PROTOCOL_REPORT)
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceGetInterval(Device:PHIDDevice; var Interval:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the polling interval from a HID device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device to get the polling interval from
 +
|-
 +
! Interval
 +
| A variable to receive the polling interval (in Milliseconds)
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceSetInterval(Device:PHIDDevice; Interval:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the polling interval for a HID device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device to set the polling interval for
 +
|-
 +
! Interval
 +
| The polling interval to set (in Milliseconds)
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceGetReportDescriptor(Device:PHIDDevice; Descriptor:PHIDReportDescriptor; Size:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the Report Descriptor for a HID device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device to get the descriptor for
 +
|-
 +
! Descriptor
 +
| Pointer to a buffer to return the HID Report Descriptor
 +
|-
 +
! Size
 +
| The size in bytes of the buffer pointed to by Descriptor
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceGetPhysicalDescriptorSet0(Device:PHIDDevice; Descriptor:PHIDPhysicalDescriptorSet0):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the HID Physical Descriptor Set 0 for a HID device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device to get the descriptor for
 +
|-
 +
! Descriptor
 +
| Pointer to a HID Physical Descriptor Set 0 structure for the returned data
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceGetPhysicalDescriptorSet(Device:PHIDDevice; Descriptor:PHIDPhysicalDescriptorSet; Index:Byte; Size:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get a HID Physical Descriptor Set for a HID device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device to get the descriptor for
 +
|-
 +
! Descriptor
 +
| Pointer to a HID Physical Descriptor Set structure for the returned data
 +
|-
 +
! Index
 +
| The index of the physical descriptor set to return
 +
|-
 +
! Size
 +
| The size in bytes of the buffer pointed to by Descriptor
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceBindDevice(Device:PHIDDevice):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Attempt to bind a HID device to one of the registered consumers</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device to attempt to bind a consumer to
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed, ERROR_NOT_SUPPORTED if unsupported or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceUnbindDevice(Device:PHIDDevice; Consumer:PHIDConsumer):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Unbind a HID device from a consumer</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device to unbind a consumer from
 +
|-
 +
! Consumer
 +
| The consumer to unbind the device from (nil to unbind from current consumer)
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceBindCollections(Device:PHIDDevice):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Attempt to bind the HID collections in the specified device to one of the registered consumers</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device containing the collections to attempt to bind a consumer to
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceUnbindCollections(Device:PHIDDevice; Consumer:PHIDConsumer):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Unbind the HID collections in the specified device from a consumer</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device containing the collections to unbind a consumer from
 +
|-
 +
! Consumer
 +
| The consumer to unbind the collections from (nil to unbind from current consumer)
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceCreate:PHIDDevice;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Create a new HID device entry</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Return
 +
| Pointer to new HID device entry or nil if HID device could not be created
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceCreateEx(Size:LongWord):PHIDDevice;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Create a new HID device entry</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Size
 +
| Size in bytes to allocate for new HID device (Including the HID device entry)
 +
|-
 +
! Return
 +
| Pointer to new HID device entry or nil if HID device could not be created
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceDestroy(Device:PHIDDevice):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Destroy an existing HID device entry</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device to destroy
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceRegister(Device:PHIDDevice):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Register a new HID device in the HID device table</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device to register
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceDeregister(Device:PHIDDevice):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Deregister a HID device from the HID device table</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device to deregister
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceFind(HIDId:LongWord):PHIDDevice;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find a HID device by ID in the HID device table</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! HIDId
 +
| The ID number of the HID device to find
 +
|-
 +
! Return
 +
| Pointer to HID device entry or nil if not found
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceFindByName(const Name:String):PHIDDevice; inline;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find a HID device by name in the device table</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Name
 +
| The name of the HID device to find (eg HID0)
 +
|-
 +
! Return
 +
| Pointer to HID device entry or nil if not found
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceFindByDescription(const Description:String):PHIDDevice; inline;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find a HID device by description in the device table</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Description
 +
| The description of the HID to find (eg Optical USB Mouse)
 +
|-
 +
! Return
 +
| Pointer to HID device entry or nil if not found
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceEnumerate(Callback:THIDDeviceEnumerate; Data:Pointer):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Enumerate all HID devices in the HID device table</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Callback
 +
| The callback function to call for each HID device in the table
 +
|-
 +
! Data
 +
| A private data pointer to pass to callback for each HID device in the table
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceNotification(Device:PHIDDevice; Callback:THIDDeviceNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Register a notification for HID device changes</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Device
 +
| The HID device to notify changes for (Optional, pass nil for all HID devices)
 +
|-
 +
! Callback
 +
| The function to call when a notification event occurs
 +
|-
 +
! Data
 +
| A private data pointer to pass to callback when a notification event occurs
 +
|-
 +
! Notification
 +
| The events to register for notification of (eg DEVICE_NOTIFICATION_REGISTER)
 +
|-
 +
! Flags
 +
| The flags to control the notification (eg NOTIFIER_FLAG_WORKER)
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
 +
'''HID consumer functions'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDConsumerCreate:PHIDConsumer;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Create a new HID Consumer entry</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Return
 +
| Pointer to new Consumer entry or nil if consumer could not be created
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDConsumerCreateEx(Size:LongWord):PHIDConsumer;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Create a new HID Consumer entry</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Size
 +
| Size in bytes to allocate for new consumer (Including the consumer entry)
 +
|-
 +
! Return
 +
| Pointer to new Consumer entry or nil if consumer could not be created
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDConsumerDestroy(Consumer:PHIDConsumer):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Destroy an existing HID Consumer entry</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDConsumerRegister(Consumer:PHIDConsumer):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Register a new Consumer in the HID Consumer table</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDConsumerDeregister(Consumer:PHIDConsumer):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Deregister a Consumer from the HID Consumer table</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDConsumerFind(ConsumerId:LongWord):PHIDConsumer;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find a consumer by Id in the HID Consumer table</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDConsumerFindByName(const Name:String):PHIDConsumer; inline;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find a consumer by name in the Driver table</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDConsumerEnumerate(Callback:THIDConsumerEnumerate; Data:Pointer):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Enumerate all consumers in the HID Consumer table</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
 +
'''HID helper functions'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDIsBitField(Field:PHIDField):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return True if the supplied field contains a 1 bit value</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDIsByteField(Field:PHIDField):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return True if the supplied HID field contains a 1 byte value</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDIsWordField(Field:PHIDField):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return True if the supplied HID field contains a 2 byte value</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDIsLongField(Field:PHIDField):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return True if the supplied HID field contains a 3 or 4 byte value</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDIsSignedField(Field:PHIDField):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return True if the supplied HID field contains a signed value</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDPageToString(Page:Word):String;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return a string describing a HID usage page</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDUsageToString(Page,Usage,Count:Word):String;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return a string describing a HID usage within the given page</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDUnitTypeToString(UnitType:LongWord):String;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return a string describing a HID unit type</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDReportKindToString(Kind:Byte):String;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return a string describing a HID report type</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDReportFlagsToString(Flags:LongWord):String;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return a string describing the flags of a HID report</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDCollectionFlagsToString(Flags:LongWord):String;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return a string describing the flags of a HID collection</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">procedure HIDLog(Level:LongWord; Device:PHIDDevice; const AText:String);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">procedure HIDLogInfo(Device:PHIDDevice; const AText:String);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">procedure HIDLogWarn(Device:PHIDDevice; const AText:String);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">procedure HIDLogError(Device:PHIDDevice; const AText:String);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">procedure HIDLogDebug(Device:PHIDDevice; const AText:String);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
 +
'''HID device helper functions'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceGetCount:LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current HID Device count</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceCheck(Device:PHIDDevice):PHIDDevice;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check if the supplied HID Device is in the device table</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceTypeToString(HIDType:LongWord):String;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return a string describing the HID device type (eg HID_TYPE_USB)</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceStateToString(HIDState:LongWord):String;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return a string describing the HID device state (eg HID_STATE_ATTACHED)</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceStateToNotification(State:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Convert a Device state value into the notification code for device notifications</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
 +
'''HID consumer helper functions'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDConsumerGetCount:LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current HID Consumer count</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDConsumerCheck(Consumer:PHIDConsumer):PHIDConsumer;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check if the supplied HID Consumer is in the consumer table</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
Return to [[Unit_Reference|Unit Reference]]
 
Return to [[Unit_Reference|Unit Reference]]

Latest revision as of 04:27, 31 January 2024

Return to Unit Reference


Description


Ultibo Human Interface Device (HID) Interface unit

The Human Interface Device (HID) class is intended to provide a flexible model that allows a wide range of control types to be expressed using a standard set of tags in a report descriptor that each device provides during initialization.

HID devices can represent common items such as mice, keyboards, touchscreens, gamepads and joysticks but can also appear as controls within many other types of devices.

A headset for example will primarily be an audio device but the volume and mute buttons can be defined using the HID standard and easily recognized by software without requiring a custom driver for each and every device.

The Ultibo HID implementation creates an intermediate device layer that is mostly agnostic to both the bus type being used by an underlying provider (such as USB) and the devices recognized by HID consumers such as mice and keyboards.

A provider such as USB HID locates devices from the provider specific bus and creates HID devices to represent them along with obtaining report descriptors and other information.

These HID devices are then passed to registered HID consumers (drivers) to determine if they recognize the collections, reports and usages described by the device. A consumer can accept a device and bind to it during this process and create its own devices to represent the functionality described by the HID device.

While HID itself is intended to be bus agnostic this implementation is based heavily on the USB HID standards as those are the most widely adopted at this time. It is anticipated that HID adoption will expand over time to include a range other bus types, Bluetooth is already using HID and there are existing implementations of HID over I2C, SPI and PCI.

Expanding the Ultibo HID support to other bus types simply requires a new HID provider for that bus to be written along with any necessary changes or extensions to the HID layer itself.

Constants



HID specific constants HID_NAME_*
HID_NAME_PREFIX = 'HID'; Name prefix for HID Devices


HID device type HID_TYPE_*
HID_TYPE_NONE = 0;  
HID_TYPE_USB = 1;  
 
HID_TYPE_MAX = 1;  
 
HID device type name
HID_TYPE_NAMES:array[HID_TYPE_NONE..HID_TYPE_MAX] of String = (
'HID_TYPE_NONE',  
'HID_TYPE_USB');  


HID device state HID_STATE_*
HID_STATE_DETACHED = 0;  
HID_STATE_DETACHING = 1;  
HID_STATE_ATTACHING = 2;  
HID_STATE_ATTACHED = 3;  
 
HID_STATE_MAX = 3;  
 
HID device state name
HID_STATE_NAMES:array[HID_STATE_DETACHED..HID_STATE_MAX] of String = (
'HID_STATE_DETACHED',  
'HID_STATE_DETACHING',  
'HID_STATE_ATTACHING',  
'HID_STATE_ATTACHED');  


HID device flag HID_FLAG_*
HID_FLAG_NONE = $00000000;  


HID interface subclass HID_SUBCLASS_*
See USB HID v1.11 specification (Section 4.2)
 
HID_SUBCLASS_NONE = 0;  
HID_SUBCLASS_BOOT = 1;  


HID interface protocol HID_BOOT_PROTOCOL_*
See USB HID v1.11 specification (Section 4.3)
 
HID_BOOT_PROTOCOL_NONE = 0;  
HID_BOOT_PROTOCOL_KEYBOARD = 1;  
HID_BOOT_PROTOCOL_MOUSE = 2;  


HID class descriptor HID_DESCRIPTOR_TYPE*
See USB HID v1.11 specification (Section 7.1)
 
HID_DESCRIPTOR_TYPE_HID = $21;  
HID_DESCRIPTOR_TYPE_REPORT = $22;  
HID_DESCRIPTOR_TYPE_PHYSICAL_DESCRIPTOR = $23;  


HID request HID_REQUEST_*
See Section 7.2
 
HID_REQUEST_GET_REPORT = $01;  
HID_REQUEST_GET_IDLE = $02;  
HID_REQUEST_GET_PROTOCOL = $03;  
HID_REQUEST_SET_REPORT = $09;  
HID_REQUEST_SET_IDLE = $0A;  
HID_REQUEST_SET_PROTOCOL = $0B;  


HID protocol HID_PROTOCOL_*
See Section 7.2.5
 
HID_PROTOCOL_BOOT = 0;  
HID_PROTOCOL_REPORT = 1;  


HID report HID_REPORT_*
See Section 7.2.1
 
HID_REPORT_INPUT = 1;  
HID_REPORT_OUTPUT = 2;  
HID_REPORT_FEATURE = 3;  


HID report ID HID_REPORTID_*
See Section 7.2.1
 
HID_REPORTID_NONE = 0;  


HID item size HID_SIZE_*
See Section 6.2.2.2
 
HID_SIZE_0 = (0 shl 0);  
HID_SIZE_1 = (1 shl 0);  
HID_SIZE_2 = (2 shl 0);  
HID_SIZE_4 = (3 shl 0);  
HID_SIZE_MASK = $03;  


HID item type HID_TYPE_*
See Section 6.2.2.2
 
HID_TYPE_MAIN = (0 shl 2);  
HID_TYPE_GLOBAL = (1 shl 2);  
HID_TYPE_LOCAL = (2 shl 2);  
HID_TYPE_RESERVED = (3 shl 2);  
HID_TYPE_MASK = $0C;  


HID main item tag HID_TAG_MAIN_*
See Section 6.2.2.1 and Section 6.2.2.4
 
HID_TAG_MAIN_INPUT = $80; Input
HID_TAG_MAIN_OUTPUT = $90; Output
HID_TAG_MAIN_FEATURE = $B0; Feature
HID_TAG_MAIN_COLLECTION = $A0; Collection
HID_TAG_MAIN_END_COLLECTION = $C0; End Collection


HID global item tag HID_TAG_GLOBAL_*
See Section 6.2.2.7
 
HID_TAG_GLOBAL_USAGE_PAGE = $04; Usage Page
HID_TAG_GLOBAL_LOGICAL_MINIMUM = $14; Logical Minimum
HID_TAG_GLOBAL_LOGICAL_MAXIMUM = $24; Logical Maximum
HID_TAG_GLOBAL_PHYSICAL_MINIMUM = $34; Physical Minimum
HID_TAG_GLOBAL_PHYSICAL_MAXIMUM = $44; Physical Maximum
HID_TAG_GLOBAL_UNIT_EXPONENT = $54; Unit Exponent
HID_TAG_GLOBAL_UNIT = $64; Unit
HID_TAG_GLOBAL_REPORT_SIZE = $74; Report Size
HID_TAG_GLOBAL_REPORT_ID = $84; Report ID
HID_TAG_GLOBAL_REPORT_COUNT = $94; Report Count
HID_TAG_GLOBAL_PUSH = $A4; Push
HID_TAG_GLOBAL_POP = $B4; Pop


HID local item tag HID_TAG_LOCAL_*
See Section 6.2.2.8
 
HID_TAG_LOCAL_USAGE = $08; Usage
HID_TAG_LOCAL_USAGE_MINIMUM = $18; Usage Minimum
HID_TAG_LOCAL_USAGE_MAXIMUM = $28; Usage Maximum
HID_TAG_LOCAL_DESIGNATOR_INDEX = $38; Designator Index
HID_TAG_LOCAL_DESIGNATOR_MINIMUM = $48; Designator Minimum
HID_TAG_LOCAL_DESIGNATOR_MAXIMUM = $58; Designator Maximum
HID_TAG_LOCAL_STRING_INDEX = $78; String Index
HID_TAG_LOCAL_STRING_MINIMUM = $88; String Minimum
HID_TAG_LOCAL_STRING_MAXIMUM = $98; String Maximum
HID_TAG_LOCAL_DELIMITER = $A8; Delimiter
 
HID_TAG_LONG = $FC; Always HID_SIZE_2 (Followed by 1 byte DataSize / 1 byte LongItemTag / n bytes Data)
HID_TAG_MASK = $FC;  


HID main item input, ouput and feature HID_MAIN_ITEM_*
See Section 6.2.2.5
 
HID_MAIN_ITEM_CONSTANT = (1 shl 0); Constant (1)
HID_MAIN_ITEM_VARIABLE = (1 shl 1); Variable (1)
HID_MAIN_ITEM_RELATIVE = (1 shl 2); Relative (1)
HID_MAIN_ITEM_WRAP = (1 shl 3); Wrap (1)
HID_MAIN_ITEM_NON_LINEAR = (1 shl 4); Non Linear (1)
HID_MAIN_ITEM_NO_PREFERRED = (1 shl 5); No Preferred (1)
HID_MAIN_ITEM_NULL_STATE = (1 shl 6); Null state(1)
HID_MAIN_ITEM_RESERVED1 = (1 shl 7); Reserved (0)
HID_MAIN_ITEM_BUFFERED_BYTES = (1 shl 8); Buffered Bytes (1)
HID_MAIN_ITEM_RESERVED2 = ($FFFFFE00 shl 9); Reserved (0)


HID main item collection HID_MAIN_COLLECTION_*
See Section 6.2.2.6
 
HID_MAIN_COLLECTION_PHYSICAL = $00; Physical (Group of axes)
HID_MAIN_COLLECTION_APPLICATION = $01; Application (Mouse, Keyboard)
HID_MAIN_COLLECTION_LOGICAL = $02; Logical (Interrelated data)
HID_MAIN_COLLECTION_REPORT = $03; Report
HID_MAIN_COLLECTION_NAMED_ARRAY = $04; Named Array
HID_MAIN_COLLECTION_USAGE_SWITCH = $05; Usage Switch
HID_MAIN_COLLECTION_USAGE_MODIFIER = $06; Usage Modifier
0x07 to 0x7F Reserved
0x80 to 0xFF Vendor Defined


HID global item unit HID_GLOBAL_UNIT_*
See Section 6.2.2.7 For more information see https://physics.nist.gov/cuu/Units/units.html
 
HID_GLOBAL_UNIT_SYSTEM_MASK = $F; System of Measurement
HID_GLOBAL_UNIT_SYSTEM_SHIFT = 0;  
 
HID_GLOBAL_UNIT_SYSTEM_NONE = 0;  
HID_GLOBAL_UNIT_SYSTEM_SI_LINEAR = 1; SI linear unit
HID_GLOBAL_UNIT_SYSTEM_SI_ROTATION = 2; SI rotational units
HID_GLOBAL_UNIT_SYSTEM_ENGLISH_LINEAR = 3; English (Imperial) linear units
HID_GLOBAL_UNIT_SYSTEM_ENGLISH_ROTATION = 4; English (Imperial) rotational units
 
HID_GLOBAL_UNIT_LENGTH_MASK = $F; Length (Centimeters in SI, Inches in English)
HID_GLOBAL_UNIT_LENGTH_SHIFT = 4;  
 
HID_GLOBAL_UNIT_ROTATION_MASK = $F; Rotation (Radians in SI, Degrees in English)
HID_GLOBAL_UNIT_ROTATION_SHIFT = 4;  
 
HID_GLOBAL_UNIT_MASS_MASK = $F; Mass (Grams in SI, Slugs in English)
HID_GLOBAL_UNIT_MASS_SHIFT = 8;  
 
HID_GLOBAL_UNIT_TIME_MASK = $F; Time (Seconds)
HID_GLOBAL_UNIT_TIME_SHIFT = 12;  
 
HID_GLOBAL_UNIT_TEMPERATURE_MASK = $F; Temperature (Kelvin in SI, Fahrenheit in English)
HID_GLOBAL_UNIT_TEMPERATURE_SHIFT = 16;  
 
HID_GLOBAL_UNIT_CURRENT_MASK = $F; Current (Amperes)
HID_GLOBAL_UNIT_CURRENT_SHIFT = 20;  
 
HID_GLOBAL_UNIT_LIGHT_MASK = $F; Luminous Intensity (Candelas)
HID_GLOBAL_UNIT_LIGHT_SHIFT = 24;  
 
Common HID Global Item Unit Value
For a more detailed list see the k.0UNIT definitions in https://github.com/abend0c1/hidrdd/blob/master/rd.rex
SI Base Units
HID_GLOBAL_UNIT_SI_ROTATION = $00000012; Rotation (Radians)
HID_GLOBAL_UNIT_SI_LENGTH = $00000011; Length (Centimeters)
HID_GLOBAL_UNIT_SI_MASS = $00000101; Mass (Grams)
HID_GLOBAL_UNIT_SI_TIME = $00001001; Time (Seconds)
HID_GLOBAL_UNIT_SI_TEMPERATURE = $00010001; Temperature (Kelvin)
HID_GLOBAL_UNIT_SI_CURRENT = $00100001; Current (Amperes)
HID_GLOBAL_UNIT_SI_LIGHT = $01000001; Luminous Intensity (Candelas)
SI Derived Unit
HID_GLOBAL_UNIT_SI_AREA = $00000021; Area (Square Centimeters)
HID_GLOBAL_UNIT_SI_VOLUME = $00000031; Volume (Cubic Centimeters)
HID_GLOBAL_UNIT_SI_VELOCITY = $0000F011; Velocity (Centimeters per second)
HID_GLOBAL_UNIT_SI_ACCELERATION = $0000E011; Acceleration (Centimeters per second squared)
 
HID_GLOBAL_UNIT_SI_FREQUENCY = $0000F001; Frequency (Hertz)
HID_GLOBAL_UNIT_SI_FORCE = $0000E111; Force (Newtons)
HID_GLOBAL_UNIT_SI_PRESSURE = $0000E1F1; Pressure (Pascals)
HID_GLOBAL_UNIT_SI_ENERGY = $0000E121; Energy (Joules)
HID_GLOBAL_UNIT_SI_POWER = $0000D121; Power (Watts)
English Base Unit
HID_GLOBAL_UNIT_ENGLISH_ROTATION = $00000014; Rotation (Degrees)
HID_GLOBAL_UNIT_ENGLISH_LENGTH = $00000013; Length (Inches)
HID_GLOBAL_UNIT_ENGLISH_TIME = $00001003; Time (Seconds)
HID_GLOBAL_UNIT_ENGLISH_TEMPERATURE = $00010003; Temperature (Fahrenheit)
HID_GLOBAL_UNIT_ENGLISH_CURRENT = $00100003; Current (Amperes)
HID_GLOBAL_UNIT_ENGLISH_LIGHT = $01000003; Luminous Intensity (Candelas)
 
HID_GLOBAL_UNIT_ENGLISH_AREA = $00000023; Area (Square Inches)
HID_GLOBAL_UNIT_ENGLISH_VOLUME = $00000033; Volume (Cubic Inches)
 
HID Global Item Unit Exponent Values
See Section 6.2.2.7
HID_GLOBAL_UNIT_EXPONENTS:array[$0..$F] of LongInt = (
0,  
1,  
2,  
3,  
4,  
5,  
6,  
7,  
-8,  
-7,  
-6,  
-5,  
-4,  
-3,  
-2,  
-1);  
 
HID_GLOBAL_UNIT_MULTIPLIERS:array[$0..$F] of Double = (
1, 10^0
10, 10^1
100, 10^2
1000, 10^3
10000, 10^4
100000, 10^5
1000000, 10^6
10000000, 10^7
0.00000001, 10^-8
0.0000001, 10^-7
0.000001, 10^-6
0.00001, 10^-5
0.0001, 10^-4
0.001, 10^-3
0.01, 10^-2
0.1); 10^-1


HID local item delimiter HID_LOCAL_DELIMITER_*
See Section 6.2.2.8
 
HID_LOCAL_DELIMITER_CLOSE = 0;  
HID_LOCAL_DELIMITER_OPEN = 1;  


HID physical descriptor bias HID_PHYSICAL_BIAS_*
See Section 6.2.3
 
HID_PHYSICAL_BIAS_NONE = (0 shl 5); Not applicable
HID_PHYSICAL_BIAS_RIGHT_HAND = (1 shl 5); Right hand
HID_PHYSICAL_BIAS_LEFT_HAND = (2 shl 5); Left hand
HID_PHYSICAL_BIAS_BOTH_HANDS = (3 shl 5); Both hands
HID_PHYSICAL_BIAS_EITHER_HAND = (4 shl 5); Either hand


HID physical descriptor designator HID_PHYSICAL_DESIGNATOR_*
See Section 6.2.3
 
HID_PHYSICAL_DESIGNATOR_NONE = $00; None
HID_PHYSICAL_DESIGNATOR_HAND = $01; Hand
HID_PHYSICAL_DESIGNATOR_EYEBALL = $02; Eyeball
HID_PHYSICAL_DESIGNATOR_EYEBROW = $03; Eyebrow
HID_PHYSICAL_DESIGNATOR_EYELID = $04; Eyelid
HID_PHYSICAL_DESIGNATOR_EAR = $05; Ear
HID_PHYSICAL_DESIGNATOR_NOSE = $06; Nose
HID_PHYSICAL_DESIGNATOR_MOUTH = $07; Mouth
HID_PHYSICAL_DESIGNATOR_UPPER_LIP = $08; Upper lip
HID_PHYSICAL_DESIGNATOR_LOWER_LIP = $09; Lower lip
HID_PHYSICAL_DESIGNATOR_JAW = $0A; Jaw
HID_PHYSICAL_DESIGNATOR_NECK = $0B; Neck
HID_PHYSICAL_DESIGNATOR_UPPER_ARM = $0C; Upper arm
HID_PHYSICAL_DESIGNATOR_ELBOW = $0D; Elbow
HID_PHYSICAL_DESIGNATOR_FOREARM = $0E; Forearm
HID_PHYSICAL_DESIGNATOR_WRIST = $0F; Wrist
HID_PHYSICAL_DESIGNATOR_PALM = $10; Palm
HID_PHYSICAL_DESIGNATOR_THUMB = $11; Thumb
HID_PHYSICAL_DESIGNATOR_INDEX_FINGER = $12; Index finger
HID_PHYSICAL_DESIGNATOR_MIDDLE_FINGER = $13; Middle finger
HID_PHYSICAL_DESIGNATOR_RING_FINGER = $14; Ring finger
HID_PHYSICAL_DESIGNATOR_LITTLE_FINGER = $15; Little finger
HID_PHYSICAL_DESIGNATOR_HEAD = $16; Head
HID_PHYSICAL_DESIGNATOR_SHOULDER = $17; Shoulder
HID_PHYSICAL_DESIGNATOR_HIP = $18; Hip
HID_PHYSICAL_DESIGNATOR_WAIST = $19; Waist
HID_PHYSICAL_DESIGNATOR_THIGH = $1A; Thigh
HID_PHYSICAL_DESIGNATOR_KNEE = $1B; Knee
HID_PHYSICAL_DESIGNATOR_CALF = $1C; Calf
HID_PHYSICAL_DESIGNATOR_ANKLE = $1D; Ankle
HID_PHYSICAL_DESIGNATOR_FOOT = $1E; Foot
HID_PHYSICAL_DESIGNATOR_HEEL = $1F; Heel
HID_PHYSICAL_DESIGNATOR_BALL_OF_FOOT = $20; Ball of foot
HID_PHYSICAL_DESIGNATOR_BIG_TOE = $21; Big toe
HID_PHYSICAL_DESIGNATOR_SECOND_TOE = $22; Second toe
HID_PHYSICAL_DESIGNATOR_THIRD_TOE = $23; Third toe
HID_PHYSICAL_DESIGNATOR_FOURTH_TOE = $24; Fourth toe
HID_PHYSICAL_DESIGNATOR_LITTLE_TOE = $25; Little toe
HID_PHYSICAL_DESIGNATOR_BROW = $26; Brow
HID_PHYSICAL_DESIGNATOR_CHEEK = $27; Cheek


HID physical descriptor qualifier HID_PHYSICAL_QUALIFIER_*
See Section 6.2.3
 
HID_PHYSICAL_QUALIFIER_NONE = (0 shl 5); Not applicable
HID_PHYSICAL_QUALIFIER_RIGHT = (1 shl 5); Right
HID_PHYSICAL_QUALIFIER_LEFT = (2 shl 5); Left
HID_PHYSICAL_QUALIFIER_BOTH = (3 shl 5); Both
HID_PHYSICAL_QUALIFIER_EITHER = (4 shl 5); Either
HID_PHYSICAL_QUALIFIER_CENTER = (5 shl 5); Center


HID usage page HID_PAGE_*
See HID Usage Tables 1.3
 
HID_PAGE_UNDEFINED = $00; Undefined
HID_PAGE_GENERIC_DESKTOP = $01; Generic Desktop Page
HID_PAGE_SIMULATION_CONTROLS = $02; Simulation Controls Page
HID_PAGE_VR_CONTROLS = $03; VR Controls Page
HID_PAGE_SPORT_CONTROLS = $04; Sport Controls Page
HID_PAGE_GAME_CONTROLS = $05; Game Controls Page
HID_PAGE_GENERIC_DEVICE_CONTROLS = $06; Generic Device Controls Page
HID_PAGE_KEYBOARD_KEYPAD = $07; Keyboard/Keypad Page
HID_PAGE_LED = $08; LED Page
HID_PAGE_BUTTON = $09; Button Page
HID_PAGE_ORDINAL = $0A; Ordinal Page
HID_PAGE_TELEPHONY_DEVICE = $0B; Telephony Device Page
HID_PAGE_CONSUMER = $0C; Consumer Page
HID_PAGE_DIGITIZERS = $0D; Digitizers Page
HID_PAGE_HAPTICS = $0E; Haptics Page
HID_PAGE_PHYSICAL_INPUT_DEVICE = $0F; Physical Input Device Page
HID_PAGE_UNICODE = $10; Unicode Page
0x11-0x11 Reserved
HID_PAGE_EYE_AND_HEAD_TRACKERS = $12; Eye and Head Trackers Page
0x13-0x13 Reserved
HID_PAGE_AUXILIARY_DISPLAY = $14; Auxiliary Display Page
0x15-0x1F Reserved
HID_PAGE_SENSORS = $20; Sensors Page
0x21-0x3F Reserved
HID_PAGE_MEDICAL_INSTRUMENT = $40; Medical Instrument Page
HID_PAGE_BRAILLE_DISPLAY = $41; Braille Display Page
0x42-0x58 Reserved
HID_PAGE_LIGHTING_AND_ILLUMINATION = $59; Lighting And Illumination Page
0x5A-0x7F Reserved
HID_PAGE_MONITOR = $80; Monitor Page
HID_PAGE_MONITOR_ENUMERATED = $81; Monitor Enumerated Page
HID_PAGE_VESA_VIRTUAL_CONTROLS = $82; VESA Virtual Controls Page
0x83-0x83 Reserved
HID_PAGE_POWER = $84; Power Page
HID_PAGE_BATTERY_SYSTEM = $85; Battery System Page
0x86-0x8B Reserved
HID_PAGE_BARCODE_SCANNER = $8C; Barcode Scanner Page
HID_PAGE_SCALES = $8D; Scales Page
HID_PAGE_MAGNETIC_STRIPE_READER = $8E; Magnetic Stripe Reader Page
0x8F-0x8F Reserved
HID_PAGE_CAMERA_CONTROL = $90; Camera Control Page
HID_PAGE_ARCADE = $91; Arcade Page
HID_PAGE_GAMING_DEVICE = $92; Gaming Device Page
0x93-0xF1CF Reserved
HID_PAGE_FIDO_ALLIANCE = $F1D0; FIDO Alliance Page
0xF1D1-0xFEFF Reserved
0xFF00-0xFFFF Vendor-defined


HID usage table HID_DESKTOP_*
See HID Usage Tables 1.3)
HID Generic Desktop Page (Partial)
HID_DESKTOP_UNDEFINED = $00; Undefined
HID_DESKTOP_POINTER = $01; Pointer
HID_DESKTOP_MOUSE = $02; Mouse
0x03-0x03 Reserved
HID_DESKTOP_JOYSTICK = $04; Joystick
HID_DESKTOP_GAMEPAD = $05; Gamepad
HID_DESKTOP_KEYBOARD = $06; Keyboard
HID_DESKTOP_KEYPAD = $07; Keypad
HID_DESKTOP_MULTI_AXIS_CONTROLLER = $08; Multi-axis Controller
HID_DESKTOP_TABLET_PC_SYSTEM_CONTROLS = $09; Tablet PC System Controls
HID_DESKTOP_WATER_COOLING_DEVICE = $0A; Water Cooling Device
HID_ID_DESKTOP_COMPUTER_CHASSIS_DEVICE = $0B; Computer Chassis Device
HHID_DESKTOP_WIRELESS_RADIO_CONTROLS = $0C; Wireless Radio Controls
HID_DESKTOP_PORTABLE_DEVICE_CONTROL = $0D; Portable Device Control
HID_DESKTOP_SYSTEM_MULTI_AXIS_CONTROLLER = $0E; System Multi-Axis Controller
HID_DESKTOP_SPATIAL_CONTROLLER = $0F; Spatial Controller
HID_DESKTOP_ASSISTIVE_CONTROL = $10; Assistive Control
HID_DESKTOP_DEVICE_DOCK = $11; Device Dock
HID_DESKTOP_DOCKABLE_DEVICE = $12; Dockable Device
HID_DESKTOP_CALL_STATE_MANAGEMENT_CONTROL = $13; Call State Management Control
0x14-0x2F Reserved
HID_DESKTOP_X = $30; X
HID_DESKTOP_Y = $31; Y
HID_DESKTOP_Z = $32; Z
HID_DESKTOP_RX = $33; Rx
HID_DESKTOP_RY = $34; Ry
HID_DESKTOP_RZ = $35; Rz
HID_DESKTOP_SLIDER = $36; Slider
HID_DESKTOP_DIAL = $37; Dial
HID_DESKTOP_WHEEL = $38; Wheel
HID_DESKTOP_HAT_SWITCH = $39; Hat Switch
HID_DESKTOP_COUNTED_BUFFER = $3A; Counted Buffer
HID_DESKTOP_BYTE_COUNT = $3B; Byte Count
HID_DESKTOP_MOTION_WAKEUP = $3C; Motion Wakeup
HID_DESKTOP_START = $3D; Start
HID_DESKTOP_SELECT = $3E; Select
0x3F-0x3F Reserved
HID_DESKTOP_VX = $40; Vx
HID_DESKTOP_VY = $41; Vy
HID_DESKTOP_VZ = $42; Vz
HID_DESKTOP_VBRX = $43; Vbrx
HID_DESKTOP_VBRY = $44; Vbry
HID_DESKTOP_VBRZ = $45; Vbrz
HID_DESKTOP_VNO = $46; Vno
HID_DESKTOP_FEATURE_NOTIFICATION = $47; Feature Notification
HID_DESKTOP_RESOLUTION_MULTIPLIER = $48; Resolution Multiplier
HID_DESKTOP_QX = $49; Qx
HID_DESKTOP_QY = $4A; Qy
HID_DESKTOP_QZ = $4B; Qz
HID_DESKTOP_QW = $4C; Qw


HID keyboard/keypad SCAN_CODE_*
Note: These are the same as the SCAN_CODE_* values in GlobalConst


HID LED (Partial) HID_LED_*
HID_LED_UNDEFINED = 00; Undefined
HID_LED_NUM_LOCK = 01; Num Lock
HID_LED_CAPS_LOCK = 02; Caps Lock
HID_LED_SCROLL_LOCK = 03; Scroll Lock
HID_LED_COMPOSE = 04; Compose
HID_LED_KANA = 05; Kana
HID_LED_POWER = 06; Power
HID_LED_SHIFT = 07; Shift
HID_LED_DO_NOT_DISTURB = 08; Do Not Disturb
HID_LED_MUTE = 09; Mute


HID button (Partial) HID_BUTTON_*
HID_BUTTON_NONE = 0;  
HID_BUTTON_1 = 1;  
HID_BUTTON_2 = 2;  
HID_BUTTON_3 = 3;  
HID_BUTTON_4 = 4;  
HID_BUTTON_5 = 5;  
HID_BUTTON_PRIMARY = HID_BUTTON_1;  
HID_BUTTON_SECONDARY = HID_BUTTON_2;  
HID_BUTTON_TERTIARY = HID_BUTTON_3;  
Note: Buttons are defined as Button 1 to Button 65535
HID_BUTTON_65535 = $FFFF;  


HID digitizers (Partial) HID_DIGITIZERS_*
HID_DIGITIZERS_UNDEFINED = $00; Undefined
HID_DIGITIZERS_DIGITIZER = $01; Digitizer
HID_DIGITIZERS_PEN = $02; Pen
HID_DIGITIZERS_LIGHT_PEN = $03; Light Pen
HID_DIGITIZERS_TOUCH_SCREEN = $04; Touch Screen
HID_DIGITIZERS_TOUCH_PAD = $05; Touch Pad
HID_DIGITIZERS_WHITEBOARD = $06; Whiteboard
HID_DIGITIZERS_COORD_MEASURING = $07; Coordinate Measuring Machine
HID_DIGITIZERS_3D_DIGITIZER = $08; 3D Digitizer
HID_DIGITIZERS_STEREO_PLOTTER = $09; Stereo Plotter
HID_DIGITIZERS_ARTICULATED_ARM = $0A; Articulated Arm
HID_DIGITIZERS_ARMATURE = $0B; Armature
HID_DIGITIZERS_MULTI_POINT_DIGITIZER = $0C; Multiple Point Digitizer
HID_DIGITIZERS_FREE_SPACE_WAND = $0D; Free Space Wand
HID_DIGITIZERS_DEVICE_CONFIGURATION = $0E; Device Configuration
HID_DIGITIZERS_CAPACITIVE_HEAT_MAP = $0F; Capacitive Heat Map Digitizer
0x10-0x1F Reserved
HID_DIGITIZERS_STYLUS = $20; Stylus
HID_DIGITIZERS_PUCK = $21; Puck
HID_DIGITIZERS_FINGER = $22; Finger
HID_DIGITIZERS_DEVICE_SETTINGS = $23; Device settings
HID_DIGITIZERS_CHARACTER_GESTURE = $24; Character Gesture
0x25-0x2F Reserved
HID_DIGITIZERS_TIP_PRESSURE = $30; Tip Pressure
HID_DIGITIZERS_BARREL_PRESSURE = $31; Barrel Pressure
HID_DIGITIZERS_IN_RANGE = $32; In Range
HID_DIGITIZERS_TOUCH = $33; Touch
HID_DIGITIZERS_UNTOUCH = $34; Untouch
HID_DIGITIZERS_TAP = $35; Tap
HID_DIGITIZERS_QUALITY = $36; Quality
HID_DIGITIZERS_DATA_VALID = $37; Data Valid
HID_DIGITIZERS_TRANSDUCER_INDEX = $38; Transducer Index
HID_DIGITIZERS_TABLET_FUNCTION_KEYS = $39; Tablet Function Keys
HID_DIGITIZERS_PROGRAM_CHANGE_KEYS = $3A; Program Change Keys
HID_DIGITIZERS_BATTERY_STRENGTH = $3B; Battery Strength
HID_DIGITIZERS_INVERT = $3C; Invert
HID_DIGITIZERS_X_TILT = $3D; X Tilt
HID_DIGITIZERS_Y_TILT = $3E; Y Tilt
HID_DIGITIZERS_AZIMUTH = $3F; Azimuth
HID_DIGITIZERS_ALTITUDE = $40; Altitude
HID_DIGITIZERS_TWIST = $41; Twist
HID_DIGITIZERS_TIP_SWITCH = $42; Tip Switch
HID_DIGITIZERS_SECONDARY_TIP_SWITCH = $43; Secondary Tip Switch
HID_DIGITIZERS_BARREL_SWITCH = $44; Barrel Switch
HID_DIGITIZERS_ERASER = $45; Eraser
HID_DIGITIZERS_TABLET_PICK = $46; Tablet Pick
HID_DIGITIZERS_TOUCH_VALID = $47; Touch Valid (Confidence)
HID_DIGITIZERS_WIDTH = $48; Width
HID_DIGITIZERS_HEIGHT = $49; Height
0x4A-0x50 Reserved
HID_DIGITIZERS_CONTACT_IDENTIFIER = $51; Contact Identifier
HID_DIGITIZERS_DEVICE_MODE = $52; Device Mode
HID_DIGITIZERS_DEVICE_IDENTIFIER = $53; Device Identifier
HID_DIGITIZERS_CONTACT_COUNT = $54; Contact Count
HID_DIGITIZERS_CONTACT_COUNT_MAXIMUM = $55; Contact Count Maximum
HID_DIGITIZERS_SCAN_TIME = $56; Scan Time


HID logging HID_LOG_*
HID_LOG_LEVEL_DEBUG = LOG_LEVEL_DEBUG; HID debugging messages
HID_LOG_LEVEL_INFO = LOG_LEVEL_INFO; HID informational messages, such as a device being attached or detached.
HID_LOG_LEVEL_WARN = LOG_LEVEL_WARN; HID warning messages
HID_LOG_LEVEL_ERROR = LOG_LEVEL_ERROR; HID error messages
HID_LOG_LEVEL_NONE = LOG_LEVEL_NONE; No HID messages


Type definitions



HID descriptor

PHIDDescriptor = ^THIDDescriptor;

THIDDescriptor = packed record

See Section 6.2.1
bLength:Byte;  
bDescriptorType:Byte;  
bcdHID:Word;  
bCountryCode:Byte;  
bNumDescriptors:Byte;  
bHIDDescriptorType:Byte;  
wHIDDescriptorLength:Word;  
Note: Up to two optional bHIDDescriptorType/wHIDDescriptorLength pairs after the Report descriptor details

HID report descriptor

PHIDReportDescriptor = Pointer;

See Section 6.2.2
   

HID physical descriptor

PHIDPhysicalDescriptor = ^THIDPhysicalDescriptor;

THIDPhysicalDescriptor = packed record

See Section 6.2.3
bDesignator:Byte; Indicates which part of the body affects the item
bFlags:Byte; Bits specifying flags (7..5 Qualifier / 4..0 Effort)

HID physical descriptor set0

PHIDPhysicalDescriptorSet0 = ^THIDPhysicalDescriptorSet0;

THIDPhysicalDescriptorSet0 = packed record

bNumber:Byte; Number of Physical Descriptor sets not including Physical Descriptor set 0
wLength:Word; Length of each Physical descriptor set

HID physical descriptor set

PHIDPhysicalDescriptorSet = ^THIDPhysicalDescriptorSet;

THIDPhysicalDescriptorSet = packed record

bPhysicalInfo:Byte; Bits specifying physical information (7..5 Bias / 4..0 Preference)
wPhysicalDescriptor:array[0..0] of THIDPhysicalDescriptor; Physical descriptor data

HID state

PHIDState = ^THIDState;

THIDState = record

Local State
Usage:LongWord;  
UsageCount:LongWord; Provides UsageMinimum/UsageMaximum
DesignatorIndex:LongWord;  
DesignatorCount:LongWord; Provides DesignatorMinimum/DesignatorMaximum
StringIndex:LongWord;  
StringCount:LongWord; Provides StringMinimum/StringMaximum
Delimiter:Boolean;  
Global State
UsagePage:Word;  
LogicalMinimum:LongInt;  
LogicalMaximum:LongInt;  
PhysicalMinimum:LongInt;  
PhysicalMaximum:LongInt;  
UnitType:LongWord;  
UnitExponent:LongWord;  
ReportSize:LongWord;  
ReportId:LongWord;  
ReportCount:LongWord;  

HID stack

PHIDStack = ^THIDStack;

THIDStack = record

State:PHIDState;  
Next:PHIDStack;  

HID usages

PHIDUsages = ^THIDUsages;

THIDUsages = array[0..0] of PHIDUsage;

   

HID usage

PHIDUsage = ^THIDUsage;

THIDUsage = record

Page:Word; The usage page this usage refers to
Usage:Word; The usage within the usage page
Count:Word; The total number of sequential usages where Usage represents the minimum value or 1 for a single usage (Usage range is from Usage to Usage + Count - 1)
 
Index:LongWord; The index of this usage in the report (First usage is 0)
 
StringIndex:LongWord; The string index for this usage
StringCount:LongWord; The total number of sequential string index values where string index represents the minimum value or 1 for a single string
 
DesignatorIndex:LongWord; The designator index for this usage
DesignatorCount:LongWord; The total number of sequential designator index values where designator index represents the minimum value or 1 for a single designator
 
LogicalMinimum:LongInt; The logical minimum value for this usage
LogicalMaximum:LongInt; The logical maximum value for this usage
PhysicalMinimum:LongInt; The physical minimum value for this usage (in Units)
PhysicalMaximum:LongInt; The physical maximum value for this usage (in Units)
UnitType:LongWord; The unit type for this usage
UnitExponent:LongWord; The unit exponent index for this usage
 
Aliases:PHIDUsages; The list of aliased usages for this control (See Delimiters in Section 6.2.2.8)
AliasCount:LongWord; The number of aliased usages contained for this control
 
Report:PHIDReport; The report this usage belongs to

HID reports

PHIDReports = ^THIDReports;

THIDReports = array[0..0] of PHIDReport;

   

HID report

PHIDReport = ^THIDReport;

THIDReport = record

Id:Byte; The Id of this report
Kind:Byte; The type of report (Input, Output or Feature) (eg HID_REPORT_INPUT)
Flags:LongWord; The main item flags for this report (eg HID_MAIN_ITEM_VARIABLE)
 
Size:LongWord; The number of bits per field in this report
Count:LongWord; The number of fields in this report
 
Index:LongWord; The index of this report in the collection (First report is 0)
Sequence:LongWord; The sequence of this report in all collections (First report is 0)
 
Usages:PHIDUsages; The list of usages contained in this report
UsageCount:LongWord; The number of usages contained in this report
 
Collection:PHIDCollection; The collection this report belongs to

HID collections

PHIDCollections = ^THIDCollections;

THIDCollections = array[0..0] of PHIDCollection;

   

HID collection

PHIDCollection = ^THIDCollection;

THIDCollection = record

Page:Word; The usage page this collection refers to (eg HID_PAGE_GENERIC_DESKTOP)
Usage:Word; The usage within the usage page (eg HID_DESKTOP_MOUSE)
Flags:LongWord; The main item flags for this collection (eg HID_MAIN_COLLECTION_APPLICATION)
 
Start:LongWord; The first byte of this collection in the report descriptor
 
Reports:PHIDReports; The list of reports contained in this collection
ReportCount:LongWord; The number of reports contained in this collection
Collections:PHIDCollections; The list of collections contained in this collection
CollectionCount:LongWord; The number of collections contained in this collection
 
Parent:PHIDCollection; The parent collection or nil if this is a top level collection
 
Device:PHIDDevice; The device this collection belongs to
Consumer:PHIDConsumer; The consumer which is bound to this collection (or nil if not bound)
PrivateData:Pointer; Private data for the consumer of this collection

HID device enumeration callback

THIDDeviceEnumerate = function(Device:PHIDDevice;Data:Pointer):LongWord;

HID device notification callback

THIDDeviceNotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;

HID device get idle

THIDDeviceGetIdle = function(Device:PHIDDevice; var Duration:Word; ReportId:Byte):LongWord;

HID device set idle

THIDDeviceSetIdle = function(Device:PHIDDevice; Duration:Word; ReportId:Byte):LongWord;

HID device get report

THIDDeviceGetReport = function(Device:PHIDDevice; ReportType,ReportId:Byte; ReportData:Pointer; ReportSize:LongWord):LongWord;

HID device set report

THIDDeviceSetReport = function(Device:PHIDDevice; ReportType,ReportId:Byte; ReportData:Pointer; ReportSize:LongWord):LongWord;

HID device allocate report

THIDDeviceAllocateReport = function(Device:PHIDDevice; Collection:PHIDCollection; ReportId:Byte; ReportSize:LongWord):LongWord;

HID device release report

THIDDeviceReleaseReport = function(Device:PHIDDevice; ReportId:Byte):LongWord;

HID device submit report

THIDDeviceSubmitReport = function(Device:PHIDDevice; ReportId:Byte):LongWord;

HID device cancel report

THIDDeviceCancelReport = function(Device:PHIDDevice; ReportId:Byte):LongWord;

HID device get protocol

THIDDeviceGetProtocol = function(Device:PHIDDevice; var Protocol:Byte):LongWord;

HID device set protocol

THIDDeviceSetProtocol = function(Device:PHIDDevice; Protocol:Byte):LongWord;

HID device get interval

THIDDeviceGetInterval = function(Device:PHIDDevice; var Interval:LongWord):LongWord;

HID device set interval

THIDDeviceSetInterval = function(Device:PHIDDevice; Interval:LongWord):LongWord;

HID device get report descriptor

THIDDeviceGetReportDescriptor = function(Device:PHIDDevice; Descriptor:PHIDReportDescriptor; Size:LongWord):LongWord;

HID device get physical descriptor set0

THIDDeviceGetPhysicalDescriptorSet0 = function(Device:PHIDDevice; Descriptor:PHIDPhysicalDescriptorSet0):LongWord;

HID device get physical descriptor set

THIDDeviceGetPhysicalDescriptorSet = function(Device:PHIDDevice; Descriptor:PHIDPhysicalDescriptorSet; Index:Byte; Size:LongWord):LongWord;

HID device

PHIDDevice = ^THIDDevice;

THIDDevice = record

Device Properties
Device:TDevice; The Device entry for this HID
HID Properties
HIDId:LongWord; Unique Id of this HID in the HID device table
HIDState:LongWord; HID device state (eg HID_STATE_ATTACHED)
Consumer:PHIDConsumer; The consumer which is bound to this device (or nil if not bound)
DeviceGetIdle:THIDDeviceGetIdle; A device specific GetIdle method (If supported by provider)
DeviceSetIdle:THIDDeviceSetIdle; A device specific SetIdle method (If supported by provider)
DeviceGetReport:THIDDeviceGetReport; A device specific GetReport method (If supported by provider)
DeviceSetReport:THIDDeviceSetReport; A device specific SetReport method (If supported by provider)
DeviceAllocateReport:THIDDeviceAllocateReport; A device specific AllocateReport method (If supported by provider)
DeviceReleaseReport:THIDDeviceReleaseReport; A device specific ReleaseReport method (If supported by provider)
DeviceSubmitReport:THIDDeviceSubmitReport; A device specific SubmitReport method (If supported by provider)
DeviceCancelReport:THIDDeviceCancelReport; A device specific CancelReport method (If supported by provider)
DeviceGetProtocol:THIDDeviceGetProtocol; A device specific GetProtocol method (If supported by provider)
DeviceSetProtocol:THIDDeviceSetProtocol; A device specific SetProtocol method (If supported by provider)
DeviceGetInterval:THIDDeviceGetInterval; A device specific GetInterval method (If supported by provider)
DeviceSetInterval:THIDDeviceSetInterval; A device specific SetInterval method (If supported by provider)
DeviceGetReportDescriptor:THIDDeviceGetReportDescriptor; A device specific GetReportDescriptor method (If supported by provider)
DeviceGetPhysicalDescriptorSet0:THIDDeviceGetPhysicalDescriptorSet0; A device specific GetPhysicalDescriptorSet0 method (If supported by provider)
DeviceGetPhysicalDescriptorSet:THIDDeviceGetPhysicalDescriptorSet; A device specific GetPhysicalDescriptorSet method (If supported by provider)
Driver Properties
Lock:TMutexHandle; HID device lock
PrivateData:Pointer; Private data for the consumer of this HID device (If applicable)
Collections:PHIDCollections; The parsed report descriptor with collections, reports and usages
CollectionCount:LongWord; The number of top level collections contained in the report descriptor
Descriptor:PHIDReportDescriptor; The raw report descriptor obtained from the device
DescriptorSize:LongWord; The size of the data pointed to by Descriptor
Statistics Properties
ReceiveCount:LongWord;  
ReceiveErrors:LongWord;  
Internal Properties
Prev:PHIDDevice; Previous entry in Device table
Next:PHIDDevice; Next entry in Device table

HID consumer enumeration callback

THIDConsumerEnumerate = function(Consumer:PHIDConsumer; Data:Pointer):LongWord;

HID device bind

THIDDeviceBind = function(Device:PHIDDevice):LongWord;

HID device unbind

THIDDeviceUnbind = function(Device:PHIDDevice):LongWord;

HID collection bind

THIDCollectionBind = function(Device:PHIDDevice; Collection:PHIDCollection):LongWord;

HID collection unbind

THIDCollectionUnbind = function(Device:PHIDDevice; Collection:PHIDCollection):LongWord;

HID report receive

THIDReportReceive = function(Collection:PHIDCollection; ReportId:Byte; ReportData:Pointer; ReportSize:LongWord):LongWord;

HID consumer

PHIDConsumer = ^THIDConsumer;

THIDConsumer = record

Driver Properties
Driver:TDriver; The Driver entry for this HID Consumer
Consumer Properties
DeviceBind:THIDDeviceBind; A Device Bind method to be called when a HID device bind is requested by a provider (Optional)
DeviceUnbind:THIDDeviceUnbind; A Device Ubind method to be called when a HID device unbind is requested by a provider (Optional)
CollectionBind:THIDCollectionBind; A Collection Bind method to be called when a HID collection bind is requested by a provider (Mandatory)
CollectionUnbind:THIDCollectionUnbind; A Collection Unbind method to be called when a HID collection unbind is requested by a provider (Mandatory)
ReportReceive:THIDReportReceive; A Report Receive method to be called when a HID input report is received by a provider (Mandatory)
Interface Properties
Lock:TMutexHandle; Consumer lock
Internal Properties
Prev:PHIDConsumer; Previous entry in Consumer table
Next:PHIDConsumer; Next entry in Consumer table

HID report extent

PHIDExtent = ^THIDExtent;

THIDExtent = record

Minimum:LongInt; The minimum value for this extent
Maximum:LongInt; The maximum value for this extent

HID report field

PHIDField = ^THIDField;

THIDField = record

Page:Word; The usage page of this field
Usage:Word; The usage within the usage page
Count:LongWord; The total number of sequential usages where Usage represents the minimum value or 1 for a single usage (Usage range is from Usage to Usage + Count - 1)
 
Flags:LongWord; The flags for this field
 
Size:LongWord; The length in bytes of this field within the input, output or feature report
Bits:LongWord; The length in bits of this field within the input, output or feature report
Offset:LongWord; The byte offset of this field within the input, output or feature report
Shift:LongWord; The number shift bits to access this field in the input, output or feature report
 
Logical:THIDExtent; The minimum and maximum logical values for this field
Physical:THIDExtent; The minimum and maximum physical values for this field
Multiplier:Double; The conversion multiplier for this field from logical to physical units
Resolution:Double; The unit resolution for this field in counts per physical unit
 
Next:PHIDField; The next field in the list

HID report definition

PHIDDefinition = ^THIDDefinition;

THIDDefinition = record

Id:Byte; The Id of this report
Kind:Byte; The type of this report (Input, Output or Feature)
Size:LongWord; The total length of this input, output or feature report in bytes (Including the Id byte)
Fields:PHIDField; Linked list of fields in this input, output or feature report
 
Next:PHIDDefinition; The next definition in the list


Public variables



HID logging

HID_DEFAULT_LOG_LEVEL:LongWord = HID_LOG_LEVEL_DEBUG; Minimum level for HID messages. Only messages with level greater than or equal to this will be printed.
HID_LOG_ENABLED:Boolean;


Function declarations



Initialization functions

procedure HIDInit;
Description: Initialize the HID unit, device and consumer tables
Note Called only during system startup


HID functions

function HIDParserParseCollections(Device:PHIDDevice; var Collections:PHIDCollections; var Count:LongWord):LongWord;
Description: Parse the HID report descriptor of the provided device and populate the collections, reports and usages
Device The HID device to parse collections for
Collections A pointer to the top level collections array to be populated
Count A variable to return the number of top level collections
Return ERROR_SUCCESS if completed or another error code on failure


function HIDParserFreeCollections(Collections:PHIDCollections; Count:LongWord):LongWord;
Description: Free the collections, reports and usages parsed from a HID report descriptor
Collections A pointer to the top level collections array to be freed
Count The number of top level collections in the array
Return ERROR_SUCCESS if completed or another error code on failure


function HIDParserCountCollections(Device:PHIDDevice; Parent:PHIDCollection):LongWord;
Description: Count the number of collections found in the HID report descriptor of the provided device
Device The HID device to count collections for
Parent The parent HID collection, if supplied count child collections else count top level collections
Return The number of collections found, 0 if none for or on error


function HIDParserCountReports(Device:PHIDDevice; Collection:PHIDCollection):LongWord;
Description: Count the number of reports found in the HID report descriptor of the supplied device and collection
Device The HID device to count reports for
Collection The HID collection to count reports for
Return The number of reports found, 0 if none for or on error


function HIDParserCountUsages(Device:PHIDDevice; Report:PHIDReport):LongWord;
Description: Count the number of usages found in the HID report descriptor for the supplied device and report
Device The HID device to count usages for
Report The HID report to count usages for
Return The number of usages found, 0 if none for or on error


function HIDParserAllocateCollection(Device:PHIDDevice; Parent:PHIDCollection; State:PHIDState; Flags,Start:LongWord):PHIDCollection;
Description: Allocate a HID collection to contain a set of reports and usages from a HID report descriptor
Device The HID device containing the collection
Parent The HID collection containing the collection (or nil for a top level collection)
State The current HID parser state
Flags The flags for the collection from the HID report descriptor
Start The starting byte offset of the collection in the HID report descriptor
Return A pointer to the HID collection or nil on error


function HIDParserAllocateReport(Device:PHIDDevice; Collection:PHIDCollection; State:PHIDState; Kind:Byte; Flags,Index,Sequence:LongWord):PHIDReport;
Description: Allocate a HID report to contain a set of usages from a HID report descriptor
Device The HID device containing the report
Collection The HID collection containing the report
State The current HID parser state
Kind The report kind (eg HID_REPORT_INPUT)
Flags The flags for the report from the HID report descriptor
Index The index of this report in the collection (First report is 0)
Sequence The sequence of this report in all collections (First report is 0)
Return A pointer to the HID report or nil on error


function HIDParserAllocateUsage(Device:PHIDDevice; Report:PHIDReport; State:PHIDState; Index:LongWord):PHIDUsage;
Description: Allocate a HID usage from a HID report descriptor
Device The HID device containing the usage
Report The HID report containing the usage
State The current HID parser state
Index The index of this usage in the report (First usage is 0)
Return A pointer to the HID usage or nil on error


function HIDParserUpdateUsage(Device:PHIDDevice; Report:PHIDReport; State:PHIDState; Usage:PHIDUsage):Boolean;
Description: Update a HID usage from a HID report descriptor
Device The HID device containing the usage
Report The HID report containing the usage
State The current HID parser state
Usage The HID usage to update
Return True if completed or False on error
Note As usages must precede the main item they relate to in the HID report descriptor they need to be allocated before all the required information is known, this function updates the usage after the main item is found.


function HIDParserFreeUsage(Device:PHIDDevice;Usage:PHIDUsage):Boolean;
Description: Free a HID usage and any associated usage aliases
Device The HID device containing the usage
Usage The HID usage to free
Return True if completed or False on error


function HIDParserPopStack(var Stack:PHIDStack; var State:PHIDState):LongWord;
Description: Replace the current HID parser state with the top item from the parser stack
Stack The HID parser stack
State The HID parser state to replace
Return ERROR_SUCCESS if completed or another error code on failure


function HIDParserPushStack(Stack:PHIDStack):LongWord;
Description: Place a copy of the current HID parser state on top of the parser stack
Stack The HID parser stack
Return ERROR_SUCCESS if completed or another error code on failure


function HIDParserFreeStack(Stack:PHIDStack):LongWord;
Description: Free the HID parser stack and state
Stack The HID parser stack
Return ERROR_SUCCESS if completed or another error code on failure


function HIDParserResetState(State:PHIDState):LongWord;
Description: Clear the Local and Global HID parser state
State The HID parser state to reset
Return ERROR_SUCCESS if completed or another error code on failure


function HIDParserCleanState(State:PHIDState):LongWord;
Description: Clear the Local HID parser state
State The HID parser state to clean
Return ERROR_SUCCESS if completed or another error code on failure


function HIDFindCollection(Device:PHIDDevice; Page,Usage:Word):PHIDCollection;
Description: Find the first HID collection matching the specified page and usage
Device The HID device to find collections from
Page The HID Usage Page to match (eg HID_PAGE_GENERIC_DESKTOP)
Usage The HID Usage to match (eg HID_DESKTOP_MOUSE)
Return A pointer to the first matching collection or nil if not matched


function HIDFindReportIds(Device:PHIDDevice; Collection:PHIDCollection; var MinId,MaxId:Byte):LongWord;
Description: Find the minimum and maximum report ids contained in the specified HID collection or all collections
Device The HID device to find report ids from
Collection The HID collection to find report ids from (or nil to find from all collections)
MinId A variable to receive the minimum report id number
MaxId A variable to receive the maximum report id number
Return ERROR_SUCCESS if completed or another error code on failure


function HIDFindReportSizes(Device:PHIDDevice; Collection:PHIDCollection; Kind:Byte; var MinSize,MaxSize:LongWord):LongWord;
Description: Find the minimum and maximum report sizes contained in the specified HID collection or all collections
Device The HID device to find report sizes from
Collection The HID collection to find report sizes from (or nil to find from all collections)
Kind The report kind to find sizes for (eg HID_REPORT_INPUT)
MinSize A variable to receive the minimum report size
MaxSize A variable to receive the maximum report size
Return ERROR_SUCCESS if completed or another error code on failure


function HIDCountReports(Device:PHIDDevice; Collection:PHIDCollection; Kind,Id:Byte; var Count:LongWord):LongWord;
Description: Count the number of HID reports of the specified type and id in the specified collection
Device The HID device to get the report count from
Collection The HID collection to get the report count from
Kind The report kind to count reports for (eg HID_REPORT_INPUT)
Id The report id to count reports for (must be less than or equal to the maximum report id)
Count A variable to return the number of reports
Return ERROR_SUCCESS if completed or another error code on failure


function HIDFindReports(Device:PHIDDevice; Collection:PHIDCollection; Kind,Id:Byte; Reports:PHIDReports; Count:LongWord):LongWord;
Description: Find all HID reports of the specified type and id in the specified collection
Device The HID device to get the reports from
Collection The HID collection to get the reports from
Kind The report kind to get reports for (eg HID_REPORT_INPUT)
Id The report id to get reports for (must be less than or equal to the maximum report id)
Reports A pointer to an array to return the list of reports
Count The number of reports able to be returned in the reports array
Return ERROR_SUCCESS if completed or another error code on failure
Note The caller is responsible for allocating the reports array which must be large enough to hold a pointer to every report in the returned list. When finished the array should be freed by the caller but not the reports themselves. Call HIDCountReports first to obtain the correct size to be allocated for the array.


function HIDAllocateDefinition(Device:PHIDDevice; Collection:PHIDCollection; Kind,Id:Byte):PHIDDefinition;
Description: Allocate a HID definition to describe an input, output or feature report contained in the specified collection
Device The HID device to create the report definition from
Collection The HID collection to create the report definition from
Kind The report kind to create a definition for (eg HID_REPORT_INPUT)
Id The report id to create a definition for (must be less than or equal to the maximum report id)
Return A pointer to the allocated definition or nil on error


function HIDFreeDefinition(Definition:PHIDDefinition):LongWord;
Description: Free a HID definition describing an input, output or feature report
Definition The HID definition to be freed
Return ERROR_SUCCESS if completed or another error code on failure


function HIDInsertBitField(Field:PHIDField; Buffer:Pointer; Size:LongWord; Value:Boolean):LongWord;
Description: Insert a bit field value into a report buffer
Field The field to insert into the report
Buffer A pointer to the report buffer
Size The size in bytes of the report buffer
Value The value to insert into the buffer
Return ERROR_SUCCESS if completed or another error code on failure


function HIDInsertSignedField(Field:PHIDField; Buffer:Pointer; Size:LongWord; Value:LongInt):LongWord;
Description: Insert a signed field value into a report buffer
Field The field to insert into the report
Buffer A pointer to the report buffer
Size The size in bytes of the report buffer
Value The value to insert into the buffer
Return ERROR_SUCCESS if completed or another error code on failure


function HIDInsertUnsignedField(Field:PHIDField; Buffer:Pointer; Size,Value:LongWord):LongWord;
Description: Insert an unsigned field value into a report buffer
Field The field to insert into the report
Buffer A pointer to the report buffer
Size The size in bytes of the report buffer
Value The value to insert into the buffer
Return ERROR_SUCCESS if completed or another error code on failure


function HIDExtractBitField(Field:PHIDField; Buffer:Pointer; Size:LongWord; var Value:Boolean):LongWord;
Description: Extract a bit field value from a report buffer
Field The field to extract from the report
Buffer A pointer to the report buffer
Size The size in bytes of the report buffer
Value A variable to receive the extracted value
Return ERROR_SUCCESS if completed or another error code on failure


function HIDExtractSignedField(Field:PHIDField; Buffer:Pointer; Size:LongWord; var Value:LongInt):LongWord;
Description: Extract a signed field value from a report buffer
Field The field to extract from the report
Buffer A pointer to the report buffer
Size The size in bytes of the report buffer
Value A variable to receive the extracted value
Return ERROR_SUCCESS if completed or another error code on failure


function HIDExtractUnsignedField(Field:PHIDField; Buffer:Pointer; Size:LongWord; var Value:LongWord):LongWord;
Description: Extract an unsigned field value from a report buffer
Field The field to extract from the report
Buffer A pointer to the report buffer
Size The size in bytes of the report buffer
Value A variable to receive the extracted value
Return ERROR_SUCCESS if completed or another error code on failure


HID Device functions

function HIDDeviceSetState(Device:PHIDDevice; State:LongWord):LongWord;
Description: Set the state of the specified HID device and send a notification
Device The HID device to set the state for
State The new state to set and notify (eg HID_STATE_ATTACHED)
Return ERROR_SUCCESS if completed or another error code on failure


function HIDDeviceGetIdle(Device:PHIDDevice; var Duration:Word; ReportId:Byte):LongWord;
Description: Get the idle rate from a HID device for the specified report id
Device The HID device to get the idle rate from
Duration A variable to receive the idle rate (in Milliseconds)
ReportId The report id to get the idle rate from
Return ERROR_SUCCESS if completed or another error code on failure


function HIDDeviceSetIdle(Device:PHIDDevice; Duration:Word; ReportId:Byte):LongWord;
Description: Set the idle rate on a HID device for the specified report id
Device The HID device to set the idle rate for
Duration The idle rate to set (in Milliseconds)
ReportId The report id to set the idle rate for
Return ERROR_SUCCESS if completed or another error code on failure


function HIDDeviceGetReport(Device:PHIDDevice; ReportType,ReportId:Byte; ReportData:Pointer; ReportSize:LongWord):LongWord;
Description: Read a report by type and id from a HID device
Device The HID device to read the report from
ReportType The report type to read (eg HID_REPORT_INPUT)
ReportId The report id to read (eg HID_REPORTID_NONE)
ReportData A pointer to a buffer to receive the report data
ReportSize The size in bytes of the buffer pointed to by report data
Return ERROR_SUCCESS if completed or another error code on failure


function HIDDeviceSetReport(Device:PHIDDevice; ReportType,ReportId:Byte; ReportData:Pointer; ReportSize:LongWord):LongWord;
Description: Write a report by type and id to a HID device
Device The HID device to write the report to
ReportType The report type to write (eg HID_REPORT_OUTPUT)
ReportId The report id to write (eg HID_REPORTID_NONE)
ReportData A pointer to a buffer containing the report data
ReportSize The size in bytes of the buffer pointed to by report data
Return ERROR_SUCCESS if completed or another error code on failure


function HIDDeviceAllocateReport(Device:PHIDDevice; Collection:PHIDCollection; ReportId:Byte; ReportSize:LongWord):LongWord;
Description: Allocate and initialize an input report by id on a HID device
Device The HID device to allocate the report on
Collection The HID collection this request corresponds to
ReportId The report id to allocate (eg HID_REPORTID_NONE)
ReportSize The size in bytes to allocate for the report (Provider will handle alignment and other requirements)
Return ERROR_SUCCESS if completed or another error code on failure
Note An allocated report must be submitted before reports will be received from the device


function HIDDeviceReleaseReport(Device:PHIDDevice; ReportId:Byte):LongWord;
Description: Release an input report by id from a HID device
Device The HID device to release the report from
ReportId The report id to allocate (eg HID_REPORTID_NONE)
Return ERROR_SUCCESS if completed or another error code on failure
Note If the report has been submitted it must be cancelled before being released


function HIDDeviceSubmitReport(Device:PHIDDevice; ReportId:Byte):LongWord;
Description: Submit an input report by id on a HID device
Device The HID device to submit the report on
ReportId The report id to submit (eg HID_REPORTID_NONE)
Return ERROR_SUCCESS if completed or another error code on failure
Note The report must be allocated then submitted before reports will be received from the device


function HIDDeviceCancelReport(Device:PHIDDevice; ReportId:Byte):LongWord;
Description: Cancel an input report by id on a HID device
Device The HID device to cancel the report on
ReportId The report id to cancel (eg HID_REPORTID_NONE)
Return ERROR_SUCCESS if completed or another error code on failure
Note The report should be cancelled then released to stop receiving reports from the device


function HIDDeviceGetProtocol(Device:PHIDDevice; var Protocol:Byte):LongWord;
Description: Get the report protocol from a HID device
Device The HID device to get the report protocol from
Protocol A variable to receive the report protocol (eg HID_PROTOCOL_REPORT)
Return ERROR_SUCCESS if completed or another error code on failure


function HIDDeviceSetProtocol(Device:PHIDDevice; Protocol:Byte):LongWord;
Description: Set the report protocol for a HID device
Device The HID device to set the report protocol for
Protocol The report protocol to set (eg HID_PROTOCOL_REPORT)
Return ERROR_SUCCESS if completed or another error code on failure


function HIDDeviceGetInterval(Device:PHIDDevice; var Interval:LongWord):LongWord;
Description: Get the polling interval from a HID device
Device The HID device to get the polling interval from
Interval A variable to receive the polling interval (in Milliseconds)
Return ERROR_SUCCESS if completed or another error code on failure


function HIDDeviceSetInterval(Device:PHIDDevice; Interval:LongWord):LongWord;
Description: Set the polling interval for a HID device
Device The HID device to set the polling interval for
Interval The polling interval to set (in Milliseconds)
Return ERROR_SUCCESS if completed or another error code on failure


function HIDDeviceGetReportDescriptor(Device:PHIDDevice; Descriptor:PHIDReportDescriptor; Size:LongWord):LongWord;
Description: Get the Report Descriptor for a HID device
Device The HID device to get the descriptor for
Descriptor Pointer to a buffer to return the HID Report Descriptor
Size The size in bytes of the buffer pointed to by Descriptor
Return ERROR_SUCCESS if completed or another error code on failure


function HIDDeviceGetPhysicalDescriptorSet0(Device:PHIDDevice; Descriptor:PHIDPhysicalDescriptorSet0):LongWord;
Description: Get the HID Physical Descriptor Set 0 for a HID device
Device The HID device to get the descriptor for
Descriptor Pointer to a HID Physical Descriptor Set 0 structure for the returned data
Return ERROR_SUCCESS if completed or another error code on failure


function HIDDeviceGetPhysicalDescriptorSet(Device:PHIDDevice; Descriptor:PHIDPhysicalDescriptorSet; Index:Byte; Size:LongWord):LongWord;
Description: Get a HID Physical Descriptor Set for a HID device
Device The HID device to get the descriptor for
Descriptor Pointer to a HID Physical Descriptor Set structure for the returned data
Index The index of the physical descriptor set to return
Size The size in bytes of the buffer pointed to by Descriptor
Return ERROR_SUCCESS if completed or another error code on failure


function HIDDeviceBindDevice(Device:PHIDDevice):LongWord;
Description: Attempt to bind a HID device to one of the registered consumers
Device The HID device to attempt to bind a consumer to
Return ERROR_SUCCESS if completed, ERROR_NOT_SUPPORTED if unsupported or another error code on failure


function HIDDeviceUnbindDevice(Device:PHIDDevice; Consumer:PHIDConsumer):LongWord;
Description: Unbind a HID device from a consumer
Device The HID device to unbind a consumer from
Consumer The consumer to unbind the device from (nil to unbind from current consumer)
Return ERROR_SUCCESS if completed or another error code on failure


function HIDDeviceBindCollections(Device:PHIDDevice):LongWord;
Description: Attempt to bind the HID collections in the specified device to one of the registered consumers
Device The HID device containing the collections to attempt to bind a consumer to
Return ERROR_SUCCESS if completed or another error code on failure


function HIDDeviceUnbindCollections(Device:PHIDDevice; Consumer:PHIDConsumer):LongWord;
Description: Unbind the HID collections in the specified device from a consumer
Device The HID device containing the collections to unbind a consumer from
Consumer The consumer to unbind the collections from (nil to unbind from current consumer)
Return ERROR_SUCCESS if completed or another error code on failure


function HIDDeviceCreate:PHIDDevice;
Description: Create a new HID device entry
Return Pointer to new HID device entry or nil if HID device could not be created


function HIDDeviceCreateEx(Size:LongWord):PHIDDevice;
Description: Create a new HID device entry
Size Size in bytes to allocate for new HID device (Including the HID device entry)
Return Pointer to new HID device entry or nil if HID device could not be created


function HIDDeviceDestroy(Device:PHIDDevice):LongWord;
Description: Destroy an existing HID device entry
Device The HID device to destroy
Return ERROR_SUCCESS if completed or another error code on failure


function HIDDeviceRegister(Device:PHIDDevice):LongWord;
Description: Register a new HID device in the HID device table
Device The HID device to register
Return ERROR_SUCCESS if completed or another error code on failure


function HIDDeviceDeregister(Device:PHIDDevice):LongWord;
Description: Deregister a HID device from the HID device table
Device The HID device to deregister
Return ERROR_SUCCESS if completed or another error code on failure


function HIDDeviceFind(HIDId:LongWord):PHIDDevice;
Description: Find a HID device by ID in the HID device table
HIDId The ID number of the HID device to find
Return Pointer to HID device entry or nil if not found


function HIDDeviceFindByName(const Name:String):PHIDDevice; inline;
Description: Find a HID device by name in the device table
Name The name of the HID device to find (eg HID0)
Return Pointer to HID device entry or nil if not found


function HIDDeviceFindByDescription(const Description:String):PHIDDevice; inline;
Description: Find a HID device by description in the device table
Description The description of the HID to find (eg Optical USB Mouse)
Return Pointer to HID device entry or nil if not found


function HIDDeviceEnumerate(Callback:THIDDeviceEnumerate; Data:Pointer):LongWord;
Description: Enumerate all HID devices in the HID device table
Callback The callback function to call for each HID device in the table
Data A private data pointer to pass to callback for each HID device in the table
Return ERROR_SUCCESS if completed or another error code on failure


function HIDDeviceNotification(Device:PHIDDevice; Callback:THIDDeviceNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
Description: Register a notification for HID device changes
Device The HID device to notify changes for (Optional, pass nil for all HID devices)
Callback The function to call when a notification event occurs
Data A private data pointer to pass to callback when a notification event occurs
Notification The events to register for notification of (eg DEVICE_NOTIFICATION_REGISTER)
Flags The flags to control the notification (eg NOTIFIER_FLAG_WORKER)


HID consumer functions

function HIDConsumerCreate:PHIDConsumer;
Description: Create a new HID Consumer entry
Return Pointer to new Consumer entry or nil if consumer could not be created


function HIDConsumerCreateEx(Size:LongWord):PHIDConsumer;
Description: Create a new HID Consumer entry
Size Size in bytes to allocate for new consumer (Including the consumer entry)
Return Pointer to new Consumer entry or nil if consumer could not be created


function HIDConsumerDestroy(Consumer:PHIDConsumer):LongWord;
Description: Destroy an existing HID Consumer entry
Note None documented


function HIDConsumerRegister(Consumer:PHIDConsumer):LongWord;
Description: Register a new Consumer in the HID Consumer table
Note None documented


function HIDConsumerDeregister(Consumer:PHIDConsumer):LongWord;
Description: Deregister a Consumer from the HID Consumer table
Note None documented


function HIDConsumerFind(ConsumerId:LongWord):PHIDConsumer;
Description: Find a consumer by Id in the HID Consumer table
Note None documented


function HIDConsumerFindByName(const Name:String):PHIDConsumer; inline;
Description: Find a consumer by name in the Driver table
Note None documented


function HIDConsumerEnumerate(Callback:THIDConsumerEnumerate; Data:Pointer):LongWord;
Description: Enumerate all consumers in the HID Consumer table
Note None documented


HID helper functions

function HIDIsBitField(Field:PHIDField):Boolean;
Description: Return True if the supplied field contains a 1 bit value
Note None documented


function HIDIsByteField(Field:PHIDField):Boolean;
Description: Return True if the supplied HID field contains a 1 byte value
Note None documented


function HIDIsWordField(Field:PHIDField):Boolean;
Description: Return True if the supplied HID field contains a 2 byte value
Note None documented


function HIDIsLongField(Field:PHIDField):Boolean;
Description: Return True if the supplied HID field contains a 3 or 4 byte value
Note None documented


function HIDIsSignedField(Field:PHIDField):Boolean;
Description: Return True if the supplied HID field contains a signed value
Note None documented


function HIDPageToString(Page:Word):String;
Description: Return a string describing a HID usage page
Note None documented


function HIDUsageToString(Page,Usage,Count:Word):String;
Description: Return a string describing a HID usage within the given page
Note None documented


function HIDUnitTypeToString(UnitType:LongWord):String;
Description: Return a string describing a HID unit type
Note None documented


function HIDReportKindToString(Kind:Byte):String;
Description: Return a string describing a HID report type
Note None documented


function HIDReportFlagsToString(Flags:LongWord):String;
Description: Return a string describing the flags of a HID report
Note None documented


function HIDCollectionFlagsToString(Flags:LongWord):String;
Description: Return a string describing the flags of a HID collection
Note None documented


procedure HIDLog(Level:LongWord; Device:PHIDDevice; const AText:String);
Description: To be documented
Note None documented


procedure HIDLogInfo(Device:PHIDDevice; const AText:String);
Description: To be documented
Note None documented


procedure HIDLogWarn(Device:PHIDDevice; const AText:String);
Description: To be documented
Note None documented


procedure HIDLogError(Device:PHIDDevice; const AText:String);
Description: To be documented
Note None documented


procedure HIDLogDebug(Device:PHIDDevice; const AText:String);
Description: To be documented
Note None documented


HID device helper functions

function HIDDeviceGetCount:LongWord;
Description: Get the current HID Device count
Note None documented


function HIDDeviceCheck(Device:PHIDDevice):PHIDDevice;
Description: Check if the supplied HID Device is in the device table
Note None documented


function HIDDeviceTypeToString(HIDType:LongWord):String;
Description: Return a string describing the HID device type (eg HID_TYPE_USB)
Note None documented


function HIDDeviceStateToString(HIDState:LongWord):String;
Description: Return a string describing the HID device state (eg HID_STATE_ATTACHED)
Note None documented


function HIDDeviceStateToNotification(State:LongWord):LongWord;
Description: Convert a Device state value into the notification code for device notifications
Note None documented


HID consumer helper functions

function HIDConsumerGetCount:LongWord;
Description: Get the current HID Consumer count
Note None documented


function HIDConsumerCheck(Consumer:PHIDConsumer):PHIDConsumer;
Description: Check if the supplied HID Consumer is in the consumer table
Note None documented


Return to Unit Reference