Merge request !1433 from 'id-mm-max-timeouts'

base-modem: make max timeouts configurable via udev rule

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1433
This commit is contained in:
Dan Williams
2026-09-20 15:49:17 -05:00
2 changed files with 27 additions and 0 deletions
+16
View File
@@ -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.
+11
View File
@@ -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,