Thank you for your answer. I am so lost and stock...
You mean:
Result = ReadFile
(ReadHandle,
InputReport,
Capabilities.InputReportByteLength,
&NumberOfBytesRead,
(LPOVERLAPPED) &HIDOverlapped);
The InputReport buffer is much larger than the expected one..
I saw in your code example that you use a HANDLE to Write and another HANDLE to Read. I did use CreateFile with both Read and Write.
CreateFile
(DevicePath,
GENERIC_WRITE | GENERIC_READ,
FILE_SHARE_READ|FILE_SHARE_WRITE,
(LPSECURITY_ATTRIBUTES)NULL,
OPEN_EXISTING,
FILE_FLAG_OVERLAPPED,
NULL);
Is it ok to use the same handle for both read and write?
Also, I did not specify (to be short) that this is a composite device. One Joystick interface and one control interface. I am able to read continuously the joystick interface. My problem is on the Control interface, I can write to it and the device answers back with good data (saw it with USBTracer) but the ReadFile makes no success and timout expires.
I know I write to the right interface because the device answer back but maybe my problem is that I don't read the right interface??
I use CreateFile with the control interface path to open the communication and then use the same handle to read and write. Is there something wrong there, how can I be sure that I read from the control interface?