Created attachment 70 [details] Debug log There seems to be some issue with libserialport when used with e.g. a UNI-T UT61D multimeter via RS232 cable (and additional USB2serial FTDI adapter), e.g. on Windows XP SP3. I'll try Windows 7 or such later. Example errors: sp: sp_nonblocking_read returning SP_ERR_FAIL: WaitCommEvent() failed: Falscher Parameter.^M Full log attached.
This is looking similar to #421, which has an explanation attached.
Possible fix in this commit, needs testing: https://github.com/martinling/libserialport/commit/e4bb554e406c1641bf93745d79b9a9c54bd4dce6
The fix for #421 doesn't affect this issue apparently, still happening here. Will report more info later on.
OK, I think the issue is that we've not been handling the case where WaitCommEvent() returns immediately after a read. We're still assuming that an overlapped wait operation is running and checking its status with GetOverlappedResult at the next read, which is bogus and screws things up such that WaitCommEvent() fails on the next call. I'm working on figuring out what the right fix is.
Can you try with this change: https://github.com/martinling/libserialport/commit/01284d267cdbe0286761b1cc76947e6016466e8a Compiled but not tested at all here as yet.
Uwe, the new debug logs you posted on IRC show that the ERROR_INVALID_PARAMETER failure has now gone but you are sometimes getting ERROR_OPERATION_ABORTED. I think this is arising from a receive error (parity, framing or overrun), combined with the fAbortOnError flag being set to TRUE. Please try with this change too: https://github.com/martinling/libserialport/commit/65f89b81819e2834fe51d661952f6b5fcdd23171
*** Bug 563 has been marked as a duplicate of this bug. ***
Merged both patches, thanks! After a few tests with different hardware I think we can be pretty sure that fAbortOnError=FALSE does indeed prevent the 995 errors. The resp. patches are: 34442106efcf0621f5bc2f77aab771407d9ae5c2 47fcf8ec8522d94f698b6c5a94deb30478f7ee26