broadband-modem-qmi: Enable Cell Broadcast

For QMI we have an extra QMI request so use that to make sure receiving
messages is actually enabled.

Closes: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1325
Signed-off-by: Guido Günther <agx@sigxcpu.org>
This commit is contained in:
Guido Günther
2025-04-13 05:01:32 +00:00
committed by Dan Williams
parent e25dd7db97
commit 219e8eb103
+59
View File
@@ -11005,6 +11005,63 @@ cell_broadcast_cleanup_unsolicited_events (MMIfaceModemCellBroadcast *_self,
}
}
/*****************************************************************************/
/* Enable unsolicited event handlers (CellBroadcast interface) */
static gboolean
cell_broadcast_enable_unsolicited_events_finish (MMIfaceModemCellBroadcast *_self,
GAsyncResult *res,
GError **error)
{
return g_task_propagate_boolean (G_TASK (res), error);
}
static void
cell_broadcast_set_broadcast_activation_ready (QmiClientWms *client,
GAsyncResult *res,
gpointer user_data)
{
g_autoptr(QmiMessageWmsSetBroadcastActivationOutput) output = NULL;
g_autoptr(GTask) task = G_TASK (user_data);
GError *error = NULL;
output = qmi_client_wms_set_broadcast_activation_finish (client, res, &error);
if (!output) {
g_prefix_error (&error, "QMI operation failed: ");
g_task_return_error (task, error);
} else if (!qmi_message_wms_set_broadcast_activation_output_get_result (output, &error)) {
g_prefix_error (&error, "Couldn't enable Cell Broadcasts: ");
g_task_return_error (task, error);
} else
g_task_return_boolean (task, TRUE);
}
static void
cell_broadcast_enable_unsolicited_events (MMIfaceModemCellBroadcast *_self,
GAsyncReadyCallback callback,
gpointer user_data)
{
MMBroadbandModemQmi *self = MM_BROADBAND_MODEM_QMI (_self);
QmiClient *client = NULL;
g_autoptr(GArray) channels_array = NULL;
g_autoptr(QmiMessageWmsSetBroadcastActivationInput) input = NULL;
if (!mm_shared_qmi_ensure_client (MM_SHARED_QMI (self),
QMI_SERVICE_WMS, &client,
callback, user_data))
return;
mm_obj_dbg (self, "Enabling Cell Broadcasts...");
input = qmi_message_wms_set_broadcast_activation_input_new ();
qmi_message_wms_set_broadcast_activation_input_set_activation (input, QMI_WMS_MESSAGE_MODE_GSM_WCDMA, TRUE, NULL);
qmi_client_wms_set_broadcast_activation (QMI_CLIENT_WMS (client),
input,
5,
NULL,
(GAsyncReadyCallback)cell_broadcast_set_broadcast_activation_ready,
g_task_new (self, NULL, callback, user_data));
}
/*****************************************************************************/
/* Setup unsolicited event handlers (CellBroadcast interface) */
@@ -14922,6 +14979,8 @@ iface_modem_cell_broadcast_init (MMIfaceModemCellBroadcastInterface *iface)
iface->check_support_finish = cell_broadcast_check_support_finish;
iface->setup_unsolicited_events = cell_broadcast_setup_unsolicited_events;
iface->setup_unsolicited_events_finish = cell_broadcast_setup_unsolicited_events_finish;
iface->enable_unsolicited_events = cell_broadcast_enable_unsolicited_events;
iface->enable_unsolicited_events_finish = cell_broadcast_enable_unsolicited_events_finish;
iface->load_channels = cell_broadcast_load_channels;
iface->load_channels_finish = cell_broadcast_load_channels_finish;
iface->cleanup_unsolicited_events = cell_broadcast_cleanup_unsolicited_events;