serial: flush I/O right after open

We don't really care about anything that came before.
This commit is contained in:
Dan Williams
2010-03-17 12:05:31 -07:00
parent 857dcd7bcf
commit fb2b80f11a

View File

@@ -747,6 +747,9 @@ mm_serial_port_open (MMSerialPort *self, GError **error)
return FALSE; return FALSE;
} }
/* Flush any waiting IO */
tcflush (priv->fd, TCIOFLUSH);
if (tcgetattr (priv->fd, &priv->old_t) < 0) { if (tcgetattr (priv->fd, &priv->old_t) < 0) {
g_set_error (error, MM_SERIAL_ERROR, MM_SERIAL_OPEN_FAILED, g_set_error (error, MM_SERIAL_ERROR, MM_SERIAL_OPEN_FAILED,
"Could not open serial device %s: %s", device, strerror (errno)); "Could not open serial device %s: %s", device, strerror (errno));