Blame SOURCES/0001-sierra-do-not-grab-cdc_ether-devices.patch

cf57e8
From 40043de96524c61d1f8b4cc25c171924c4f312a6 Mon Sep 17 00:00:00 2001
cf57e8
From: Lubomir Rintel <lkundrak@v3.sk>
cf57e8
Date: Fri, 17 May 2019 16:42:47 +0200
cf57e8
Subject: [PATCH] sierra: do not grab cdc_ether devices
cf57e8
cf57e8
The Sierra modems may have more network interfaces than just the modem data
cf57e8
one, such as the SoC management interface or an application specific ones
cf57e8
created via one of the network USB gadget drivers.
cf57e8
cf57e8
We grab them even they're not DEVTYPE=wwan. Let's not do that. Also, to stay on
cf57e8
the safe side, keep grabbing qmi_wwan.
cf57e8
---
cf57e8
 plugins/sierra/mm-plugin-sierra.c | 37 +++++++++++++++++++++++++++++++
cf57e8
 1 file changed, 37 insertions(+)
cf57e8
cf57e8
diff --git a/plugins/sierra/mm-plugin-sierra.c b/plugins/sierra/mm-plugin-sierra.c
cf57e8
index 03a06bd8..01e753fa 100644
cf57e8
--- a/plugins/sierra/mm-plugin-sierra.c
cf57e8
+++ b/plugins/sierra/mm-plugin-sierra.c
cf57e8
@@ -80,6 +80,42 @@ create_modem (MMPlugin *self,
cf57e8
                                                   product));
cf57e8
 }
cf57e8
 
cf57e8
+gboolean
cf57e8
+grab_port (MMPlugin *self,
cf57e8
+           MMBaseModem *modem,
cf57e8
+           MMPortProbe *probe,
cf57e8
+           GError **error)
cf57e8
+{
cf57e8
+    MMPortSerialAtFlag pflags = MM_PORT_SERIAL_AT_FLAG_NONE;
cf57e8
+    GUdevDevice *port;
cf57e8
+    const gchar *subsys;
cf57e8
+    const gchar *name;
cf57e8
+
cf57e8
+    port = mm_port_probe_peek_port (probe);
cf57e8
+    subsys = mm_port_probe_get_port_subsys (probe);
cf57e8
+    name = mm_port_probe_get_port_name (probe);
cf57e8
+
cf57e8
+    if (g_strcmp0 (g_udev_device_get_subsystem (port), "net") == 0 &&
cf57e8
+        g_strcmp0 (g_udev_device_get_property (port, "DEVTYPE"), "wwan") != 0 &&
cf57e8
+        g_strcmp0 (mm_device_utils_get_port_driver (port), "qmi_wwan") != 0) {
cf57e8
+        g_set_error (error,
cf57e8
+                     MM_CORE_ERROR,
cf57e8
+                     MM_CORE_ERROR_UNSUPPORTED,
cf57e8
+                     "Cannot add port '%s/%s', not the QMI data interface",
cf57e8
+                     subsys,
cf57e8
+                     name);
cf57e8
+        return FALSE;
cf57e8
+    }
cf57e8
+
cf57e8
+    return mm_base_modem_grab_port (modem,
cf57e8
+                                    subsys,
cf57e8
+                                    name,
cf57e8
+                                    mm_port_probe_get_parent_path (probe),
cf57e8
+                                    mm_port_probe_get_port_type (probe),
cf57e8
+                                    pflags,
cf57e8
+                                    error);
cf57e8
+}
cf57e8
+
cf57e8
 /*****************************************************************************/
cf57e8
 
cf57e8
 G_MODULE_EXPORT MMPlugin *
cf57e8
@@ -113,4 +149,5 @@ mm_plugin_sierra_class_init (MMPluginSierraClass *klass)
cf57e8
     MMPluginClass *plugin_class = MM_PLUGIN_CLASS (klass);
cf57e8
 
cf57e8
     plugin_class->create_modem = create_modem;
cf57e8
+    plugin_class->grab_port = grab_port;
cf57e8
 }
cf57e8
-- 
cf57e8
2.18.1
cf57e8