aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2010-01-01 20:52:15 -0600
committerDan Williams <dcbw@redhat.com>2010-01-01 20:52:15 -0600
commita06b3f20cafab2ff2d1de16553f7ff578a9b761b (patch)
tree4fea1386ab6d0f378a7385e24013372a659d7118 /src
parent5eed83cd753679acae1070893052243299330200 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/mm-serial-port.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mm-serial-port.c b/src/mm-serial-port.c
index 3abd5619..2600ae51 100644
--- a/src/mm-serial-port.c
+++ b/src/mm-serial-port.c
@@ -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);