Update to 1.10.2 release

Don't grab cdc_ether devices on Sierra QMI modems
This commit is contained in:
Lubomir Rintel 2019-06-14 11:44:33 +02:00
parent 9683aed6e5
commit a458f28c55
4 changed files with 196 additions and 3 deletions

1
.gitignore vendored
View File

@ -50,3 +50,4 @@ ModemManager-0.4.git20100720.tar.bz2
/ModemManager-1.8.2.tar.xz
/ModemManager-1.9.990.tar.xz
/ModemManager-1.10.0.tar.xz
/ModemManager-1.10.2.tar.xz

View File

@ -0,0 +1,185 @@
From fd1a26fc36df005d66627109875631264d2f8e19 Mon Sep 17 00:00:00 2001
From: Aleksander Morgado <aleksander@aleksander.es>
Date: Wed, 22 May 2019 23:20:30 +0200
Subject: [PATCH] plugin: ignore unwanted net ports
* For QMI modems, make sure we only grab QMI data ports (flag the
rest as ignored).
* For MBIM modems, make sure we only grab MBIM data ports (flag the
rest as ignored).
* For other plugins that use NET ports in their logic, make sure we
only grab non-QMI and non-MBIM data ports.
---
src/mm-plugin.c | 120 +++++++++++++++++++++++++++++++++++-------------
1 file changed, 89 insertions(+), 31 deletions(-)
diff --git a/src/mm-plugin.c b/src/mm-plugin.c
index 08fe2cd0..a19111ff 100644
--- a/src/mm-plugin.c
+++ b/src/mm-plugin.c
@@ -37,6 +37,13 @@
#include "mm-log.h"
#include "mm-daemon-enums-types.h"
+#if defined WITH_QMI
+# include "mm-broadband-modem-qmi.h"
+#endif
+#if defined WITH_MBIM
+# include "mm-broadband-modem-mbim.h"
+#endif
+
G_DEFINE_TYPE (MMPlugin, mm_plugin, G_TYPE_OBJECT)
/* Virtual port corresponding to the embedded modem */
@@ -920,9 +927,22 @@ mm_plugin_create_modem (MMPlugin *self,
/* Grab each port */
for (l = port_probes; l; l = g_list_next (l)) {
- GError *inner_error = NULL;
- MMPortProbe *probe = MM_PORT_PROBE (l->data);
- gboolean grabbed;
+ GError *inner_error = NULL;
+ MMPortProbe *probe;
+ gboolean grabbed = FALSE;
+ gboolean force_ignored = FALSE;
+ const gchar *subsys;
+ const gchar *name;
+ const gchar *driver;
+ MMPortType port_type;
+
+ probe = MM_PORT_PROBE (l->data);
+
+ subsys = mm_port_probe_get_port_subsys (probe);
+ name = mm_port_probe_get_port_name (probe);
+ port_type = mm_port_probe_get_port_type (probe);
+
+ driver = mm_kernel_device_get_driver (mm_port_probe_peek_port (probe));
/* If grabbing a port fails, just warn. We'll decide if the modem is
* valid or not when all ports get organized */
@@ -931,45 +951,82 @@ mm_plugin_create_modem (MMPlugin *self,
* probed and accepted by the generic plugin, which is overwritten
* by the specific one when needed. */
if (apply_subsystem_filter (self, mm_port_probe_peek_port (probe))) {
- grabbed = FALSE;
inner_error = g_error_new (MM_CORE_ERROR,
MM_CORE_ERROR_UNSUPPORTED,
"unsupported subsystem: '%s'",
- mm_port_probe_get_port_subsys (probe));
+ subsys);
+ goto next;
}
+
/* Ports that are explicitly blacklisted will be grabbed as ignored */
- else if (mm_port_probe_is_ignored (probe)) {
- mm_dbg ("(%s/%s): port is blacklisted",
- mm_port_probe_get_port_subsys (probe),
- mm_port_probe_get_port_name (probe));
- grabbed = mm_base_modem_grab_port (modem,
- mm_port_probe_peek_port (probe),
- MM_PORT_TYPE_IGNORED,
- MM_PORT_SERIAL_AT_FLAG_NONE,
- &inner_error);
+ if (mm_port_probe_is_ignored (probe)) {
+ mm_dbg ("(%s/%s): port is blacklisted", subsys, name);
+ force_ignored = TRUE;
+ goto grab_port;
}
-#if !defined WITH_QMI
- else if (mm_port_probe_get_port_type (probe) == MM_PORT_TYPE_NET &&
- !g_strcmp0 (mm_kernel_device_get_driver (mm_port_probe_peek_port (probe)), "qmi_wwan")) {
- /* Try to generically grab the port, but flagged as ignored */
- grabbed = mm_base_modem_grab_port (modem,
- mm_port_probe_peek_port (probe),
- MM_PORT_TYPE_IGNORED,
- MM_PORT_SERIAL_AT_FLAG_NONE,
- &inner_error);
+
+#if defined WITH_QMI
+ if (MM_IS_BROADBAND_MODEM_QMI (modem) &&
+ port_type == MM_PORT_TYPE_NET &&
+ g_strcmp0 (driver, "qmi_wwan") != 0) {
+ /* Non-QMI net ports are ignored in QMI modems */
+ mm_dbg ("(%s/%s): ignoring non-QMI net port in QMI modem", subsys, name);
+ force_ignored = TRUE;
+ goto grab_port;
+ }
+
+ if (!MM_IS_BROADBAND_MODEM_QMI (modem) &&
+ port_type == MM_PORT_TYPE_NET &&
+ g_strcmp0 (driver, "qmi_wwan") == 0) {
+ /* QMI net ports are ignored in non-QMI modems */
+ mm_dbg ("(%s/%s): ignoring QMI net port in non-QMI modem", subsys, name);
+ force_ignored = TRUE;
+ goto grab_port;
+ }
+#else
+ if (port_type == MM_PORT_TYPE_NET &&
+ g_strcmp0 (driver, "qmi_wwan") != 0) {
+ /* QMI net ports are ignored if QMI support not built */
+ mm_dbg ("(%s/%s): ignoring QMI net port as QMI support isn't available", subsys, name);
+ force_ignored = TRUE;
+ goto grab_port;
+ }
+#endif
+
+#if defined WITH_MBIM
+ if (MM_IS_BROADBAND_MODEM_MBIM (modem) &&
+ port_type == MM_PORT_TYPE_NET &&
+ g_strcmp0 (driver, "cdc_mbim") != 0) {
+ /* Non-MBIM net ports are ignored in MBIM modems */
+ mm_dbg ("(%s/%s): ignoring non-MBIM net port in MBIM modem", subsys, name);
+ force_ignored = TRUE;
+ goto grab_port;
+ }
+
+ if (!MM_IS_BROADBAND_MODEM_MBIM (modem) &&
+ port_type == MM_PORT_TYPE_NET &&
+ g_strcmp0 (driver, "cdc_mbim") == 0) {
+ /* MBIM net ports are ignored in non-MBIM modems */
+ mm_dbg ("(%s/%s): ignoring MBIM net port in non-MBIM modem", subsys, name);
+ force_ignored = TRUE;
+ goto grab_port;
+ }
+#else
+ if (port_type == MM_PORT_TYPE_NET &&
+ g_strcmp0 (driver, "cdc_mbim") == 0) {
+ mm_dbg ("(%s/%s): ignoring MBIM net port as MBIM support isn't available", subsys, name);
+ force_ignored = TRUE;
+ goto grab_port;
}
#endif
-#if !defined WITH_MBIM
- else if (mm_port_probe_get_port_type (probe) == MM_PORT_TYPE_NET &&
- !g_strcmp0 (mm_kernel_device_get_driver (mm_port_probe_peek_port (probe)), "cdc_mbim")) {
- /* Try to generically grab the port, but flagged as ignored */
+
+ grab_port:
+ if (force_ignored)
grabbed = mm_base_modem_grab_port (modem,
mm_port_probe_peek_port (probe),
MM_PORT_TYPE_IGNORED,
MM_PORT_SERIAL_AT_FLAG_NONE,
&inner_error);
- }
-#endif
else if (MM_PLUGIN_GET_CLASS (self)->grab_port)
grabbed = MM_PLUGIN_GET_CLASS (self)->grab_port (MM_PLUGIN (self),
modem,
@@ -981,10 +1038,11 @@ mm_plugin_create_modem (MMPlugin *self,
mm_port_probe_get_port_type (probe),
MM_PORT_SERIAL_AT_FLAG_NONE,
&inner_error);
+
+ next:
if (!grabbed) {
mm_warn ("Could not grab port (%s/%s): '%s'",
- mm_port_probe_get_port_subsys (MM_PORT_PROBE (l->data)),
- mm_port_probe_get_port_name (MM_PORT_PROBE (l->data)),
+ subsys, name,
inner_error ? inner_error->message : "unknown error");
g_clear_error (&inner_error);
}
--
2.21.0

View File

@ -6,9 +6,10 @@
Summary: Mobile broadband modem management service
Name: ModemManager
Version: 1.10.0
Version: 1.10.2
Release: 1%{?dist}
Source: https://www.freedesktop.org/software/ModemManager/%{name}-%{version}.tar.xz
Patch0: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/commit/fd1a26fc36df.patch#/0001-plugin-ignore-unwanted-net-ports.patch
License: GPLv2+
URL: http://www.freedesktop.org/wiki/Software/ModemManager/
@ -31,7 +32,7 @@ BuildRequires: glib2-devel >= 2.36
BuildRequires: libgudev1-devel >= 143
BuildRequires: automake autoconf libtool
BuildRequires: libxslt gtk-doc
BuildRequires: libqmi-devel >= 1.22.0
BuildRequires: libqmi-devel >= 1.22.4
BuildRequires: libmbim-devel >= 1.18.0
BuildRequires: gobject-introspection-devel >= 1.38
BuildRequires: vala
@ -85,6 +86,7 @@ Vala bindings for ModemManager
%prep
%setup -q
%patch0 -p1
%build
# Regenerate configure, because the one that is shipped
@ -156,6 +158,7 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%{_unitdir}/ModemManager.service
%{_datadir}/icons/hicolor/22x22/apps/*.png
%{_datadir}/bash-completion
%{_datadir}/ModemManager
%{_mandir}/man1/*
%{_mandir}/man8/*
@ -183,6 +186,10 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%{_datadir}/vala/vapi/libmm-glib.*
%changelog
* Fri Jun 14 2019 Lubomir Rintel <lkundrak@v3.sk> - 1.10.2-1
- Update to 1.10.2 release
- Don't grab cdc_ether devices on Sierra QMI modems
* Wed Mar 27 2019 Richard Hughes <richard@hughsie.com> 1.10.0-1
- Update to the release tarball.

View File

@ -1 +1 @@
SHA512 (ModemManager-1.10.0.tar.xz) = 676b11892b284c2da587895e71903f80ec96978c66eafae5e2d90e5c0f1dae18e50efc68b704c7907f01f208d585f5a8140316cf83e093df3f782c80949c33bc
SHA512 (ModemManager-1.10.2.tar.xz) = 766e2b84eeb3a2f3fa75eca43d1addf1ed4ad9dc8c3a8009927f93f7ec1ead86a80d566eaaf425219a23824e10d1ec19161a0493c3c7f057c0e695eb1533f42e