Embedded Systems October 2000 Vol13_11

Issue link:

Contents of this Issue


Page 67 of 181

A HID must also have one or more report descriptors, which are requested after the host has detected that the device is a HID and assigned the class driver to control it. device has one riroic(' r/pscritJ/orand one or more configura/ion rip. miIJ/ors. If mul- tipl e configuratio n descriptors are available, the host selects one during enumeration. Each configuration descriptor in turn supports one or more inlpr{flCP dpscritJlors. In a I-lID's interface descriptor, the class code field is set to~. Following the interface descriptor is a HID class dl'srrijJtor that specifies the number of mr/jJoin l r/l'scrijJiors th at follow. Each direction that will use inter- rupt transfers requires an endpoint descriptor. Control transfers use the default endpoint, which is always LISTING enabled and doesn't require its own descriptor. A descriptor for an interrupt end- point specifies the endpoint number and direction, the transfer type used (interrupt), the maximum packet size for each transaction (one to 64 bytes for full speed, one to eight bytes for low speed), and the requested maxi- mum latency between transactions. A HID must a lso have one or more re/JOrl dr-uri/J /ors, whi ch are requested after the host has detect- ed that the device is a HID and assigned the class driver to con trol it. ifhis sa pie report descript:>r 'i~}W a. device that se'1ds and,'ยท;;" ';'/;' o venaor-oefined bytes of data , ');;> ..... .' /' ", '" ',' hid-Feport __ desc __ table: db 06h, AOh, FFh db 09h, A5h db A1h, 01h db 09h, A6h ;The input report db 09h, A7h db 15h, 80h db 25h, 7Fh db 75h, 08h db 95h, 02h db 81h, 02h ;The output report db 09h, A9h db 15h, 80h db 25h, 7Fh db 75h, 08h db 95h, 02h db 91h, 02h db COh Usage Page (vendor defined) Usage (vendor defined) Collection (Application) Usage (vendor defined) Usage (vendor defined) Logical MinilTUTl (-127> Logical MaxilTUTl (128) Report Size (8) (bits) Report Count (2) (fields) Input (Data, Variable, Absolute) ; Usage (vendor defined) Logical MinilTUTl (-128) Logical MaxilTUTl (127) Report Size (8) (bits) Report Count (2) (fields) Output (Data, Variable, Absolute) End Collection Windows' Device Manager uses .inf files to decide which driver to assign to a device. HIDs can use the default fil e for HIDs (hiddev. inf for Windows 98, input.inf for Windows 2000), or you can provide an .inf file that contains your Vendor and Product IDs. The advantage of a custom .inf fil e is that you can include a device description and manufacturer name that will appear in the Control Panel, in place of th e generic "Standa rd Device" listing. Reports A HID can send and receive reports using a device's control endpoint and interrupt endpoint(s). HIDs don't support USB's bulk or isochronous transfer types. Control transfers have no guaran- teed delivery time. The host controller fits the transfers in as best it can. Ten percent of the bus bandwidth is reserved for control transfers, but the host may allocate some of the time to other devices. Interrupt transfers have a guaran- teed maXIllHlm latency, or tim e between transaction attempts. Each tran~action carries a data packet. An interrupt endpoin t can requ('st a max- imum latcncy from I ms to 2!'i!'ims, 10ms to 2!'i!'ims for low-speed devices. For example, if th e latency is 10ms, the host m,lY initiate a new transaction anywhere from lms to 10ms after the last transaction attempt. Which It-ansfer type the host u~cs depends on t he type of report l-equest- ed and, sometime~, on the device hardware and version of Windows. A HID ('(Ill exchange three types of report~: input, output, and feature, Tnpllt and output reports arc best for data that must be ~enl or retrieved periodicall y, such as kevpres~e~. Feature reports are best for data that transfers occasionally or isn't time-o-it- i(al-~u(h as setup or configuration information . When the host requests input reports, the device sends data to the hmt in intcrrupt transfers. The hmt 66 OCTOBf R ;>000 Embedded Systems Programming

Articles in this issue

Archives of this issue

view archives of EETimes - Embedded Systems October 2000 Vol13_11