Merge pull request #166 from OSSystems/master

Serial redirection fixes
This commit is contained in:
Marc-André Moreau 2011-10-19 12:45:49 -07:00
commit 5f7aafd7aa
2 changed files with 15 additions and 7 deletions

View File

@ -464,6 +464,7 @@ static void serial_abort_single_io(SERIAL_DEVICE* serial, uint32 file_id, uint32
/* Process a SINGLE FileId and MajorFunction */
list_remove(serial->pending_irps, irp);
irp->IoStatus = io_status;
stream_write_uint32(irp->output, 0);
irp->Complete(irp);
wait_obj_set(serial->in_event);

View File

@ -295,13 +295,20 @@ uint32 serial_tty_control(SERIAL_TTY* tty, uint32 IoControlCode, STREAM* input,
case IOCTL_SERIAL_PURGE:
stream_read_uint32(input, purge_mask);
DEBUG_SVC("SERIAL_PURGE purge_mask %X", purge_mask);
if ((purge_mask & SERIAL_PURGE_TXCLEAR)
&& (purge_mask & SERIAL_PURGE_RXCLEAR))
tcflush(tty->fd, TCIOFLUSH);
else if (purge_mask & SERIAL_PURGE_TXCLEAR)
tcflush(tty->fd, TCOFLUSH);
else if (purge_mask & SERIAL_PURGE_RXCLEAR)
tcflush(tty->fd, TCIFLUSH);
/* See http://msdn.microsoft.com/en-us/library/ms901431.aspx
PURGE_TXCLEAR Clears the output buffer, if the driver has one.
PURGE_RXCLEAR Clears the input buffer, if the driver has one.
It clearly states to clear the *driver* buffer, not the port buffer
*/
#ifdef DEBUG_SVC
if (purge_mask & SERIAL_PURGE_TXCLEAR)
DEBUG_SVC("Ignoring SERIAL_PURGE_TXCLEAR");
if (purge_mask & SERIAL_PURGE_RXCLEAR)
DEBUG_SVC("Ignoring SERIAL_PURGE_RXCLEAR");
#endif
if (purge_mask & SERIAL_PURGE_TXABORT)
*abort_io |= SERIAL_ABORT_IO_WRITE;