Disconnected HID device?!?

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
eslavko
Rank 1
Rank 1
Posts: 36
Joined: Sat Dec 18, 2010 6:37 pm

Disconnected HID device?!?

Post by eslavko » Wed Jan 19, 2011 3:36 pm

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

Post Reply