Difference between revisions of "Unit HID"

From Ultibo.org
Jump to: navigation, search
Line 44: Line 44:
 
|-
 
|-
 
| <code>bLength:Byte;</code>
 
| <code>bLength:Byte;</code>
| &nbsp;
+
| style="width: 50%;"|&nbsp;
 
|-
 
|-
 
| <code>bDescriptorType:Byte;</code>
 
| <code>bDescriptorType:Byte;</code>
Line 274: Line 274:
 
|colspan="2"|&nbsp;
 
|colspan="2"|&nbsp;
 
|-
 
|-
| <code>DesignatorIndex:LongWord; {The designator index for this usage</code>
+
| <code>DesignatorIndex:LongWord;</code>
| &nbsp;
+
| The designator index for this usage
 
|-
 
|-
 
| <code>DesignatorCount:LongWord;</code>
 
| <code>DesignatorCount:LongWord;</code>

Revision as of 23:10, 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

[Expand]

PHIDDescriptor = ^THIDDescriptor;

THIDDescriptor = packed record

HID report descriptor

[Expand]

PHIDReportDescriptor = Pointer;

HID physical descriptor

[Expand]

PHIDPhysicalDescriptor = ^THIDPhysicalDescriptor;

THIDPhysicalDescriptor = packed record

HID physical descriptor set0

[Expand]

PHIDPhysicalDescriptorSet0 = ^THIDPhysicalDescriptorSet0;

THIDPhysicalDescriptorSet0 = packed record

HID physical descriptor set

[Expand]

PHIDPhysicalDescriptorSet = ^THIDPhysicalDescriptorSet;

THIDPhysicalDescriptorSet = packed record

HID state

[Expand]

PHIDState = ^THIDState;

THIDState = record

HID stack

[Expand]

PHIDStack = ^THIDStack;

THIDStack = record

HID usages

[Expand]

PHIDUsages = ^THIDUsages;

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

HID usage

[Expand]

PHIDUsage = ^THIDUsage;

THIDUsage = record

HID reports

[Expand]

PHIDReports = ^THIDReports;

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

HID report

[Expand]

PHIDReport = ^THIDReport;

THIDReport = record

HID collections

[Expand]

PHIDCollections = ^THIDCollections;

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

HID collection

[Expand]

PHIDCollection = ^THIDCollection;

THIDCollection = record

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

[Expand]

PHIDDevice = ^THIDDevice;

THIDDevice = record

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

[Expand]

PHIDConsumer = ^THIDConsumer;

THIDConsumer = record

HID report field

[Expand]

PHIDField = ^THIDField;

THIDField = record

HID report definition

[Expand]

PHIDDefinition = ^THIDDefinition;

THIDDefinition = record


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