USBHostController



USBH_Device[] usbdevice = USBHostController.GetDevices();


Doesn’t seem to work corectly. If I plug in the USB device and reboot the EMX board, (the USB Device is still connected) and execute the above code, the EMX board doesn’t seem to find any usb devices. However if I do the following:



USBHostController.DeviceConnectedEvent += new USBH_DeviceConnectionEventHandler(USBHostController_DeviceConnectedEvent);

USBH_Device[] usbdevice = USBHostController.GetDevices()

...

void USBHostController_DeviceConnectedEvent(USBH_Device device)
{
     Debug.Print(device.TYPE.ToString());
}


Then usbdevice detects the usb device.

Dale

devices take time to be detected…sometimes seconds so your call

USBH_Device[] usbdevice = USBHostController.GetDevices();

may not work.

Try it in a loop for few seconds and all devices will be detected.

Well bummer… not exactly what I was hoping for. Thanks for the quick response.

Dale

The very first time you call it, it will do some initialization. After a second or two, it will return devices connected.

@ FMCTI -

I am not Sure if this is what youre acually looking for, but if your aim is to get the USBHostController_DeviceDisconnectedEvent fired at startup sothat you dont ACTUALLY have to replug your device to get it detected, This could help.

http://www.ghielectronics.com/community/forum/topic?id=11535&page=1#msg117341

regards
Bert