Detect USB Connectivity?

Hi,

I was wondering if there is a way for the provided API to programmably return whether the FPGA’s USB port is still connected to the PC? I tried to use IsOpen(). However, while that returns true when the FPGA’s USB is connected after initialization, it doesn’t return false when the USB is unplugged.

If any1 has any idea, please let me know.

Thanks.

Larry–

The only way to do this is to use GetDeviceCount(), then iterate through the device list to search for your serial number.

The proper way to detect a device disconnect is to register to receive WM_DEVICECHANGE events through Windows, then perform this iteration each time that event is received. Your code should then “clean up” (i.e. destroy) any device instances for devices that are no longer attached.