Plug and Play support for HID over SPI
This article describes plug and play support for devices that support HID over the SPI transport.
Driver Loading
Windows loads the HID SPI class driver based on a compatible identifier match between a hardware identifier and the INF. The identifier is generated by the Advanced Configuration and Power Interface (ACPI). The hardware identifier is generated for the SPI device node in ACPI. All HID SPI compatible devices must expose the compatibility identifier, in addition to a unique hardware identifier.
The ACPI 5.0 Specification includes support for HID Class Devices. the ACPI definitions for HID SPI are as follows.
Field | Value | ACPI object | Format | Comments |
---|---|---|---|---|
Hardware ID | Vendor Specific | _HID | String in the format of VVVVdddd (e.g. MSFT0011) | VendorID + DeviceID |
Compatible ID | PNP0C51 | _CID | String in the format of ACPIxxxx or PNPxxxx | CompatibleID |
Subsystem | Vendor Specific | _SUB | String in the format of VVVVssss (e.g. MSFQ1234) | SubVendorID + SubSystemID |
Hardware Revision | Vendor Specific | _HRV | 0xRRRR (2byte revision) | Hardware revision number |
Current Resource Settings | Vendor Specific | _CRS | Byte stream | - SpiSerialBus for access to the device. - GpioInt for interrupts. |
Device Specific Method | GUID {6e2ac436-0fcf-41af-a265-b32a220dcfab} | _DSM | Package | Defines a structure that contains device-specific information. |
Device Reset Method | _RST | ACPI 6.0 7.3.25 compliant device reset method, to be called by the host OS as an ACPI FLDR. |
Every HID SPI device must provide the following mandatory fields:
- Hardware ID
- Compatible ID
- Hardware Revision
- Current Resource Settings
- Device Specific Method
- Device Reset Method
Refer to the Advanced Configuration and Power Interface (ACPI) 6.0 specification for additional information.
The following provides an example of a hardware IDs and compatible IDs for a random HID SPI device. These details are based on a sample device that reports itself as a HID with one top-level collection of class "vendor specific".
Advanced Configuration and Power Interface (ACPI) generates the following Hardware IDs and Compatible IDs to load the HID SPI Transport driver:
Hardware Identifiers: Compatible Identifiers
ACPI\Vid_xxxx&Pid_yyyy&Rev_zzzz;: ACPI\PNP0C51
ACPI\Vid_xxxxPid_yyyy;:
ACPI\xxxxyyyy;:
In the previous example, the Hardware ID was generated by using the values extracted from the _HID ACPI method for the sample device. The Compatible ID is generated by using the values extracted from the _CID ACPI method for the sample device. The Compatible ID for a HID over SPI must always be PNP0C51 for version 1.0.
Note
If you supply an INF, you should only use the hardware identifiers in the left column of the previous table. (Do not use the compatible identifier in the right column.)
The Hardware ID for the HID Client device node generated by the HIDClass.sys component is as follows:
Hardware Identifier: Compatible Identifier
HID\VEN_MSFT&DEV_0010&REV_0002&Col01;: N/A
-HID\VEN_MSFT&DEV_0010&Col01 HID\MSFT0010&Col01;: N/A
-HID\*MSFT0010Col01: N/A
-HID_DEVICE_UP:FF00_U:0001;: N/A
-HID_DEVICE: N/A
The Hardware ID is generated by HIDClass.sys and is identical for all transports. This identifier is based on values passed to HIDClass.sys from HIDSPI.SYS (extracted from ACPI).
Device enumeration sequence
Once a HID SPI device driver (HIDSPI.SYS) is loaded, it starts to communicate with the device over the SPI bus. The first operation the driver performs is the device enumeration sequence.
The following list gives the enumeration sequence. The order of this list may change in future versions of Windows.
Retrieve ACPI Source Language (ASL) code for HID SPI device from the system BIOS.
Issue a host initiated reset to the device
- Call ACPI _RST method
- Device asserts GPIO interrupt
- Host reads reset response from device
Retrieve HID descriptor from the device
- Host writes HID descriptor request
- Device asserts GPIO interrupt
- Host reads HID descriptor response
Retrieve report descriptor
- Host writes report descriptor request
- Device asserts GPIO interrupt
- Host reads report descriptor response
If the host fails to successfully complete any of the steps with the device, the HIDSPI driver may load with an error value of Code 10. The host may reattempt to reset the device if no response is received, but retry logic is not guaranteed.
HID report operations
The table below provides an overview of the HID report operations supported by the HID SPI protocol and the input and output reports which are used to carry out the operation.
HID report type | Operation | Output report type | Input report type |
---|---|---|---|
Input Report | GET | 0x06 (Request - empty content) |
0x0B (Response) |
Input Report | SET (Not supported) |
N/A | N/A |
Input Report | INTERRUPT IN | N/A - No request | 0x01 |
Feature Report | GET | 0x04 (Request - empty content) |
0x05 (Response) |
Feature Report | SET | 0x03 | 0x09 (Acknowledgement - empty content) |
Output Report | GET (Not supported) |
N/A | N/A |
Output Report | SET | 0x05 | 0x0A (Acknowledgement - empty content) |
Protocol operations
Operation | Request report type | Response report type |
---|---|---|
Device Descriptor Request | 0x01 | 0x7 |
Report Descriptor Request | 0x02 | 0x8 |
Command Request | 0x07 | 0x4 |
Reset Response | N/A | 0x3 |