Difference between revisions of "Unit HID"
Line 31: | Line 31: | ||
---- | ---- | ||
− | '' | + | |
+ | '''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> | ||
+ | | | ||
+ | |- | ||
+ | | <code>bDescriptorType:Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>bcdHID:Word;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>bCountryCode:Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>bNumDescriptors:Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>bHIDDescriptorType:Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>wHIDDescriptorLength:Word;</code> | ||
+ | | | ||
+ | |- | ||
+ | |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 | ||
+ | |- | ||
+ | | | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |} | ||
+ | </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> | ||
+ | | | ||
+ | |- | ||
+ | | <code>UsageCount:LongWord;</code> | ||
+ | | Provides UsageMinimum/UsageMaximum | ||
+ | |- | ||
+ | | <code>DesignatorIndex:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>DesignatorCount:LongWord;</code> | ||
+ | | Provides DesignatorMinimum/DesignatorMaximum | ||
+ | |- | ||
+ | | <code>StringIndex:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>StringCount:LongWord;</code> | ||
+ | | Provides StringMinimum/StringMaximum | ||
+ | |- | ||
+ | | <code>Delimiter:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|Global State | ||
+ | |- | ||
+ | | <code>UsagePage:Word;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>LogicalMinimum:LongInt;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>LogicalMaximum:LongInt;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>PhysicalMinimum:LongInt;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>PhysicalMaximum:LongInt;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>UnitType:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>UnitExponent:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>ReportSize:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>ReportId:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>ReportCount:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </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%;"| | ||
+ | |- | ||
+ | | <code>Next:PHIDStack;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </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;" | ||
+ | |- | ||
+ | | | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |} | ||
+ | </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"| | ||
+ | |- | ||
+ | | <code>Index:LongWord;</code> | ||
+ | | The index of this usage in the report (First usage is 0) | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <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"| | ||
+ | |- | ||
+ | | <code>DesignatorIndex:LongWord; {The designator index for this usage</code> | ||
+ | | | ||
+ | |- | ||
+ | | <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"| | ||
+ | |- | ||
+ | | <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"| | ||
+ | |- | ||
+ | | <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"| | ||
+ | |- | ||
+ | | <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;" | ||
+ | |- | ||
+ | | | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |} | ||
+ | </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"| | ||
+ | |- | ||
+ | | <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"| | ||
+ | |- | ||
+ | | <code>Index:LongWord;</code> | ||
+ | | The index of this report in the collection (First report is 0) | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <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"| | ||
+ | |- | ||
+ | | <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;" | ||
+ | |- | ||
+ | | | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |} | ||
+ | </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"| | ||
+ | |- | ||
+ | | <code>Start:LongWord;</code> | ||
+ | | The first byte of this collection in the report descriptor | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <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"| | ||
+ | |- | ||
+ | | <code>Parent:PHIDCollection;</code> | ||
+ | | The parent collection or nil if this is a top level collection | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <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> | ||
+ | | | ||
+ | |- | ||
+ | | <code>ReceiveErrors:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | |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 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"| | ||
+ | |- | ||
+ | | <code>Flags:LongWord;</code> | ||
+ | | The flags for this field | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <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"| | ||
+ | |- | ||
+ | | <code>Minimum:LongInt;</code> | ||
+ | | The minimum value for this field (either in logical or physical units) | ||
+ | |- | ||
+ | | <code>Maximum:LongInt;</code> | ||
+ | | The maximum value for this field (either in logical or physical units) | ||
+ | |- | ||
+ | | <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"| | ||
+ | |- | ||
+ | | <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"| | ||
+ | |- | ||
+ | | <code>Next:PHIDDefinition;</code> | ||
+ | | The next definition in the list | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
=== Public variables === | === Public variables === |
Revision as of 23:04, 27 October 2022
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
To be documented
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) |
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 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 |
Minimum:LongInt;
|
The minimum value for this field (either in logical or physical units) |
Maximum:LongInt;
|
The maximum value for this field (either in logical or physical units) |
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
To be documented
Return to Unit Reference