serial 00/04: some patches for serial ports

Wolfgang Walter wine at
Fri Dec 12 11:52:04 CST 2008


We have a (binary) application we wanted to use with wine. This application 
uses serial ports to access different peripherals (often using 
vendor-supplied dlls).

Most devices did not work or did not work es expected.

The following 4 patches fixed most these problems:

1. fix TRACE output: IXON and IXON are swapped

2. serial_flush must use tcdrain() and not tcflush()

3. set_XOff(), set_XOn()

These are called by EscapeCommFunction(SETXOFF) and 

These function should not set the attributes of the terminal (IXOFF or IXON), 
they should instead simulate that XON/XOFF has been received.

The POSIX equivalents are tcflow(fd, TCOOFF) and tcflow(fd, TCOON)

4. Serial, Events, asynchron read/write

4.1 WaitCommEvent() does not really work asynchronously

4.2 wait_for_event() should detect when serial fd is not valid any more

4.4. make events work better with serial devices not supporting TIOCGICOUNT

Most drivers of usb2serial adapters do not support TIOCGICOUNT nor do pseudo 

5. NOT fixed

5.1 RX_RXCHAR should only sent an event if there has been received a new 

no simple fix if TIOCGICOUNT is not available.

A possible fix could be: when a EV_RXCHAR  is to be been signaled record 
number of bytes in the input queue. Function changing the input queue (i.e. 
NtReadFile) decrease this counter. Only if the counter is zero a EV_RXCHAR is 

5.2 EV_TXEMPTY should only send event whem write queue gets empty.

no simple fix if TIOCGICOUNT is not available.

A fix similar to the above would be possible.

5.3 Semantic of timeout values for serial ports misses a case

I have a fix for that as the application uses it. But I need to change 

Wolfgang Walter
Studentenwerk München
Anstalt des öffentlichen Rechts
Leiter EDV
Leopoldstraße 15
80802 München

More information about the wine-patches mailing list