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