summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2014-10-15 18:29:18 +0200
committerAleksander Morgado <aleksander@aleksander.es>2014-10-15 18:29:18 +0200
commitf2fa7a7fbf739ad38e0c10338bbcc59818c7670e (patch)
tree09372af13b53d3600f5dfa1b23fd57842a34bf25
parent41b7e7b048e67a0b329c820c81beccf42bf0957e (diff)
qcdm: don't retry probing if QCDM unescaping fails
But keep the retries when the frame marker isn't found. https://bugzilla.gnome.org/show_bug.cgi?id=708861
-rw-r--r--include/ModemManager-errors.h2
-rw-r--r--src/mm-port-probe.c3
-rw-r--r--src/mm-port-serial-qcdm.c10
-rw-r--r--src/tests/test-qcdm-serial-port.c3
4 files changed, 12 insertions, 6 deletions
diff --git a/include/ModemManager-errors.h b/include/ModemManager-errors.h
index b349fd8c..f2dc0b62 100644
--- a/include/ModemManager-errors.h
+++ b/include/ModemManager-errors.h
@@ -226,6 +226,7 @@ typedef enum { /*< underscore_name=mm_connection_error >*/
* @MM_SERIAL_ERROR_FLASH_FAILED: Could not flash the device.
* @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).
*
* Serial errors that may be reported by ModemManager.
*/
@@ -238,6 +239,7 @@ typedef enum { /*< underscore_name=mm_serial_error >*/
MM_SERIAL_ERROR_FLASH_FAILED = 5, /*< nick=FlashFailed >*/
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 >*/
} MMSerialError;
/**
diff --git a/src/mm-port-probe.c b/src/mm-port-probe.c
index 52096678..94e7d3b5 100644
--- a/src/mm-port-probe.c
+++ b/src/mm-port-probe.c
@@ -602,6 +602,9 @@ serial_probe_qcdm_parse_response (MMPortSerialQcdm *port,
is_qcdm = TRUE;
qcdm_result_unref (result);
}
+ } else if (g_error_matches (error, MM_SERIAL_ERROR, MM_SERIAL_ERROR_PARSE_FAILED)) {
+ /* Failed to unescape QCDM packet: don't retry */
+ mm_dbg ("QCDM parsing error: %s", error->message);
} else {
if (!g_error_matches (error, MM_SERIAL_ERROR, MM_SERIAL_ERROR_RESPONSE_TIMEOUT))
mm_dbg ("QCDM probe error: (%d) %s", error->code, error->message);
diff --git a/src/mm-port-serial-qcdm.c b/src/mm-port-serial-qcdm.c
index 42d12d7a..b63927ff 100644
--- a/src/mm-port-serial-qcdm.c
+++ b/src/mm-port-serial-qcdm.c
@@ -100,9 +100,9 @@ serial_command_ready (MMPortSerial *port,
/* Get the offset into the buffer of where the QCDM frame starts */
start = 0;
if (!find_qcdm_start (response_buffer, &start)) {
- error = g_error_new_literal (MM_CORE_ERROR,
- MM_CORE_ERROR_FAILED,
- "Failed to parse QCDM packet");
+ error = g_error_new_literal (MM_SERIAL_ERROR,
+ MM_SERIAL_ERROR_FRAME_NOT_FOUND,
+ "QCDM frame start not found");
/* Discard the unparsable data */
used = response_buffer->len;
goto out;
@@ -117,8 +117,8 @@ serial_command_ready (MMPortSerial *port,
&used,
&more);
if (!success) {
- error = g_error_new_literal (MM_CORE_ERROR,
- MM_CORE_ERROR_FAILED,
+ error = g_error_new_literal (MM_SERIAL_ERROR,
+ MM_SERIAL_ERROR_PARSE_FAILED,
"Failed to unescape QCDM packet");
g_free (unescaped_buffer);
unescaped_buffer = NULL;
diff --git a/src/tests/test-qcdm-serial-port.c b/src/tests/test-qcdm-serial-port.c
index cd9365b5..1f88fad9 100644
--- a/src/tests/test-qcdm-serial-port.c
+++ b/src/tests/test-qcdm-serial-port.c
@@ -280,7 +280,8 @@ qcdm_verinfo_expect_fail_cb (MMPortSerialQcdm *port,
response = mm_port_serial_qcdm_command_finish (port, res, &error);
- g_assert_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED);
+ /* Expect any kind of error */
+ g_assert (error != NULL);
g_error_free (error);
g_assert (response == NULL);