Merge request !1366 from 'mr/20250530-timeout'

mm-port-serial: add new MM_SERIAL_ERROR_SEND_TIMEOUT

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1366
This commit is contained in:
Dan Williams
2025-06-02 08:46:40 -05:00
4 changed files with 9 additions and 3 deletions
+2
View File
@@ -521,6 +521,7 @@ typedef enum { /*< underscore_name=mm_connection_error >*/
* @MM_SERIAL_ERROR_NOT_OPEN: The serial port is not open.
* @MM_SERIAL_ERROR_PARSE_FAILED: The serial port specific parsing failed.
* @MM_SERIAL_ERROR_FRAME_NOT_FOUND: The serial port reported that the frame marker wasn't found (e.g. for QCDM). Since 1.6.
* @MM_SERIAL_ERROR_SEND_TIMEOUT: Could not write once again to the serial device.
*
* Serial errors that may be reported by ModemManager.
*
@@ -536,6 +537,7 @@ typedef enum { /*< underscore_name=mm_serial_error >*/
MM_SERIAL_ERROR_NOT_OPEN = 6, /*< nick=NotOpen >*/
MM_SERIAL_ERROR_PARSE_FAILED = 7, /*< nick=ParseFailed >*/
MM_SERIAL_ERROR_FRAME_NOT_FOUND = 8, /*< nick=FrameNotFound >*/
MM_SERIAL_ERROR_SEND_TIMEOUT = 9, /*< nick=SendTimeout >*/
} MMSerialError;
/**
+1
View File
@@ -329,6 +329,7 @@ static const gchar *serial_error_messages[] = {
[MM_SERIAL_ERROR_NOT_OPEN] = "Not open",
[MM_SERIAL_ERROR_PARSE_FAILED] = "Parse failed",
[MM_SERIAL_ERROR_FRAME_NOT_FOUND] = "Frame not found",
[MM_SERIAL_ERROR_SEND_TIMEOUT] = "Send timeout",
};
static const gchar *
+4 -1
View File
@@ -47,7 +47,10 @@ mm_port_probe_response_processor_is_at (const gchar *command,
MM_SERIAL_ERROR_RESPONSE_TIMEOUT) ||
g_error_matches (error,
MM_SERIAL_ERROR,
MM_SERIAL_ERROR_SEND_FAILED)) {
MM_SERIAL_ERROR_SEND_FAILED) ||
g_error_matches (error,
MM_SERIAL_ERROR,
MM_SERIAL_ERROR_SEND_TIMEOUT)) {
return FALSE;
}
+2 -2
View File
@@ -596,7 +596,7 @@ port_serial_process_command (MMPortSerial *self,
self->priv->n_consecutive_timeouts++;
g_signal_emit_by_name (self, MM_PORT_SIGNAL_TIMED_OUT, self->priv->n_consecutive_timeouts);
g_set_error (error, MM_SERIAL_ERROR, MM_SERIAL_ERROR_SEND_FAILED,
g_set_error (error, MM_SERIAL_ERROR, MM_SERIAL_ERROR_SEND_TIMEOUT,
"Sending command failed: '%s'", g_strerror (errno));
return FALSE;
}
@@ -631,7 +631,7 @@ port_serial_process_command (MMPortSerial *self,
/* If we reach the limit of EAGAIN errors, treat as a timeout error. */
self->priv->n_consecutive_timeouts++;
g_signal_emit_by_name (self, MM_PORT_SIGNAL_TIMED_OUT, self->priv->n_consecutive_timeouts);
g_set_error (error, MM_SERIAL_ERROR, MM_SERIAL_ERROR_SEND_FAILED,
g_set_error (error, MM_SERIAL_ERROR, MM_SERIAL_ERROR_SEND_TIMEOUT,
"Sending command failed: '%s'", g_strerror (errno));
return FALSE;
}