Am Donnerstag, 24. Oktober 2013, 11:29:34 schrieb Dmitry Timoshkov:
Wolfgang Walter wine@stwm.de wrote:
I have no intention to discuss that all again. Please think about the problem. Hint: writing twice as many bytes with 150 baud needs more time, significantly more time then TIMEOUT.
Not really. Francois sent an investigation with pretty exhaustive explanation of the behvaiour of COM-port UARTs regarding timings and baud rates.
Have you read it? It says that with a standard UART windows may signals after 872ms that the tx queue is empty (though there are still 4 bytes to send) when you write 17 bytes. For 34 bytes he gets 1802ms > TIMEOUT.
Where do you see 34 bytes to be written in that test?
Sorry for that. I looked at the 1.7.2 codebase. There was
SetLastError(0xdeadbeef); res = WriteFile(hcom, tbuf, sizeof(tbuf), &bytes, NULL); todo_wine ok(!res, "WriteFile on an overlapped handle without ovl structure should fail\n"); todo_wine ok(GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
In 1.7.4 there are no todo_wine's any more so this does not fail any more and there should be no pending bytes from that test. There should only be 17 bytes in the test in question.
And I really don't think that we can expect exactly that same behaviour when using the linux serial driver, anyway.
At the time I was reworking the EV_TXEMPTY to use overlapped IO the reasoning for using 900 ms as the designed time was simple: that was enough to make the test pass under Windows with real hardware. How the patch we are discussing makes the test pass for me under Linux with a USB-serial adapter, which confirms that there is no reasons that it can't work under Linux as well.
I understand that there are cases of (really old) hardware where this limit may not be enough, and Francois has already sent a patch which increases timeout. The Francois' patch hasn't been accepted, but that's a different matter.
I built 1.7.4 here and I still get a timeout on my machine (with onboard device), though. The board has an Intel "Corporation 6 Series/C200 Series Chipset Family". I mesured the time needed to write with 150 baud on linux and it needs about 1000ms till ioctl(fd, TIOCOUTQ, &out) returns with zero. Sometimes up to 1100ms. When I mesure it I do not use select() or poll() but loop similar as wine does: call ioctl(), sleep for 1ms, ...
Regards,