31.08.2013 Views

HID Sensor Usage Tables - USB.org

HID Sensor Usage Tables - USB.org

HID Sensor Usage Tables - USB.org

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

62 <strong>HID</strong> <strong>Sensor</strong> <strong>Usage</strong>s<br />

Set Feature Reports are sent from the host to the device. They are used to set configuration Properties into<br />

a sensor by invoking the <strong>HID</strong> SET FEATURE REPORT. This might include the desired sample rate and<br />

reporting preferences. <strong>Sensor</strong> Properties are equated to <strong>HID</strong> Feature Report Items.<br />

3.6.1 <strong>HID</strong> Report Item packing options<br />

Items come in varying sizes, depending upon their data types, and whether they are a scalar or an array.<br />

This is specified by the Report Size and Report Count values in the Report Descriptor.<br />

Examples for common data types (non-exhaustive list):<br />

Conventional Data Type <strong>HID</strong> Report Size (bits) <strong>HID</strong> Report Count<br />

boolean 1 1 1<br />

unsigned char 8 1<br />

char 8 1<br />

unsigned short 16 1<br />

short 16 1<br />

unsigned long 32 1<br />

long 32 1<br />

unsigned long long 64 1<br />

long long 64 1<br />

float 2 32 1<br />

double 64 1<br />

String; char[n] 8 n<br />

Wide String; wchar_t[n] 16 n<br />

Array of long; long[n] 32 n<br />

Table 8. Common Data Types expressed as Report Size and Report Count<br />

One strategy is to pack as many Items into a Report as will fit in the available space. Another strategy is to<br />

only put a single Item in each Report. The following are examples of each of these strategies.<br />

Byte<br />

Bit Position in the byte<br />

Position 7 6 5 4 3 2 1 0<br />

0<br />

1<br />

Report ID = 0x01<br />

2<br />

3<br />

4<br />

Data Field = 0x12345678<br />

Table 9. Input Report with a single scalar Data Field of Report Size 32, Report Count 1<br />

Byte<br />

Bit Position in the byte<br />

Position 7 6 5 4 3 2 1 0<br />

0 Report ID = 0x23<br />

1<br />

2<br />

Data Field 1 = 0xFF00<br />

1<br />

For ease of programming, it is customary to byte-align Boolean values in <strong>HID</strong> reports. For example, if 3<br />

Boolean bits are needed, they are followed by 5 unused “padding” bits so that the total fills up to an even<br />

byte boundary.<br />

2<br />

<strong>HID</strong> has a special technique for representing floating point numbers, which is described in Section 4.2.1<br />

Values, Types, and Unit Exponents below.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!