Embedded Systems October 2000 Vol13_11

Issue link:

Contents of this Issue


Page 69 of 181

A HID can send and receive reports using a device's control endpoint and interrupt endpoint(s). tor for a very basic report for a device that sends and receives two bytes. Items in the report descriptor can HIDVu'w f ull T t' st TestOptJons DesOlptor Tests rv Gat D8VlC8 Descriptor rv Get Oass Descnptor " Gel Report Oescnptor (OS) " Got Report Oescllptor (TPOIse) " Check Spec Draft ~ Compliance TestNow Te .. Now Te. tNow TestNow TestNow I I I I I Optlonol Commands 1'7 Get Idle F7 Selldle 1'7 Get Protocol F7 Set Protocol Re. ultsReport Summary Filencmte: Te .. Now Te.tNow TeltNow Test Now Other Tests P Configure Device EI, TestNow I looping ... urr, SelectAJI Te ... OeseledAJI T ssts ~ S\artTests I·\summory.log Completa Report Filename Mex.mum File Size For Complete Report File: kilobyt •• J schedules the transfel- requests accord- ing to the maximum latency requested in the endpoint descriptor. For an output report, the host sends data to a device control or in terrupt u-ansfers. The ability to do in te rrupt OUT HID transfers was added in version 1.1 of the HID spec, and is available under Windows 98 SE and later Windows editions, including Windows 2000. If the HID interface has an inter- rupt OUT endpoint, Windows 98 SE or late r will use it for output reports , and Windows 98 Gold (original) wi ll use conu-ol u-ansfers. Device firmware would need to support both u-ansfer types to enable a device to receive out- put reports either way. If the interface doesn't have an interrupt OUT end- point, the HID driver uses control transfer for output reports. Feature reports can travel in e ither direction; they always use control transfers. To send an OUT feature report, the host end a ecReport request, followed by the report data, and the device returns status informa- tion to indicate the success or failure of the transfer. To receive an IN fea- ture re port, the host sends a GeCReport request, the device sends the report data, and the host returns tatus information to indicate the suc- cess or failure of the transfe r. If data is needed only occasionally and timing isn ' t criti cal, feature reports keep the bus from cloggi ng with periodic u-ansfe r attempts when data isn 't needed. Another advan tage of feature reports is the ability to support multi- ple report formats. The host can spec- ify a report numbe r in the control request. In contrast, in an inte rrupt transfer, the host just requests or sends data bytes without having the chance to name a specific report. Report formats can be simple or complicated. Listing 2 shows a descrip- 68 o a OBER 2000 Embedded Systems Programming specify how the data should be used (for example, which axis or button on a mouse), what units to apply, the range of valid values, and more. The items and values to use for common device types are defin ed in the HID specification and the HID Usage Tables docume nt available from ·tfit a standard usage can use vendor- defin ed items. Tools To assist in developing HID firmware, the Implementers Forum provides two free tools: the Descriptor Tool and the USB Compliance Tool. The Descriptor Tool (Figure 1) automates the process of building report descriptors and enables you to check the format before copying the descriptor into the device. You can build a descriptor by selecting items from a pick list and entering values (such as the number of bytes in the item) as needed. You can then ask the tool to check the de 'criptor and flag errors. To get you started, the tool comes with example descriptors for common device types. The USB Compliance Tool is actu- ally a suite of tools that performs a series of basic tests on any device, plus additional tests for HIDs, hubs, and communication -class devices. The Compliance Tool loads its own diagnostic drive r for the device under test. You can read and check descrip- tors and send other control requests. The HID tests (Figure 2) enable you to check the report descriptor and per- form additional class-specific tests. Windows communications When you have the HID firmware up and running, you' re ready to start accessing the device from applications on the host compute r. (This article concentrates on Windows, but HID support is also available or in progress for other operating systems.)

Articles in this issue

Archives of this issue

view archives of EETimes - Embedded Systems October 2000 Vol13_11