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

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