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

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