
© 2007, QNX Software Systems GmbH & Co. KG. usbd
_
parse
_
descriptors()
Parse device descriptors looking for a specific entry
Synopsis:
#include <sys/usbdi.h>
usbd_descriptors_t *usbd_parse_descriptors(
struct usbd_device *device,
struct usbd_desc_node *root,
_uint8 type,
int index,
struct usbd_desc_node **node );
Arguments:
device The opaque handle for the device whose descriptors you want to search.
root Where in the tree to begin parsing (pass
NULL to start at the base).
type The type of descriptor to find (
USB_DESC_*), or 0 to match any type.
index The occurrence of the descriptor that you want to find.
node A pointer to a location where the function stores a pointer to the descriptor
that it found. You can use this as the root for future requests.
Library:
libusbdi
Description:
When you call it the first time, the usbd
_
parse
_
descriptors() function loads all the
descriptors from the USB device:
• device
• configuration
• interface
• endpoint
• hub
• string
The function uses usbd
_
descriptor() to get each raw USB descriptor. The data is then
endian-ized, made alignment-safe, and built into an in-memory tree structure to
facilitate future parsing requests.
Each node in this tree is a
struct usbd_desc_node. The root parameter lets you
say where in the tree to begin parsing (
NULL is base). The node parameter tells you
where a descriptor was found to root future requests from.
The tree looks like this:
September 10, 2007 Chapter 4 • USB Library Reference 61
Komentáře k této Příručce