serial: prevent "hangs" by limiting EAGAIN retries on serial writes

MM would appear to hang sometimes when writing to serial devices but
in reality was just retrying the write too many times.  Make the
retry limit time-based so MM doesn't hang but times the attempt out
instead.
This commit is contained in:
Dan Williams
2010-01-01 20:52:15 -06:00
parent 5eed83cd75
commit a06b3f20ca
+4
View File
@@ -439,6 +439,10 @@ mm_serial_port_send_command (MMSerialPort *self,
serial_debug (self, "-->", priv->command->str, -1);
/* Only accept about 3 seconds of EAGAIN */
if (priv->send_delay > 0)
eagain_count = 3000000 / priv->send_delay;
s = priv->command->str;
while (*s) {
status = write (priv->fd, s, 1);