port-qmi: monitor consecutive timeouts
This commit is contained in:
@@ -422,7 +422,7 @@ dnl-----------------------------------------------------------------------------
|
||||
dnl QMI support (enabled by default)
|
||||
dnl
|
||||
|
||||
LIBQMI_VERSION=1.31.7
|
||||
LIBQMI_VERSION=1.31.8
|
||||
|
||||
AC_ARG_WITH(qmi, AS_HELP_STRING([--without-qmi], [Build without QMI support]), [], [with_qmi=yes])
|
||||
AM_CONDITIONAL(WITH_QMI, test "x$with_qmi" = "xyes")
|
||||
|
@@ -247,7 +247,7 @@ config_h.set('WITH_MBIM', enable_mbim)
|
||||
# QMI support (enabled by default)
|
||||
enable_qmi = get_option('qmi')
|
||||
if enable_qmi
|
||||
qmi_glib_dep = dependency('qmi-glib', version: '>= 1.31.7')
|
||||
qmi_glib_dep = dependency('qmi-glib', version: '>= 1.31.8')
|
||||
endif
|
||||
config_h.set('WITH_QMI', enable_qmi)
|
||||
|
||||
|
@@ -64,6 +64,8 @@ struct _MMPortQmiPrivate {
|
||||
QrtrNode *node;
|
||||
#endif
|
||||
|
||||
/* timeout monitoring */
|
||||
gulong timeout_monitoring_id;
|
||||
/* endpoint info */
|
||||
gulong endpoint_info_signal_id;
|
||||
QmiDataEndpointType endpoint_type;
|
||||
@@ -189,6 +191,41 @@ mm_port_qmi_get_endpoint_interface_number (MMPortQmi *self)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
reset_timeout_monitoring (MMPortQmi *self,
|
||||
QmiDevice *qmi_device)
|
||||
{
|
||||
if (self->priv->timeout_monitoring_id && qmi_device) {
|
||||
g_signal_handler_disconnect (qmi_device, self->priv->timeout_monitoring_id);
|
||||
self->priv->timeout_monitoring_id = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
consecutive_timeouts_updated_cb (MMPortQmi *self,
|
||||
GParamSpec *pspec,
|
||||
QmiDevice *qmi_device)
|
||||
{
|
||||
g_signal_emit_by_name (self, MM_PORT_SIGNAL_TIMED_OUT, qmi_device_get_consecutive_timeouts (qmi_device));
|
||||
}
|
||||
|
||||
static void
|
||||
setup_timeout_monitoring (MMPortQmi *self,
|
||||
QmiDevice *qmi_device)
|
||||
{
|
||||
g_assert (qmi_device);
|
||||
|
||||
reset_timeout_monitoring (self, qmi_device);
|
||||
|
||||
g_assert (!self->priv->timeout_monitoring_id);
|
||||
self->priv->timeout_monitoring_id = g_signal_connect_swapped (qmi_device,
|
||||
"notify::" QMI_DEVICE_CONSECUTIVE_TIMEOUTS,
|
||||
G_CALLBACK (consecutive_timeouts_updated_cb),
|
||||
self);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void
|
||||
mm_port_qmi_release_client (MMPortQmi *self,
|
||||
QmiService service,
|
||||
@@ -2491,6 +2528,7 @@ port_open_step (GTask *task)
|
||||
g_assert (ctx->device);
|
||||
g_assert (!self->priv->qmi_device);
|
||||
self->priv->qmi_device = g_object_ref (ctx->device);
|
||||
setup_timeout_monitoring (self, ctx->device);
|
||||
self->priv->in_progress = FALSE;
|
||||
g_task_return_boolean (task, TRUE);
|
||||
g_object_unref (task);
|
||||
@@ -2629,6 +2667,9 @@ mm_port_qmi_close (MMPortQmi *self,
|
||||
ctx->qmi_device = g_steal_pointer (&self->priv->qmi_device);
|
||||
g_task_set_task_data (task, ctx, (GDestroyNotify)port_qmi_close_context_free);
|
||||
|
||||
/* Reset timeout monitoring logic */
|
||||
reset_timeout_monitoring (self, ctx->qmi_device);
|
||||
|
||||
/* Release all allocated clients */
|
||||
for (l = self->priv->services; l; l = g_list_next (l)) {
|
||||
ServiceInfo *info = l->data;
|
||||
@@ -2769,6 +2810,7 @@ dispose (GObject *object)
|
||||
g_clear_object (&self->priv->node);
|
||||
#endif
|
||||
/* Clear device object */
|
||||
reset_timeout_monitoring (self, self->priv->qmi_device);
|
||||
g_clear_object (&self->priv->qmi_device);
|
||||
|
||||
g_clear_pointer (&self->priv->net_driver, g_free);
|
||||
|
Reference in New Issue
Block a user