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_FLASH_FAILED: Could not flash the device.
|
||||||
* @MM_SERIAL_ERROR_NOT_OPEN: The serial port is not open.
|
* @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_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.
|
* 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_FLASH_FAILED = 5, /*< nick=FlashFailed >*/
|
||||||
MM_SERIAL_ERROR_NOT_OPEN = 6, /*< nick=NotOpen >*/
|
MM_SERIAL_ERROR_NOT_OPEN = 6, /*< nick=NotOpen >*/
|
||||||
MM_SERIAL_ERROR_PARSE_FAILED = 7, /*< nick=ParseFailed >*/
|
MM_SERIAL_ERROR_PARSE_FAILED = 7, /*< nick=ParseFailed >*/
|
||||||
|
MM_SERIAL_ERROR_FRAME_NOT_FOUND = 8, /*< nick=FrameNotFound >*/
|
||||||
} MMSerialError;
|
} MMSerialError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -602,6 +602,9 @@ serial_probe_qcdm_parse_response (MMPortSerialQcdm *port,
|
|||||||
is_qcdm = TRUE;
|
is_qcdm = TRUE;
|
||||||
qcdm_result_unref (result);
|
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 {
|
} else {
|
||||||
if (!g_error_matches (error, MM_SERIAL_ERROR, MM_SERIAL_ERROR_RESPONSE_TIMEOUT))
|
if (!g_error_matches (error, MM_SERIAL_ERROR, MM_SERIAL_ERROR_RESPONSE_TIMEOUT))
|
||||||
mm_dbg ("QCDM probe error: (%d) %s", error->code, error->message);
|
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 */
|
/* Get the offset into the buffer of where the QCDM frame starts */
|
||||||
start = 0;
|
start = 0;
|
||||||
if (!find_qcdm_start (response_buffer, &start)) {
|
if (!find_qcdm_start (response_buffer, &start)) {
|
||||||
error = g_error_new_literal (MM_CORE_ERROR,
|
error = g_error_new_literal (MM_SERIAL_ERROR,
|
||||||
MM_CORE_ERROR_FAILED,
|
MM_SERIAL_ERROR_FRAME_NOT_FOUND,
|
||||||
"Failed to parse QCDM packet");
|
"QCDM frame start not found");
|
||||||
/* Discard the unparsable data */
|
/* Discard the unparsable data */
|
||||||
used = response_buffer->len;
|
used = response_buffer->len;
|
||||||
goto out;
|
goto out;
|
||||||
@@ -117,8 +117,8 @@ serial_command_ready (MMPortSerial *port,
|
|||||||
&used,
|
&used,
|
||||||
&more);
|
&more);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
error = g_error_new_literal (MM_CORE_ERROR,
|
error = g_error_new_literal (MM_SERIAL_ERROR,
|
||||||
MM_CORE_ERROR_FAILED,
|
MM_SERIAL_ERROR_PARSE_FAILED,
|
||||||
"Failed to unescape QCDM packet");
|
"Failed to unescape QCDM packet");
|
||||||
g_free (unescaped_buffer);
|
g_free (unescaped_buffer);
|
||||||
unescaped_buffer = NULL;
|
unescaped_buffer = NULL;
|
||||||
|
@@ -280,7 +280,8 @@ qcdm_verinfo_expect_fail_cb (MMPortSerialQcdm *port,
|
|||||||
|
|
||||||
response = mm_port_serial_qcdm_command_finish (port, res, &error);
|
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_error_free (error);
|
||||||
g_assert (response == NULL);
|
g_assert (response == NULL);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user