modemmanager: Use own repo instead of patch files

All our patches are available in this repo.
It make it easier to maintain than to add patches over and over
in yocto environnement.

BugzID: 59859
This commit is contained in:
Alexandre Bard 2019-10-15 09:01:47 +02:00
parent 23ce58fd32
commit 440c447a2d
7 changed files with 4 additions and 385 deletions

View File

@ -1,115 +0,0 @@
From 8b89e222b0d42b7f1dc1d4f0438426fdbac9eee3 Mon Sep 17 00:00:00 2001
From: Alexandre Bard <alexandre.bard@netmodule.com>
Date: Thu, 5 Sep 2019 16:14:15 +0200
Subject: [PATCH 1/6] ublox: Add support for configuration of initial EPS
bearer
BugzID: 59579
---
plugins/ublox/mm-broadband-modem-ublox.c | 68 ++++++++++++++++++++++++
1 file changed, 68 insertions(+)
diff --git a/plugins/ublox/mm-broadband-modem-ublox.c b/plugins/ublox/mm-broadband-modem-ublox.c
index 83352fa8..475f2d5c 100644
--- a/plugins/ublox/mm-broadband-modem-ublox.c
+++ b/plugins/ublox/mm-broadband-modem-ublox.c
@@ -34,14 +34,17 @@
#include "mm-modem-helpers-ublox.h"
#include "mm-ublox-enums-types.h"
#include "mm-call-ublox.h"
+#include "mm-bearer-properties.h"
static void iface_modem_init (MMIfaceModem *iface);
+static void iface_modem_3gpp_init (MMIfaceModem3gpp *iface);
static void iface_modem_voice_init (MMIfaceModemVoice *iface);
static MMIfaceModemVoice *iface_modem_voice_parent;
G_DEFINE_TYPE_EXTENDED (MMBroadbandModemUblox, mm_broadband_modem_ublox, MM_TYPE_BROADBAND_MODEM, 0,
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM, iface_modem_init)
+ G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_3GPP, iface_modem_3gpp_init)
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_VOICE, iface_modem_voice_init))
typedef enum {
@@ -674,6 +677,64 @@ common_modem_power_operation (MMBroadbandModemUblox *self,
task);
}
+static gboolean
+modem_3gpp_set_initial_eps_bearer_settings_finish (MMIfaceModem3gpp *self,
+ GAsyncResult *res,
+ GError **error)
+{
+ return g_task_propagate_boolean (G_TASK (res), error);
+}
+
+static void
+modem_3gpp_set_initial_eps_bearer_settings_ready (MMBaseModem *_self,
+ GAsyncResult *res,
+ GTask *task)
+{
+ //MMBroadbandModemUblox *self = MM_BROADBAND_MODEM_UBLOX (_self);
+ GError *error = NULL;
+
+ if (!mm_base_modem_at_command_full_finish (_self, res, &error))
+ g_task_return_error (task, error);
+ else
+ g_task_return_boolean(task, TRUE);
+
+ g_object_unref (task);
+}
+
+static void
+modem_3gpp_set_initial_eps_bearer_settings (MMIfaceModem3gpp *self,
+ MMBearerProperties *config,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ GTask *task;
+ gchar *command;
+ const gchar *ucgdflt_cmd = "+UCGDFLT=0,\"%s\",\"%s\",0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,%s,%s,%s,\"\"";
+ const gchar *apn = mm_bearer_properties_get_apn (config);
+ MMBearerIpFamily ipfamily = mm_bearer_properties_get_ip_type(config);
+ const gchar *ip_family_str = ipfamily ? mm_bearer_ip_family_build_string_from_mask (ipfamily) : "IP";
+ const gchar *user = mm_bearer_properties_get_user (config);
+ const gchar *password = mm_bearer_properties_get_password (config);
+ const gchar *auth = user ? "1" : "0";
+
+ user = user ? user : "";
+ password = password ? password : "";
+ user = apn ? apn : "";
+
+ task = g_task_new (self, NULL, callback, user_data);
+ g_task_set_task_data (task, g_object_ref (config), g_object_unref);
+
+ command = g_strdup_printf (ucgdflt_cmd, ip_family_str, apn, auth, user, password);
+ mm_base_modem_at_command (
+ MM_BASE_MODEM (self),
+ command,
+ 120,
+ FALSE,
+ (GAsyncReadyCallback) modem_3gpp_set_initial_eps_bearer_settings_ready,
+ task);
+ g_free (command);
+}
+
static void
modem_reset (MMIfaceModem *self,
GAsyncReadyCallback callback,
@@ -1256,6 +1317,13 @@ iface_modem_init (MMIfaceModem *iface)
iface->set_current_bands_finish = common_set_current_modes_bands_finish;
}
+static void
+iface_modem_3gpp_init (MMIfaceModem3gpp *iface)
+{
+ iface->set_initial_eps_bearer_settings = modem_3gpp_set_initial_eps_bearer_settings;
+ iface->set_initial_eps_bearer_settings_finish = modem_3gpp_set_initial_eps_bearer_settings_finish;
+}
+
static void
iface_modem_voice_init (MMIfaceModemVoice *iface)
{
--
2.20.1

View File

@ -1,43 +0,0 @@
From f07c4210ef592bf3564d8b79791a73197e4b35f0 Mon Sep 17 00:00:00 2001
From: Alexandre Bard <alexandre.bard@netmodule.com>
Date: Mon, 14 Oct 2019 17:33:38 +0200
Subject: [PATCH 2/6] ublox: ignore uauth failure on default PDP context
Default PDP context has to be configured using UCGDFLT and therefor
trying to use UAUTHREQ on this context lead to an unknown error,
which is used to identify this case (since no other option seems available).
In case there is really another problem leading to this error or
the default context has not been configured properly, an error will
be thrown later, when trying to connect.
BugzID: 59579
---
plugins/ublox/mm-broadband-bearer-ublox.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/plugins/ublox/mm-broadband-bearer-ublox.c b/plugins/ublox/mm-broadband-bearer-ublox.c
index 10d29818..808c23d8 100644
--- a/plugins/ublox/mm-broadband-bearer-ublox.c
+++ b/plugins/ublox/mm-broadband-bearer-ublox.c
@@ -463,8 +463,16 @@ uauthreq_ready (MMBaseModem *modem,
CommonConnectContext *ctx;
ctx = (CommonConnectContext *) g_task_get_task_data (task);
+
+ // ignore unkown error thrown when trying to authenticate on default ctx
+ if (error && g_error_matches (error,
+ MM_MOBILE_EQUIPMENT_ERROR,
+ MM_MOBILE_EQUIPMENT_ERROR_UNKNOWN)) {
+ mm_dbg ("u-blox: uauthreq failed with unkown error: \n"
+ " likely to be because of trying to authenticate on default context: ignore");
+ }
/* If authentication required and the +UAUTHREQ failed, abort */
- if (ctx->auth_required) {
+ else if (ctx->auth_required) {
g_task_return_error (task, error);
g_object_unref (task);
return;
--
2.20.1

View File

@ -1,84 +0,0 @@
From c47e9ea2b7f2375451b74dcf660a84b96e36fe52 Mon Sep 17 00:00:00 2001
From: Alexandre Bard <alexandre.bard@netmodule.com>
Date: Wed, 16 Oct 2019 17:30:34 +0200
Subject: [PATCH 3/6] broadband-modem: Choose default context over others when
possible
With ublox modems, the default context can be active and already
having an address. In this case trying to activate another context
will likely fail.
To avoid this failure, the default context is identified during
contexts lookup by checking if an IP address has been assigned.
BugzID: 59579
---
src/mm-broadband-bearer.c | 7 ++++---
src/mm-modem-helpers.c | 10 ++++++++++
src/mm-modem-helpers.h | 1 +
3 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/src/mm-broadband-bearer.c b/src/mm-broadband-bearer.c
index 16acb2b1..94f636b6 100644
--- a/src/mm-broadband-bearer.c
+++ b/src/mm-broadband-bearer.c
@@ -869,12 +869,13 @@ parse_pdp_list (MMBaseModem *modem,
cid = pdp->cid;
ctx->use_existing_cid = TRUE;
g_free (ip_family_str);
- /* In this case, stop searching */
- break;
+ /* In case the context has no address, try to find a better one */
+ if (pdp->has_address)
+ break;
}
/* PDP with no APN set? we may use that one if not exact match found */
- if (!pdp->apn || !pdp->apn[0]) {
+ if (cid == 0 && (!pdp->apn || !pdp->apn[0])) {
mm_dbg ("Found PDP context with CID %u and no APN",
pdp->cid);
cid = pdp->cid;
diff --git a/src/mm-modem-helpers.c b/src/mm-modem-helpers.c
index cf008d73..a3b5727a 100644
--- a/src/mm-modem-helpers.c
+++ b/src/mm-modem-helpers.c
@@ -1535,6 +1535,7 @@ mm_3gpp_parse_cgdcont_read_response (const gchar *reply,
mm_dbg ("Ignoring PDP context type: '%s'", str);
else {
MM3gppPdpContext *pdp;
+ gchar * ip_str;
pdp = g_slice_new0 (MM3gppPdpContext);
if (!mm_get_uint_from_match_info (match_info, 1, &pdp->cid)) {
@@ -1547,6 +1548,15 @@ mm_3gpp_parse_cgdcont_read_response (const gchar *reply,
pdp->pdp_type = ip_family;
pdp->apn = mm_get_string_unquoted_from_match_info (match_info, 3);
+ ip_str = mm_get_string_unquoted_from_match_info (match_info, 4);
+ if (ip_str) {
+ pdp->has_address = strlen(ip_str) > 0;
+ g_free(ip_str);
+ }
+ else {
+ pdp->has_address = FALSE;
+ }
+
list = g_list_prepend (list, pdp);
}
diff --git a/src/mm-modem-helpers.h b/src/mm-modem-helpers.h
index 237046ad..a0c7a3a2 100644
--- a/src/mm-modem-helpers.h
+++ b/src/mm-modem-helpers.h
@@ -173,6 +173,7 @@ typedef struct {
guint cid;
MMBearerIpFamily pdp_type;
gchar *apn;
+ gboolean has_address;
} MM3gppPdpContext;
void mm_3gpp_pdp_context_list_free (GList *pdp_list);
GList *mm_3gpp_parse_cgdcont_read_response (const gchar *reply,
--
2.20.1

View File

@ -1,77 +0,0 @@
From 20a538ef7706a59408f2ea0539e42a9e21328808 Mon Sep 17 00:00:00 2001
From: Alexandre Bard <alexandre.bard@netmodule.com>
Date: Wed, 9 Oct 2019 14:47:11 +0200
Subject: [PATCH 4/6] broadband-modem: Handle reconnect requests
BugzID: 59455
---
src/mm-broadband-modem.c | 43 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c
index c1535596..a48f2e7c 100644
--- a/src/mm-broadband-modem.c
+++ b/src/mm-broadband-modem.c
@@ -2709,6 +2709,47 @@ bearer_list_report_disconnections (MMBroadbandModem *self,
g_object_unref (list);
}
+static void
+bearer_connect (MMBaseBearer *bearer,
+ gpointer user_data)
+{
+ guint cid;
+
+ cid = GPOINTER_TO_UINT (user_data);
+
+ /* If we're told to connect a single context and this is not the
+ * bearer associated to that context, ignore operation */
+ if (cid > 0 &&
+ MM_IS_BROADBAND_BEARER (bearer) &&
+ mm_broadband_bearer_get_3gpp_cid (MM_BROADBAND_BEARER (bearer)) != cid)
+ return;
+
+ /* If already connected, ignore operation */
+ if (mm_base_bearer_get_status (bearer) == MM_BEARER_STATUS_CONNECTED)
+ return;
+
+ /* Try to connct */
+ mm_base_bearer_connect (bearer, NULL, NULL);
+}
+
+static void
+bearer_list_connect (MMBroadbandModem *self,
+ guint cid)
+{
+ MMBearerList *list = NULL;
+
+ g_object_get (self,
+ MM_IFACE_MODEM_BEARER_LIST, &list,
+ NULL);
+
+ /* If empty bearer list, nothing else to do */
+ if (!list)
+ return;
+
+ mm_bearer_list_foreach (list, (MMBearerListForeachFunc)bearer_connect, GUINT_TO_POINTER (cid));
+ g_object_unref (list);
+}
+
static void
cgev_process_detach (MMBroadbandModem *self,
MM3gppCgev type)
@@ -2744,9 +2785,11 @@ cgev_process_primary (MMBroadbandModem *self,
switch (type) {
case MM_3GPP_CGEV_NW_ACT_PRIMARY:
mm_info ("network request to activate context (cid %u)", cid);
+ bearer_list_connect(self, cid);
break;
case MM_3GPP_CGEV_ME_ACT_PRIMARY:
mm_info ("mobile equipment request to activate context (cid %u)", cid);
+ bearer_list_connect(self, cid);
break;
case MM_3GPP_CGEV_NW_DEACT_PRIMARY:
mm_info ("network request to deactivate context (cid %u)", cid);
--
2.20.1

View File

@ -1,29 +0,0 @@
From 41110620f1b054fac70519f2573d94e2ab47a6eb Mon Sep 17 00:00:00 2001
From: Alexandre Bard <alexandre.bard@netmodule.com>
Date: Wed, 30 Oct 2019 15:25:44 +0100
Subject: [PATCH 5/6] mm-broadband-bearer: Don't clear cid when connection
failed
The CID is required to handle reconnect requests.
BugzID: 59455
---
src/mm-broadband-bearer.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/mm-broadband-bearer.c b/src/mm-broadband-bearer.c
index 94f636b6..f142b75a 100644
--- a/src/mm-broadband-bearer.c
+++ b/src/mm-broadband-bearer.c
@@ -1001,8 +1001,6 @@ dial_3gpp_ready (MMBroadbandBearer *self,
ctx->data = MM_BROADBAND_BEARER_GET_CLASS (self)->dial_3gpp_finish (self, res, &error);
if (!ctx->data) {
- /* Clear CID when it failed to connect. */
- self->priv->cid = 0;
g_task_return_error (task, error);
g_object_unref (task);
return;
--
2.20.1

View File

@ -1,29 +0,0 @@
From c9594fee7bc245c8cfe55b2225338f417edae9ae Mon Sep 17 00:00:00 2001
From: Alexandre Bard <alexandre.bard@netmodule.com>
Date: Wed, 23 Oct 2019 15:45:10 +0200
Subject: [PATCH 6/6] at commands: Force timeout to 3 minutes
ublox says some commands can take up to 3 minutes to complete
waiting less than that seems to overload the modem by sending
multiple commands while one is still not processed.
BugzID: 59584
---
src/mm-port-serial-at.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/mm-port-serial-at.c b/src/mm-port-serial-at.c
index 67525af0..cc997ba6 100644
--- a/src/mm-port-serial-at.c
+++ b/src/mm-port-serial-at.c
@@ -407,6 +407,7 @@ mm_port_serial_at_command (MMPortSerialAt *self,
GSimpleAsyncResult *simple;
GByteArray *buf;
+ timeout_seconds = 180;
g_return_if_fail (self != NULL);
g_return_if_fail (MM_IS_PORT_SERIAL_AT (self));
g_return_if_fail (command != NULL);
--
2.20.1

View File

@ -1,10 +1,6 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI_append = " \
file://0001-ublox-Add-support-for-configuration-of-initial-EPS-b.patch \
file://0002-ublox-ignore-uauth-failure-on-default-PDP-context.patch \
file://0003-broadband-modem-Choose-default-context-over-others-w.patch \
file://0004-broadband-modem-Handle-reconnect-requests.patch \
file://0005-mm-broadband-bearer-Don-t-clear-cid-when-connection-.patch \
file://0006-at-commands-Force-timeout-to-3-minutes.patch \
"
SRC_URI = "git://gitlab.com/netmodule/third-party/ModemManager;protocol=ssh;user=git;branch=mm-1-10-netmodule;"
SRCREV = "${AUTOREV}"
S = "${WORKDIR}/git"