
usbd
_
attach() © 2007, QNX Software Systems GmbH & Co. KG.
Looping
Another way to attach is to loop and attach to all devices (in which case you build the
instance yourself). For example:
for (busno = 0; busno < 10; ++busno) {
for (devno = 0; devno < 64; ++devno) {
memset(&instance, USBD_CONNECT_WILDCARD, sizeof(usbd_device_instance_t));
instance.path = busno, instance.devno = devno;
if (usbd_attach(connection, &instance, 0, &device) == EOK) {
......
}
}
}
The degree of “attachedness” depends on how you connected:
• If you specified insertion/removal callback functions, then you’ll get exclusive
access to the device and can make I/O to it.
• If you didn’t use callbacks and you attached as in the loop above, you get shared
access, so you can only read device configuration.
Returns:
EOK Success.
ENODEV Specified device doesn’t exist. If in a loop, then there’s nothing at that
devno. If from a callback, then the device has since been removed.
EBUSY A shared/exclusive conflict.
ENOMEM No memory for internal device structures.
Classification:
QNX Neutrino, QNX 4
Safety
Cancellation point Yes
Interrupt handler No
Signal handler No
Thread Yes
See also:
usbd
_
connect(), usbd
_
detach(), usbd
_
device
_
extra(), usbd
_
disconnect()
24 Chapter 4 • USB Library Reference September 10, 2007
Commenti su questo manuale