Hello,
I am somehow dropping some reports during my attempt at duplex HID communcations. My best theory at the moment is that a WriteFile() will clear the HID driver buffer of any cached input reports that have not been retrieved by ReadFile() yet. Is that correct? (If so, I don't know why it should, it seems like there should be separate read/write buffers.)
Here is my pseudo-code, it mostly writes Output Reports and looks for the occasional Input Report:
do
do while OverlappedResult(for write) == %FALSE : loop
load some app data into WriteFile() buffer (a different buffer than the ReadFile() buffer)
WriteFile() (overlapped)
if GetOverlappedResult(for read) {
ReadFile() (overlapped)
display the Input Report from the ReadFile() buffer (a different buffer than the WriteFile() buffer)
}
loop
This always misses the 2nd of a pair of Input Reports sent from the other machine. If 1) I take out the WriteFile() above, or 2) add delay before sending the 2nd report from the other machine, then the ReadFile() above catches both Input Reports correctly.
Thanks,
dpenney