diff --git a/src/plugins/intel/mm-bearer-xmm7360.c b/src/plugins/intel/mm-bearer-xmm7360.c index ec108274..7ca3ad0e 100644 --- a/src/plugins/intel/mm-bearer-xmm7360.c +++ b/src/plugins/intel/mm-bearer-xmm7360.c @@ -674,6 +674,7 @@ static const MMBroadbandModemXmm7360RpcCommand disconnect_sequence[] = { }, 3, FALSE, + FALSE, mm_broadband_modem_xmm7360_rpc_response_processor_continue_on_success /* response will be: L(0x0) L(0x0) L(0x5dffffff) L(0x0) (meaning unknown) */ }, @@ -687,6 +688,7 @@ static const MMBroadbandModemXmm7360RpcCommand disconnect_sequence[] = { }, 3, FALSE, + FALSE, mm_broadband_modem_xmm7360_rpc_response_processor_final /* response will be: L(0x0) (meaning unknown) */ }, diff --git a/src/plugins/intel/mm-broadband-modem-xmm7360-rpc.c b/src/plugins/intel/mm-broadband-modem-xmm7360-rpc.c index 85bc009b..9f3f1773 100644 --- a/src/plugins/intel/mm-broadband-modem-xmm7360-rpc.c +++ b/src/plugins/intel/mm-broadband-modem-xmm7360-rpc.c @@ -84,6 +84,7 @@ typedef struct { gulong cancelled_id; GCancellable *parent_cancellable; const MMBroadbandModemXmm7360RpcCommand *current; + gboolean current_retry; const MMBroadbandModemXmm7360RpcCommand *sequence; guint next_command_wait_id; } RpcSequenceContext; @@ -152,6 +153,7 @@ rpc_sequence_parse_response (MMPortSerialXmmrpcXmm7360 *port, RpcSequenceContext *ctx; Xmm7360RpcResponse *response = NULL; g_autoptr(GError) command_error = NULL; + gboolean command_retry = FALSE; response = mm_port_serial_xmmrpc_xmm7360_command_finish (port, res, &command_error); @@ -173,6 +175,20 @@ rpc_sequence_parse_response (MMPortSerialXmmrpcXmm7360 *port, next->callid ? FALSE : TRUE, /* Last command in sequence? */ command_error, &result_error); + + if (processor_result == MM_BROADBAND_MODEM_XMM7360_RPC_RESPONSE_PROCESSOR_RESULT_FAILURE + && ctx->current->allow_retry_once && !ctx->current_retry) { + mm_obj_warn (port, "Command failed (%s), retrying once", + result_error ? result_error->message : "UNKNOWN"); + + if (response) + xmm7360_rpc_response_free (response); + g_clear_error (&result_error); + + command_retry = TRUE; + goto skip_result; + } + switch (processor_result) { case MM_BROADBAND_MODEM_XMM7360_RPC_RESPONSE_PROCESSOR_RESULT_CONTINUE: g_assert (!result_error); @@ -195,8 +211,14 @@ rpc_sequence_parse_response (MMPortSerialXmmrpcXmm7360 *port, } } - if (processor_result == MM_BROADBAND_MODEM_XMM7360_RPC_RESPONSE_PROCESSOR_RESULT_CONTINUE) { - ctx->current++; +skip_result: + if (processor_result == MM_BROADBAND_MODEM_XMM7360_RPC_RESPONSE_PROCESSOR_RESULT_CONTINUE || + command_retry) { + if (!command_retry) { + ctx->current++; + } + ctx->current_retry = command_retry; + if (ctx->current->callid) { g_assert (!ctx->next_command_wait_id); ctx->next_command_wait_id = g_timeout_add_seconds (ctx->current->wait_seconds, @@ -204,6 +226,7 @@ rpc_sequence_parse_response (MMPortSerialXmmrpcXmm7360 *port, task); return; } + g_assert (!command_retry); /* On last command, end. */ } diff --git a/src/plugins/intel/mm-broadband-modem-xmm7360-rpc.h b/src/plugins/intel/mm-broadband-modem-xmm7360-rpc.h index 18d107bc..feb717f5 100644 --- a/src/plugins/intel/mm-broadband-modem-xmm7360-rpc.h +++ b/src/plugins/intel/mm-broadband-modem-xmm7360-rpc.h @@ -61,6 +61,7 @@ typedef struct { guint timeout; /* Flag to allow cached replies */ gboolean allow_cached; + gboolean allow_retry_once; /* The response processor */ MMBroadbandModemXmm7360RpcResponseProcessor response_processor; /* Time to wait before sending this command (in seconds) */ diff --git a/src/plugins/intel/mm-broadband-modem-xmm7360.c b/src/plugins/intel/mm-broadband-modem-xmm7360.c index a57d47d3..3f9260c9 100644 --- a/src/plugins/intel/mm-broadband-modem-xmm7360.c +++ b/src/plugins/intel/mm-broadband-modem-xmm7360.c @@ -1090,14 +1090,14 @@ static const Xmm7360RpcMsgArg set_radio_signal_reporting_args[] = { }; static const MMBroadbandModemXmm7360RpcCommand init_sequence[] = { - { XMM7360_RPC_CALL_UTA_MS_SMS_INIT, FALSE, NULL, 3, FALSE, mm_broadband_modem_xmm7360_rpc_response_processor_continue_on_success }, - { XMM7360_RPC_CALL_UTA_MS_CBS_INIT, FALSE, NULL, 3, FALSE, mm_broadband_modem_xmm7360_rpc_response_processor_continue_on_success }, - { XMM7360_RPC_CALL_UTA_MS_NET_OPEN, FALSE, NULL, 3, FALSE, mm_broadband_modem_xmm7360_rpc_response_processor_continue_on_success }, - { XMM7360_RPC_CALL_UTA_MS_NET_SET_RADIO_SIGNAL_REPORTING, FALSE, set_radio_signal_reporting_args, 3, FALSE, mm_broadband_modem_xmm7360_rpc_response_processor_continue_on_success}, - { XMM7360_RPC_CALL_UTA_MS_CALL_CS_INIT, FALSE, NULL, 3, FALSE, mm_broadband_modem_xmm7360_rpc_response_processor_continue_on_success }, - { XMM7360_RPC_CALL_UTA_MS_CALL_PS_INITIALIZE, FALSE, NULL, 3, FALSE, mm_broadband_modem_xmm7360_rpc_response_processor_continue_on_success }, - { XMM7360_RPC_CALL_UTA_MS_SS_INIT, FALSE, NULL, 3, FALSE, mm_broadband_modem_xmm7360_rpc_response_processor_continue_on_success }, - { XMM7360_RPC_CALL_UTA_MS_SIM_OPEN_REQ, FALSE, NULL, 3, FALSE, mm_broadband_modem_xmm7360_rpc_response_processor_final }, + { XMM7360_RPC_CALL_UTA_MS_SMS_INIT, FALSE, NULL, 3, FALSE, TRUE, mm_broadband_modem_xmm7360_rpc_response_processor_continue_on_success }, + { XMM7360_RPC_CALL_UTA_MS_CBS_INIT, FALSE, NULL, 3, FALSE, FALSE, mm_broadband_modem_xmm7360_rpc_response_processor_continue_on_success }, + { XMM7360_RPC_CALL_UTA_MS_NET_OPEN, FALSE, NULL, 3, FALSE, FALSE, mm_broadband_modem_xmm7360_rpc_response_processor_continue_on_success }, + { XMM7360_RPC_CALL_UTA_MS_NET_SET_RADIO_SIGNAL_REPORTING, FALSE, set_radio_signal_reporting_args, 3, FALSE, FALSE, mm_broadband_modem_xmm7360_rpc_response_processor_continue_on_success}, + { XMM7360_RPC_CALL_UTA_MS_CALL_CS_INIT, FALSE, NULL, 3, FALSE, FALSE, mm_broadband_modem_xmm7360_rpc_response_processor_continue_on_success }, + { XMM7360_RPC_CALL_UTA_MS_CALL_PS_INITIALIZE, FALSE, NULL, 3, FALSE, FALSE, mm_broadband_modem_xmm7360_rpc_response_processor_continue_on_success }, + { XMM7360_RPC_CALL_UTA_MS_SS_INIT, FALSE, NULL, 3, FALSE, FALSE, mm_broadband_modem_xmm7360_rpc_response_processor_continue_on_success }, + { XMM7360_RPC_CALL_UTA_MS_SIM_OPEN_REQ, FALSE, NULL, 3, FALSE, FALSE, mm_broadband_modem_xmm7360_rpc_response_processor_final }, { 0 } };