version 1.5, 2002/02/07 07:00:52 |
version 1.6, 2002/10/01 19:31:54 |
|
|
.Nm |
.Nm |
library provides routines to extract data from USB Human Interface Devices. |
library provides routines to extract data from USB Human Interface Devices. |
.Ss INTRODUCTION |
.Ss INTRODUCTION |
USB HID devices send and receive data layed out in a device dependent |
USB HID devices send and receive data layed out in a device dependent way. |
way. The |
The |
.Nm |
.Nm |
library contains routines to extract the |
library contains routines to extract the |
.Em report descriptor |
.Em report descriptor |
Line 97 A report descriptor can be obtained by c |
|
Line 97 A report descriptor can be obtained by c |
|
.Fn hid_get_report_desc |
.Fn hid_get_report_desc |
with a file descriptor obtained by opening a |
with a file descriptor obtained by opening a |
.Xr uhid 4 |
.Xr uhid 4 |
device. Alternatively a data buffer containing the report descriptor can be |
device. |
|
Alternatively a data buffer containing the report descriptor can be |
passed into |
passed into |
.Fn hid_use_report_desc . |
.Fn hid_use_report_desc . |
The data is copied into an internal structure. When the report descriptor |
The data is copied into an internal structure. |
|
When the report descriptor |
is no longer needed it should be freed by calling |
is no longer needed it should be freed by calling |
.Fn hid_dispose_report_desc . |
.Fn hid_dispose_report_desc . |
The type |
The type |
Line 114 fails it will return |
|
Line 116 fails it will return |
|
To parse the report descriptor the |
To parse the report descriptor the |
.Fn hid_start_parse |
.Fn hid_start_parse |
function should be called with a report descriptor and a set that |
function should be called with a report descriptor and a set that |
describes which items that are interesting. The set is obtained |
describes which items that are interesting. |
by or-ing together values |
The set is obtained by or-ing together values |
.Fa "(1 \*[Lt]\*[Lt] k)" |
.Fa "(1 \*[Lt]\*[Lt] k)" |
where |
where |
.Fa k |
.Fa k |
|
|
and the meaning of the components in the USB HID documentation. |
and the meaning of the components in the USB HID documentation. |
.Pp |
.Pp |
Data should be read/written to the device in the size of |
Data should be read/written to the device in the size of |
the report. The size of a report (of a certain kind) can be |
the report. |
computed by the |
The size of a report (of a certain kind) can be computed by the |
.Fn hid_report_size |
.Fn hid_report_size |
function. If the report is prefixed by an ID byte it is |
function. |
given by |
If the report is prefixed by an ID byte it is given by |
.Fa id . |
.Fa id . |
.Pp |
.Pp |
To locate a single item the |
To locate a single item the |
.Fn hid_locate |
.Fn hid_locate |
function can be used. It should be given the usage code of |
function can be used. |
|
It should be given the usage code of |
the item and its kind and it will fill the item and return |
the item and its kind and it will fill the item and return |
non-zero if the item was found. |
non-zero if the item was found. |
.Ss NAME TRANSLATION FUNCTIONS |
.Ss NAME TRANSLATION FUNCTIONS |
Line 181 if it cannot be found. |
|
Line 184 if it cannot be found. |
|
Before any of these functions can be called the usage table |
Before any of these functions can be called the usage table |
must be parsed, this is done by calling |
must be parsed, this is done by calling |
.Fn hid_init |
.Fn hid_init |
with the name of the table. Passing |
with the name of the table. |
|
Passing |
.Fa NULL |
.Fa NULL |
to this function will cause it to use the default table. |
to this function will cause it to use the default table. |
.Ss DATA EXTRACTION FUNCTIONS |
.Ss DATA EXTRACTION FUNCTIONS |