INtime SDK Help
UsbWaitForEvent
INtime SDK v6 > About INtime > Networking and I/O > USB > USB calls > UsbWaitForEvent

Wait for USB attach and detach events. Attach events are delivered when devices are plugged into the bus. Detach events occur when devices are unplugged the bus. When this API is called, devices already plugged into the bus are not announced as attached. Use UsbEventsWithCallback() to be notified for all devices.

int32_t UsbWaitForEvent(
    LPUSBEVENT evt,
    uint32_t ms_timeout
);

 

#define USB_EVENT_ATTACH 1

#define USB_EVENT_DETACH 2

 

typedef struct {
uint32_t evt; // which event
void * data; // parameter from UsbOpenDevice()
} USBEVENT, * LPUSBEVENT;

Parameters

evt
Pointer to a USBEVENT structure.
ms_timeout
Millisecond timeout value, USB_WAIT_FOREVER to wait forever.

Return Values

USB_ERR_NORMAL_COMPLETION Success. An event was returned.
USB_ERR_NO_STACK The USB stack is not ready.
USB_ERR_INVAL Am invalid event occured.
USB_ERR_TIMEOUT The call timed out.

Requirements

Versions Defined in Include Link to
INtime 5.0 intime/rt/include/usbif3.h usbif3.h usbif3.lib