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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user