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
This commit is contained in:
@@ -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;
|
||||
|
||||
/**
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user