WriteFile and CloseHandle seem to hang until further input
Posted on 2004-08-11
So ... let's start :)
I have some USB device which reports as HID compliant Device. I can turn and push this device.
My program is written in C#, but it looks like the program lies with some of the API functions.
I can push and rotate this device and via ReadFile I can get the data (what has been done / rotated / pushed).
I should also be able to write to that device (therefore 1 (maybe 2) bytes are sent to the device).
When I call WriteFile with the handle at first my whole program seems to hang (I watched it in the debugger and it looks like WriteFile doesn't do anything). When I now rotate (or push) the device (so that some data should be sent from the device to my PC) the data reaches me and WriteFiles continues (and ends with success).
The same applies for CloseHandle
I call CloseHandle -> Everything hangs -> I move the device -> CloseHandle continues and succeeds (no error)
I do the reading in a separate Thread - so could this be the problem?
Can anyone out there maybe help me ?