diff --git a/include/ModemManager-tags.h b/include/ModemManager-tags.h index 59c31f12..6f74cf55 100644 --- a/include/ModemManager-tags.h +++ b/include/ModemManager-tags.h @@ -350,6 +350,22 @@ */ #define ID_MM_AT_NETWORK_TIME_BROKEN "ID_MM_AT_NETWORK_TIME_BROKEN" +/** + * ID_MM_MAX_TIMEOUTS: + * + * This is a device-specific tag that allows users to specify the maximum number + * of consecutive command timeouts allowed before the modem is marked as invalid + * and re-probed. + * + * An integer value greater or equal than 0 must be given. The value 0 in this + * tag completely disables the timeout monitoring feature. + * + * If not given, the default value of 10 consecutive timeouts is used. + * + * Since: 1.26 + */ +#define ID_MM_MAX_TIMEOUTS "ID_MM_MAX_TIMEOUTS" + /* * The following symbols are deprecated. We don't add them to -compat * because this -tags file is not really part of the installed API. diff --git a/src/mm-base-modem.c b/src/mm-base-modem.c index 224320f6..2ff45d4d 100644 --- a/src/mm-base-modem.c +++ b/src/mm-base-modem.c @@ -446,6 +446,17 @@ base_modem_internal_grab_port (MMBaseModem *self, #endif } + /* Check if a custom max timeouts value is set via udev */ + if (mm_kernel_device_has_global_property (kernel_device, ID_MM_MAX_TIMEOUTS)) { + guint max_timeouts; + + max_timeouts = mm_kernel_device_get_global_property_as_int (kernel_device, ID_MM_MAX_TIMEOUTS); + if (max_timeouts != self->priv->max_timeouts) { + mm_obj_dbg (self, "max timeouts overridden via udev: %u", max_timeouts); + self->priv->max_timeouts = max_timeouts; + } + } + if (port_monitoring) { if (self->priv->max_timeouts > 0) g_signal_connect (port,