broadband-modem-qmi: replace get serving system 3gpp with get system info
Set get system info as default and fall back to get serving system 3gpp for those modems not supporting the former.
This commit is contained in:

committed by
Aleksander Morgado

parent
639d0c62a9
commit
a1fdba508d
@@ -2797,8 +2797,6 @@ modem_3gpp_run_registration_checks_finish (MMIfaceModem3gpp *self,
|
|||||||
return g_task_propagate_boolean (G_TASK (res), error);
|
return g_task_propagate_boolean (G_TASK (res), error);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined WITH_NEWEST_QMI_COMMANDS
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
common_process_serving_system_3gpp (MMBroadbandModemQmi *self,
|
common_process_serving_system_3gpp (MMBroadbandModemQmi *self,
|
||||||
QmiMessageNasGetServingSystemOutput *response_output,
|
QmiMessageNasGetServingSystemOutput *response_output,
|
||||||
@@ -3060,8 +3058,6 @@ get_serving_system_3gpp_ready (QmiClientNas *client,
|
|||||||
qmi_message_nas_get_serving_system_output_unref (output);
|
qmi_message_nas_get_serving_system_output_unref (output);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* WITH_NEWEST_QMI_COMMANDS */
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
process_common_info (QmiNasServiceStatus service_status,
|
process_common_info (QmiNasServiceStatus service_status,
|
||||||
gboolean domain_valid,
|
gboolean domain_valid,
|
||||||
@@ -3547,24 +3543,47 @@ get_system_info_ready (QmiClientNas *client,
|
|||||||
QmiMessageNasGetSystemInfoOutput *output;
|
QmiMessageNasGetSystemInfoOutput *output;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
|
self = g_task_get_source_object (task);
|
||||||
|
|
||||||
output = qmi_client_nas_get_system_info_finish (client, res, &error);
|
output = qmi_client_nas_get_system_info_finish (client, res, &error);
|
||||||
if (!output) {
|
if (!output) {
|
||||||
g_prefix_error (&error, "QMI operation failed: ");
|
mm_obj_dbg (self, "couldn't get system info: '%s', falling back to nas get serving system 3gpp",
|
||||||
g_task_return_error (task, error);
|
error->message);
|
||||||
g_object_unref (task);
|
qmi_client_nas_get_serving_system (QMI_CLIENT_NAS (client),
|
||||||
|
NULL,
|
||||||
|
10,
|
||||||
|
NULL,
|
||||||
|
(GAsyncReadyCallback)get_serving_system_3gpp_ready,
|
||||||
|
task);
|
||||||
|
g_clear_error (&error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!qmi_message_nas_get_system_info_output_get_result (output, &error)) {
|
if (!qmi_message_nas_get_system_info_output_get_result (output, &error)) {
|
||||||
|
qmi_message_nas_get_system_info_output_unref (output);
|
||||||
|
if (g_error_matches (error,
|
||||||
|
QMI_PROTOCOL_ERROR,
|
||||||
|
QMI_PROTOCOL_ERROR_INVALID_QMI_COMMAND) ||
|
||||||
|
g_error_matches (error,
|
||||||
|
QMI_PROTOCOL_ERROR,
|
||||||
|
QMI_PROTOCOL_ERROR_NOT_SUPPORTED)) {
|
||||||
|
mm_obj_dbg (self, "couldn't get system info: '%s', falling back to nas get serving system 3gpp",
|
||||||
|
error->message);
|
||||||
|
qmi_client_nas_get_serving_system (QMI_CLIENT_NAS (client),
|
||||||
|
NULL,
|
||||||
|
10,
|
||||||
|
NULL,
|
||||||
|
(GAsyncReadyCallback)get_serving_system_3gpp_ready,
|
||||||
|
task);
|
||||||
|
g_clear_error (&error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
g_prefix_error (&error, "Couldn't get system info: ");
|
g_prefix_error (&error, "Couldn't get system info: ");
|
||||||
g_task_return_error (task, error);
|
g_task_return_error (task, error);
|
||||||
qmi_message_nas_get_system_info_output_unref (output);
|
|
||||||
g_object_unref (task);
|
g_object_unref (task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
self = g_task_get_source_object (task);
|
|
||||||
|
|
||||||
common_process_system_info_3gpp (self, output, NULL);
|
common_process_system_info_3gpp (self, output, NULL);
|
||||||
|
|
||||||
g_task_return_boolean (task, TRUE);
|
g_task_return_boolean (task, TRUE);
|
||||||
@@ -3572,8 +3591,6 @@ get_system_info_ready (QmiClientNas *client,
|
|||||||
qmi_message_nas_get_system_info_output_unref (output);
|
qmi_message_nas_get_system_info_output_unref (output);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* WITH_NEWEST_QMI_COMMANDS */
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
modem_3gpp_run_registration_checks (MMIfaceModem3gpp *self,
|
modem_3gpp_run_registration_checks (MMIfaceModem3gpp *self,
|
||||||
gboolean is_cs_supported,
|
gboolean is_cs_supported,
|
||||||
@@ -3593,21 +3610,12 @@ modem_3gpp_run_registration_checks (MMIfaceModem3gpp *self,
|
|||||||
|
|
||||||
task = g_task_new (self, NULL, callback, user_data);
|
task = g_task_new (self, NULL, callback, user_data);
|
||||||
|
|
||||||
#if defined WITH_NEWEST_QMI_COMMANDS
|
|
||||||
qmi_client_nas_get_system_info (QMI_CLIENT_NAS (client),
|
qmi_client_nas_get_system_info (QMI_CLIENT_NAS (client),
|
||||||
NULL,
|
NULL,
|
||||||
10,
|
10,
|
||||||
NULL,
|
NULL,
|
||||||
(GAsyncReadyCallback)get_system_info_ready,
|
(GAsyncReadyCallback)get_system_info_ready,
|
||||||
task);
|
task);
|
||||||
#else
|
|
||||||
qmi_client_nas_get_serving_system (QMI_CLIENT_NAS (client),
|
|
||||||
NULL,
|
|
||||||
10,
|
|
||||||
NULL,
|
|
||||||
(GAsyncReadyCallback)get_serving_system_3gpp_ready,
|
|
||||||
task);
|
|
||||||
#endif /* WITH_NEWEST_QMI_COMMANDS */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
Reference in New Issue
Block a user