[PATCH 1/2] port-probe: add getter for ID_MM_PORT_READY_DELAY udev tag

Matthew Starr mstarr at hedonline.com
Tue May 1 16:19:58 UTC 2018


Added support for a ID_MM_PORT_READY_DELAY udev tag which can be used to
delay the init of a modem.  This is useful for modems that may not
respond correctly within some amount of time after a reset.
---
 src/mm-port-probe.c | 8 ++++++++
 src/mm-port-probe.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/src/mm-port-probe.c b/src/mm-port-probe.c
index 13c89861..cd411c04 100644
--- a/src/mm-port-probe.c
+++ b/src/mm-port-probe.c
@@ -88,6 +88,7 @@ struct _MMPortProbePrivate {
 
     /* From udev tags */
     gboolean is_ignored;
+    gint ready_delay;
 
     /* Current probing task. Only one can be available at a time */
     GTask *task;
@@ -1695,6 +1696,12 @@ mm_port_probe_is_ignored (MMPortProbe *self)
     return self->priv->is_ignored;
 }
 
+gint
+mm_port_probe_get_ready_delay (MMPortProbe *self)
+{
+    return (self->priv->ready_delay);
+}
+
 const gchar *
 mm_port_probe_get_port_name (MMPortProbe *self)
 {
@@ -1748,6 +1755,7 @@ set_property (GObject *object,
         /* construct only */
         self->priv->port = g_value_dup_object (value);
         self->priv->is_ignored = mm_kernel_device_get_property_as_boolean (self->priv->port, "ID_MM_PORT_IGNORE");
+        self->priv->ready_delay = mm_kernel_device_get_property_as_int (self->priv->port, "ID_MM_PORT_READY_DELAY");
         break;
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
diff --git a/src/mm-port-probe.h b/src/mm-port-probe.h
index a300092e..5f3e1763 100644
--- a/src/mm-port-probe.h
+++ b/src/mm-port-probe.h
@@ -131,6 +131,7 @@ const gchar  *mm_port_probe_get_vendor       (MMPortProbe *self);
 const gchar  *mm_port_probe_get_product      (MMPortProbe *self);
 gboolean      mm_port_probe_is_icera         (MMPortProbe *self);
 gboolean      mm_port_probe_is_ignored       (MMPortProbe *self);
+gint          mm_port_probe_get_ready_delay  (MMPortProbe *self);
 
 /* Additional helpers */
 gboolean mm_port_probe_list_has_at_port   (GList *list);
-- 
2.14.1


More information about the ModemManager-devel mailing list