DSF HID Protocol Translator (SoftHIDProtocolXlator)

The SoftHIDProtocolXlator object (ISoftHIDProtocolXlator) serves as a HID-USB protocol translator for simulated HID devices. This object configures and uses a SoftUSBDevice object (ISoftUSBDevice) on behalf of USB HID device simulators, according the USB HID device class specification. The following diagram describes the USB HID simulation architecture.

 

Diagram illustrating DSF device simulation architecture for HID devices

 

The device simulator creates a SoftHIDProtocolXlator object and sets its properties by using its HID descriptors. The HID device simulator exposes an interface to test scripts and applications that enable them to initiate HID events, such as moving a joystick or clicking a mouse button. The HID device simulator implements this interface by creating HID reports and calling methods on the SoftHIDProtocolXlator object to transfer them to the host.

The SoftHIDProtocolXlator object exposes the ISoftHIDProtocolXlator dual interface, which has the following properties and methods:

  • The DeviceType property is set by the device simulator to determine the type of HID device that is being simulated. The device can be a keyboard, mouse, or other.

  • The DSFDevice property returns the DSFDevice object that the SoftHIDProtocolXlator object's SoftUSBDevice object uses (from the SoftUSBDevice::DSFDevice property).

  • The HIDDescriptor. property is set by the device simulator to a SoftUSBHIDDescriptor object to determine the device's HID descriptor.

  • The WriteReportDescriptor method is called by the device simulator to determine the format of the device's report descriptor. The report descriptor is specified as a byte array.

  • The ReadOutputReport method is called periodically by the device simulator to receive HID reports that are sent from the host to the device. The HID report is returned as a byte array.

  • The WriteInputReport method is called by the device simulator to send a HID report to the host. The HID report is specified as a byte array.

  • The WriteFeatureReport method is called by the device simulator to send a feature report to the host. The feature report is specified as a byte array.

The SoftUSBHidDescriptor object exposes the ISoftUSBHidDescriptor dual interface, which has the following properties that correspond to the fields of the HID descriptor. (The descriptor field names from the USB HID specification are in parentheses.)

  • The HID property (bcdHID) is a numeric expression that identifies the HID Class Specification release.

  • The CountryCode property (bCountryCode) is a numeric expression that identifies the country code of the localized hardware.

  • The NumDescriptors property (bNumDescriptors) is a numeric expression that specifies the number of class descriptors. (There is always at least one--that is, the report descriptor.)

  • The ClassDescriptorType property (bDescriptorType) is an indexed property that is used to set types of optional descriptors.

  • The DescriptorLength property (wDescriptorLength) is an indexed property that is used to set lengths of optional descriptors.

 

 

Send comments about this topic to Microsoft

Build date: 9/21/2010