Page 1 of 1

Disconnected HID device?!?

Posted: Wed Jan 19, 2011 3:36 pm
by eslavko
Hello....

Just have question how to detect if device is disconnected?!?

I had HID device and is acessed with windows HidD_GetFeature/HidD_SetFeature. (no dll's)
The function return false if not sucedded. But that can be state if device working corectly too.
For example. I wan't to read 64 bytes but wasn't ready, so I just answer with 0 instead 255 in usbFunctionSetup and in win I got call fail so I know that I need to retry.
Now I have timeout, if function doesn't return valid data in last second then I assume device disconnected. But that timeout can be too long in some case's to be practic.
Is there are some other way to check (already oppened) device still plugged in windows?
I mean some win api call?

Thanks