broadband-modem-qmi: prefer system info indication if available
Prefer system info indication if available and fall back to serving system indication if the former is not supported.
This commit is contained in:

committed by
Aleksander Morgado

parent
ba84f97855
commit
e5f08b7766
@@ -117,9 +117,7 @@ struct _MMBroadbandModemQmiPrivate {
|
|||||||
gboolean unsolicited_registration_events_enabled;
|
gboolean unsolicited_registration_events_enabled;
|
||||||
gboolean unsolicited_registration_events_setup;
|
gboolean unsolicited_registration_events_setup;
|
||||||
guint serving_system_indication_id;
|
guint serving_system_indication_id;
|
||||||
#if defined WITH_NEWEST_QMI_COMMANDS
|
|
||||||
guint system_info_indication_id;
|
guint system_info_indication_id;
|
||||||
#endif /* WITH_NEWEST_QMI_COMMANDS */
|
|
||||||
guint network_reject_indication_id;
|
guint network_reject_indication_id;
|
||||||
|
|
||||||
/* CDMA activation helpers */
|
/* CDMA activation helpers */
|
||||||
@@ -3622,6 +3620,7 @@ modem_3gpp_run_registration_checks (MMIfaceModem3gpp *self,
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
QmiClientNas *client;
|
QmiClientNas *client;
|
||||||
gboolean enable; /* TRUE for enabling, FALSE for disabling */
|
gboolean enable; /* TRUE for enabling, FALSE for disabling */
|
||||||
|
gboolean system_info_checked;
|
||||||
} UnsolicitedRegistrationEventsContext;
|
} UnsolicitedRegistrationEventsContext;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -3659,6 +3658,9 @@ modem_3gpp_enable_disable_unsolicited_registration_events_finish (MMIfaceModem3g
|
|||||||
return g_task_propagate_boolean (G_TASK (res), error);
|
return g_task_propagate_boolean (G_TASK (res), error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
common_enable_disable_unsolicited_registration_events_serving_system (GTask *task);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ri_serving_system_or_system_info_ready (QmiClientNas *client,
|
ri_serving_system_or_system_info_ready (QmiClientNas *client,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
@@ -3674,24 +3676,28 @@ ri_serving_system_or_system_info_ready (QmiClientNas *client,
|
|||||||
|
|
||||||
output = qmi_client_nas_register_indications_finish (client, res, &error);
|
output = qmi_client_nas_register_indications_finish (client, res, &error);
|
||||||
if (!output || !qmi_message_nas_register_indications_output_get_result (output, &error)) {
|
if (!output || !qmi_message_nas_register_indications_output_get_result (output, &error)) {
|
||||||
mm_obj_dbg (self, "couldn't register indications: '%s'", error->message);
|
if (!ctx->system_info_checked) {
|
||||||
if (ctx->enable) {
|
mm_obj_dbg (self, "couldn't register system info indication: '%s', falling-back to serving system", error->message);
|
||||||
#if defined WITH_NEWEST_QMI_COMMANDS
|
ctx->system_info_checked = TRUE;
|
||||||
mm_obj_dbg (self, "assuming system info indications are always enabled");
|
common_enable_disable_unsolicited_registration_events_serving_system (task);
|
||||||
#else
|
g_clear_error (&error);
|
||||||
mm_obj_dbg (self, "assuming serving system indications are always enabled");
|
return;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (ctx->enable)
|
||||||
|
mm_obj_dbg (self, "couldn't register serving system indications: '%s', assuming always enabled", error->message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!ctx->system_info_checked)
|
||||||
|
ctx->system_info_checked = TRUE;
|
||||||
|
|
||||||
/* Just ignore errors for now */
|
/* Just ignore errors for now */
|
||||||
self->priv->unsolicited_registration_events_enabled = ctx->enable;
|
self->priv->unsolicited_registration_events_enabled = ctx->enable;
|
||||||
g_task_return_boolean (task, TRUE);
|
g_task_return_boolean (task, TRUE);
|
||||||
g_object_unref (task);
|
g_object_unref (task);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined WITH_NEWEST_QMI_COMMANDS
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
common_enable_disable_unsolicited_registration_events_serving_system (GTask *task)
|
common_enable_disable_unsolicited_registration_events_serving_system (GTask *task)
|
||||||
{
|
{
|
||||||
@@ -3711,8 +3717,6 @@ common_enable_disable_unsolicited_registration_events_serving_system (GTask *tas
|
|||||||
task);
|
task);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* WITH_NEWEST_QMI_COMMANDS */
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
common_enable_disable_unsolicited_registration_events_system_info (GTask *task)
|
common_enable_disable_unsolicited_registration_events_system_info (GTask *task)
|
||||||
{
|
{
|
||||||
@@ -3722,6 +3726,11 @@ common_enable_disable_unsolicited_registration_events_system_info (GTask *task)
|
|||||||
ctx = g_task_get_task_data (task);
|
ctx = g_task_get_task_data (task);
|
||||||
input = qmi_message_nas_register_indications_input_new ();
|
input = qmi_message_nas_register_indications_input_new ();
|
||||||
qmi_message_nas_register_indications_input_set_system_info (input, ctx->enable, NULL);
|
qmi_message_nas_register_indications_input_set_system_info (input, ctx->enable, NULL);
|
||||||
|
/* When enabling, serving system events are turned-off, since some modems have them
|
||||||
|
* active by default. They will be turned-on again if setting system info events fails
|
||||||
|
*/
|
||||||
|
if (ctx->enable)
|
||||||
|
qmi_message_nas_register_indications_input_set_serving_system_events (input, FALSE, NULL);
|
||||||
qmi_message_nas_register_indications_input_set_network_reject_information (input, ctx->enable, FALSE, NULL);
|
qmi_message_nas_register_indications_input_set_network_reject_information (input, ctx->enable, FALSE, NULL);
|
||||||
qmi_client_nas_register_indications (
|
qmi_client_nas_register_indications (
|
||||||
ctx->client,
|
ctx->client,
|
||||||
@@ -3732,8 +3741,6 @@ common_enable_disable_unsolicited_registration_events_system_info (GTask *task)
|
|||||||
task);
|
task);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* WITH_NEWEST_QMI_COMMANDS */
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
modem_3gpp_disable_unsolicited_registration_events (MMIfaceModem3gpp *self,
|
modem_3gpp_disable_unsolicited_registration_events (MMIfaceModem3gpp *self,
|
||||||
gboolean cs_supported,
|
gboolean cs_supported,
|
||||||
@@ -3756,11 +3763,7 @@ modem_3gpp_disable_unsolicited_registration_events (MMIfaceModem3gpp *self,
|
|||||||
callback,
|
callback,
|
||||||
user_data);
|
user_data);
|
||||||
|
|
||||||
#if defined WITH_NEWEST_QMI_COMMANDS
|
|
||||||
common_enable_disable_unsolicited_registration_events_system_info (task);
|
common_enable_disable_unsolicited_registration_events_system_info (task);
|
||||||
#else
|
|
||||||
common_enable_disable_unsolicited_registration_events_serving_system (task);
|
|
||||||
#endif /* WITH_NEWEST_QMI_COMMANDS */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -3785,11 +3788,7 @@ modem_3gpp_enable_unsolicited_registration_events (MMIfaceModem3gpp *self,
|
|||||||
callback,
|
callback,
|
||||||
user_data);
|
user_data);
|
||||||
|
|
||||||
#if defined WITH_NEWEST_QMI_COMMANDS
|
|
||||||
common_enable_disable_unsolicited_registration_events_system_info (task);
|
common_enable_disable_unsolicited_registration_events_system_info (task);
|
||||||
#else
|
|
||||||
common_enable_disable_unsolicited_registration_events_serving_system (task);
|
|
||||||
#endif /* WITH_NEWEST_QMI_COMMANDS */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@@ -4745,7 +4744,6 @@ common_setup_cleanup_unsolicited_registration_events_finish (MMBroadbandModemQmi
|
|||||||
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
|
||||||
system_info_indication_cb (QmiClientNas *client,
|
system_info_indication_cb (QmiClientNas *client,
|
||||||
QmiIndicationNasSystemInfoOutput *output,
|
QmiIndicationNasSystemInfoOutput *output,
|
||||||
@@ -4755,8 +4753,6 @@ system_info_indication_cb (QmiClientNas *client,
|
|||||||
common_process_system_info_3gpp (self, NULL, output);
|
common_process_system_info_3gpp (self, NULL, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* WITH_NEWEST_QMI_COMMANDS */
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
serving_system_indication_cb (QmiClientNas *client,
|
serving_system_indication_cb (QmiClientNas *client,
|
||||||
QmiIndicationNasServingSystemOutput *output,
|
QmiIndicationNasServingSystemOutput *output,
|
||||||
@@ -4768,8 +4764,6 @@ serving_system_indication_cb (QmiClientNas *client,
|
|||||||
common_process_serving_system_cdma (self, NULL, output);
|
common_process_serving_system_cdma (self, NULL, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* network reject indications enabled in both with/without newest QMI commands */
|
/* network reject indications enabled in both with/without newest QMI commands */
|
||||||
static void
|
static void
|
||||||
network_reject_indication_cb (QmiClientNas *client,
|
network_reject_indication_cb (QmiClientNas *client,
|
||||||
@@ -4825,7 +4819,6 @@ common_setup_cleanup_unsolicited_registration_events (MMBroadbandModemQmi *self,
|
|||||||
/* Store new state */
|
/* Store new state */
|
||||||
self->priv->unsolicited_registration_events_setup = enable;
|
self->priv->unsolicited_registration_events_setup = enable;
|
||||||
|
|
||||||
#if defined WITH_NEWEST_QMI_COMMANDS
|
|
||||||
/* Connect/Disconnect "System Info" indications */
|
/* Connect/Disconnect "System Info" indications */
|
||||||
if (enable) {
|
if (enable) {
|
||||||
g_assert (self->priv->system_info_indication_id == 0);
|
g_assert (self->priv->system_info_indication_id == 0);
|
||||||
@@ -4839,7 +4832,6 @@ common_setup_cleanup_unsolicited_registration_events (MMBroadbandModemQmi *self,
|
|||||||
g_signal_handler_disconnect (client, self->priv->system_info_indication_id);
|
g_signal_handler_disconnect (client, self->priv->system_info_indication_id);
|
||||||
self->priv->system_info_indication_id = 0;
|
self->priv->system_info_indication_id = 0;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
/* Connect/Disconnect "Serving System" indications */
|
/* Connect/Disconnect "Serving System" indications */
|
||||||
if (enable) {
|
if (enable) {
|
||||||
g_assert (self->priv->serving_system_indication_id == 0);
|
g_assert (self->priv->serving_system_indication_id == 0);
|
||||||
@@ -4853,7 +4845,6 @@ common_setup_cleanup_unsolicited_registration_events (MMBroadbandModemQmi *self,
|
|||||||
g_signal_handler_disconnect (client, self->priv->serving_system_indication_id);
|
g_signal_handler_disconnect (client, self->priv->serving_system_indication_id);
|
||||||
self->priv->serving_system_indication_id = 0;
|
self->priv->serving_system_indication_id = 0;
|
||||||
}
|
}
|
||||||
#endif /* WITH_NEWEST_QMI_COMMANDS */
|
|
||||||
|
|
||||||
/* Connect/Disconnect "Network Reject" indications */
|
/* Connect/Disconnect "Network Reject" indications */
|
||||||
if (enable) {
|
if (enable) {
|
||||||
|
Reference in New Issue
Block a user