
© 2007, QNX Software Systems GmbH & Co. KG. usbd
_
attach()
Attach to a USB device
Synopsis:
#include <sys/usbdi.h>
int usbd_attach( struct usbd_connection *connection,
usbd_device_instance_t *instance,
size_t extra,
struct usbd_device **device );
Arguments:
connection An opaque handle that identifies the USB stack (from usbd
_
connect()).
instance Describes which device you wish to attach to.
extra The size of additional memory you’d like allocated with the device.
You can use usbd
_
device
_
extra() later to get a pointer to this
additional memory. Typically, the class driver would store various
status/config/device-specific details in here (if needed).
device An opaque handle used to identify the device in later calls.
Library:
libusbdi
Description:
You use the usbd
_
attach() function to attach to a USB device. Typically, you do this
out of the insertion callback (made when the device matched your filter), which will
give you the connection and instance parameters involved. The insertion callback is
prototyped as follows:
void (*insertion)(struct usbd_connection *, usbd_device_instance_t *instance)
The usbd_device_instance_t structure looks like this:
typedef struct usbd_device_instance {
_uint8 path;
_uint8 devno;
_uint16 generation;
usbd_device_ident_t ident;
_uint32 config;
_uint32 iface;
_uint32 alternate;
} usbd_device_instance_t;
September 10, 2007 Chapter 4 • USB Library Reference 23
Commenti su questo manuale