Merge cros/upstream to cros/main - 1.23.4-dev

Part of an uprev that contains the following commits:

" 6a8797927 build: unstable release version bump tp 1.23.4 (Aleksander Morgado)"
" 4d360e3b2 plugin: include MM_PLUGIN_ALLOWED_SINGLE_AT in port probing (Garfield Watkins)"
" 004450f9a base-modem: retry AT+CNUM a couple times if the SIM is busy (Dan Williams)"
" ded76a0ab base-modem-at: add optional wait before sending command in a sequence (Dan Williams)"
" b3708636b mtk: fix reported nw error in FM350 < 29.22.13 (Aleksander Morgado)"
" 8dffb76f1 broadband-modem-mbim: allow normalizing the nw error value (Aleksander Morgado)"
" b313a603a mtk: remove IP packet filters during connection in FM350 < 29.23.06 (Aleksander Morgado)"
" 2f306e8e7 mtk: multiplex support only available in FM350 >= 29.23.06 (Aleksander Morgado)"
" 2f5ebfade iface-modem: create bearer list after loading revision (Aleksander Morgado)"
" 1373ca7e5 mtk: expect async SLAAC only in FM350 >= 29.23.06 (Aleksander Morgado)"
" f31f42dda bearer-mbim: support async IP configuration indications reporting SLAAC result (Aleksander Morgado)"
" b0add8c03 broadband-modem-mbim: request IP configuration indications (Aleksander Morgado)"
" 1befca457 cinterion: disable periodic signal checks in MBIM modems (Aleksander Morgado)"
" 91828ecc6 quectel: disable periodic signal checks in MBIM modems (Aleksander Morgado)"
" 3c35212f7 telit: disable periodic signal checks in MBIM modems (Aleksander Morgado)"
" 29d237bcb .gitignore: ignore Visual Studio Code directory and file (Yegor Yefremov)"
" ef126455b plugins: mtk: Added MT6229 USB modem support. (RICCIARDI-Adrien)"
" b61adb162 iface-modem: also run disable on failed low power mode update (Aleksander Morgado)"
" f6795754b broadband-modem-qmi: change operator description priority (Florian Eckert)"
" 521349d5f broadband-modem-qmi: add debug messages on operator description set (Florian Eckert)"
" 778d953f5 broadband-modem-mbim: use MBIMEx to list profiles unconditionally if available (Aleksander Morgado)"
" c80e92e4a broadband-modem-mbim: don't ignore profiles with "none" context type (Aleksander Morgado)"
" 2ac4bda84 libmm-glib,3gpp-profile: fix loading roaming allowance in DBus dictionary (Aleksander Morgado)"
" 06eafc8c1 libmm-glib,3gpp-profile: fix loading profile source in DBus dictionary (Aleksander Morgado)"
" 97ce69fe9 broadband-modem-mbim: fix processing IP type from MbimProvisionedContextElementV2 (Aleksander Morgado)"
" a729a92e1 build: fix fs.copyfile usage for meson versions 0.64/0.64.1 (Yegor Yefremov)"

BUG=b:325923333
FIXED=b:325923333

TEST=CQ passes

Change-Id: I4a5deab14b9aac08c63b34f82c29733aa26e32a1
diff --git a/.gitignore b/.gitignore
index 4bffcbf..c5dd58f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,5 @@
 *.bz2
 *.pyc
 tags
+/.vscode
+/cscope.out
diff --git a/libmm-glib/mm-3gpp-profile.c b/libmm-glib/mm-3gpp-profile.c
index bb542d8..063f2bb 100644
--- a/libmm-glib/mm-3gpp-profile.c
+++ b/libmm-glib/mm-3gpp-profile.c
@@ -682,6 +682,12 @@
                                PROPERTY_SOURCE,
                                g_variant_new_uint32 (self->priv->profile_source));
 
+    if (self->priv->roaming_allowance != MM_BEARER_ROAMING_ALLOWANCE_NONE)
+        g_variant_builder_add (&builder,
+                               "{sv}",
+                               PROPERTY_ROAMING_ALLOWANCE,
+                               g_variant_new_uint32 (self->priv->roaming_allowance));
+
     if (self->priv->enabled_set)
         g_variant_builder_add (&builder,
                                "{sv}",
@@ -886,6 +892,10 @@
         mm_3gpp_profile_set_profile_source (
             self,
             g_variant_get_uint32 (value));
+    else if (g_str_equal (key, PROPERTY_ROAMING_ALLOWANCE))
+        mm_3gpp_profile_set_roaming_allowance (
+            self,
+            g_variant_get_uint32 (value));
     else {
         /* Set error */
         g_set_error (error,
diff --git a/meson.build b/meson.build
index 6e7f00d..9d4149a 100644
--- a/meson.build
+++ b/meson.build
@@ -3,7 +3,7 @@
 
 project(
   'ModemManager', 'c',
-  version: '1.23.3',
+  version: '1.23.4',
   license: 'GPL2',
   default_options: [
     'buildtype=debugoptimized',
diff --git a/src/mm-base-modem-at.c b/src/mm-base-modem-at.c
index ed35406..cc2bc5a 100644
--- a/src/mm-base-modem-at.c
+++ b/src/mm-base-modem-at.c
@@ -91,8 +91,13 @@
     gpointer                    response_processor_context;
     GDestroyNotify              response_processor_context_free;
     GVariant                   *result;
+    guint                       next_command_wait_id;
 } AtSequenceContext;
 
+static void at_sequence_parse_response (MMPortSerialAt    *port,
+                                        GAsyncResult      *res,
+                                        GTask             *task);
+
 static void
 at_sequence_context_free (AtSequenceContext *ctx)
 {
@@ -109,6 +114,11 @@
         g_object_unref (ctx->parent_cancellable);
     }
 
+    if (ctx->next_command_wait_id > 0) {
+        g_source_remove (ctx->next_command_wait_id);
+        ctx->next_command_wait_id = 0;
+    }
+
     if (ctx->result)
         g_variant_unref (ctx->result);
     g_free (ctx);
@@ -140,6 +150,28 @@
     return result;
 }
 
+static gboolean
+at_sequence_next_command (GTask *task)
+{
+    AtSequenceContext *ctx;
+
+    ctx = g_task_get_task_data (task);
+    ctx->next_command_wait_id = 0;
+
+    /* Schedule the next command in the probing group */
+    mm_port_serial_at_command (
+        ctx->port,
+        ctx->current->command,
+        ctx->current->timeout,
+        FALSE,
+        ctx->current->allow_cached,
+        g_task_get_cancellable (task),
+        (GAsyncReadyCallback)at_sequence_parse_response,
+        task);
+
+    return G_SOURCE_REMOVE;
+}
+
 static void
 at_sequence_parse_response (MMPortSerialAt    *port,
                             GAsyncResult      *res,
@@ -201,16 +233,8 @@
     if (processor_result == MM_BASE_MODEM_AT_RESPONSE_PROCESSOR_RESULT_CONTINUE) {
         ctx->current++;
         if (ctx->current->command) {
-            /* Schedule the next command in the probing group */
-            mm_port_serial_at_command (
-                ctx->port,
-                ctx->current->command,
-                ctx->current->timeout,
-                FALSE,
-                ctx->current->allow_cached,
-                g_task_get_cancellable (task),
-                (GAsyncReadyCallback)at_sequence_parse_response,
-                task);
+            g_assert (!ctx->next_command_wait_id);
+            ctx->next_command_wait_id = g_timeout_add_seconds (ctx->current->wait_seconds, (GSourceFunc) at_sequence_next_command, task);
             return;
         }
         /* On last command, end. */
diff --git a/src/mm-base-modem-at.h b/src/mm-base-modem-at.h
index 770c0e4..ae9b0be 100644
--- a/src/mm-base-modem-at.h
+++ b/src/mm-base-modem-at.h
@@ -67,6 +67,8 @@
     gboolean allow_cached;
     /* The response processor */
     MMBaseModemAtResponseProcessor response_processor;
+    /* Time to wait before sending this command (in seconds) */
+    guint wait_seconds;
 } MMBaseModemAtCommand;
 
 /* Generic AT sequence handling, using the best AT port available and without
@@ -220,6 +222,7 @@
     guint     timeout;
     gboolean  allow_cached;
     MMBaseModemAtResponseProcessor response_processor;
+    guint     wait_seconds;
 } MMBaseModemAtCommandAlloc;
 
 G_STATIC_ASSERT (sizeof (MMBaseModemAtCommandAlloc) == sizeof (MMBaseModemAtCommand));
diff --git a/src/mm-broadband-modem-qmi.c b/src/mm-broadband-modem-qmi.c
index c319776..f71231b 100644
--- a/src/mm-broadband-modem-qmi.c
+++ b/src/mm-broadband-modem-qmi.c
@@ -3474,10 +3474,18 @@
             mm_obj_dbg (self, "current operator short name: %s",   short_name);
             mm_obj_dbg (self, "current operator service name: %s", service_name);
             if (!self->priv->current_operator_description) {
-                self->priv->current_operator_description = (service_name ? g_steal_pointer (&service_name) :
-                                                            (long_name   ? g_steal_pointer (&long_name)    :
-                                                             (short_name ? g_steal_pointer (&short_name)   :
-                                                              NULL)));
+                if (long_name) {
+                    mm_obj_dbg (self, "setting operator description to long_name: %s", long_name);
+                    self->priv->current_operator_description = g_steal_pointer (&long_name);
+                } else if (short_name) {
+                    mm_obj_dbg (self, "setting operator description to short name: %s", short_name);
+                    self->priv->current_operator_description = g_steal_pointer (&short_name);
+                } else if (service_name) {
+                    mm_obj_dbg (self, "setting operator description to service name: %s", service_name);
+                    self->priv->current_operator_description = g_steal_pointer (&service_name);
+                } else {
+                    mm_obj_dbg (self, "unable to set operator description");
+                }
             }
     }
 
diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c
index e5ec366..e175d88 100644
--- a/src/mm-broadband-modem.c
+++ b/src/mm-broadband-modem.c
@@ -1363,19 +1363,53 @@
     qcdm_result_unref (result);
 }
 
+static MMBaseModemAtResponseProcessorResult
+modem_load_own_numbers_continue_on_sim_busy (MMBaseModem   *self,
+                                             gpointer       none,
+                                             const gchar   *command,
+                                             const gchar   *response,
+                                             gboolean       last_command,
+                                             const GError  *error,
+                                             GVariant     **result,
+                                             GError       **result_error)
+{
+    if (error) {
+        *result = NULL;
+
+        if (!g_error_matches (error, MM_MOBILE_EQUIPMENT_ERROR, MM_MOBILE_EQUIPMENT_ERROR_SIM_BUSY) || last_command) {
+            *result_error = g_error_copy (error);
+            return MM_BASE_MODEM_AT_RESPONSE_PROCESSOR_RESULT_FAILURE;
+        }
+
+        /* Retry on SIM BUSY errors */
+        *result_error = NULL;
+        return MM_BASE_MODEM_AT_RESPONSE_PROCESSOR_RESULT_CONTINUE;
+    }
+
+    *result = g_variant_new_string (response);
+    return MM_BASE_MODEM_AT_RESPONSE_PROCESSOR_RESULT_SUCCESS;
+}
+
+static const MMBaseModemAtCommand own_numbers_sequence[] = {
+    { "+CNUM", 3, FALSE, modem_load_own_numbers_continue_on_sim_busy, 0 },
+    { "+CNUM", 3, FALSE, modem_load_own_numbers_continue_on_sim_busy, 3 },
+    { "+CNUM", 3, FALSE, modem_load_own_numbers_continue_on_sim_busy, 3 },
+    { NULL }
+};
+
 static void
-modem_load_own_numbers_done (MMIfaceModem *self,
+modem_load_own_numbers_ready (MMIfaceModem *self,
                              GAsyncResult *res,
                              GTask *task)
 {
     OwnNumbersContext *ctx;
-    const gchar *result;
+    GVariant *result;
     GError *error = NULL;
     GStrv numbers;
 
     ctx = g_task_get_task_data (task);
 
-    result = mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, &error);
+    result = mm_base_modem_at_sequence_finish (MM_BASE_MODEM (self), res, NULL, &error);
     if (!result) {
         /* try QCDM */
         if (ctx->qcdm) {
@@ -1398,7 +1432,7 @@
         }
         g_task_return_error (task, error);
     } else {
-        numbers = mm_3gpp_parse_cnum_exec_response (result);
+        numbers = mm_3gpp_parse_cnum_exec_response (g_variant_get_string (result, NULL));
         g_task_return_pointer (task, numbers, (GDestroyNotify)g_strfreev);
     }
     g_object_unref (task);
@@ -1430,12 +1464,13 @@
     g_task_set_task_data (task, ctx, (GDestroyNotify)own_numbers_context_free);
 
     mm_obj_dbg (self, "loading own numbers...");
-    mm_base_modem_at_command (MM_BASE_MODEM (self),
-                              "+CNUM",
-                              3,
-                              FALSE,
-                              (GAsyncReadyCallback)modem_load_own_numbers_done,
-                              task);
+    mm_base_modem_at_sequence (
+        MM_BASE_MODEM (self),
+        own_numbers_sequence,
+        NULL, /* response_processor_context */
+        NULL, /* response_processor_context_free */
+        (GAsyncReadyCallback)modem_load_own_numbers_ready,
+        task);
 }
 
 /*****************************************************************************/
diff --git a/src/mm-plugin.c b/src/mm-plugin.c
index 19cb5d7..1e721e5 100644
--- a/src/mm-plugin.c
+++ b/src/mm-plugin.c
@@ -816,7 +816,7 @@
 
     /* Build mask of flags based on plugin */
     plugin_expected_flags = MM_PORT_PROBE_NONE;
-    if (self->priv->at)
+    if (self->priv->at || self->priv->single_at)
         plugin_expected_flags |= MM_PORT_PROBE_AT;
     if (self->priv->qcdm || self->priv->qcdm_required)
         plugin_expected_flags |= MM_PORT_PROBE_QCDM;
diff --git a/src/plugins/cinterion/mm-broadband-modem-mbim-cinterion.c b/src/plugins/cinterion/mm-broadband-modem-mbim-cinterion.c
index 19d34f2..64b4b58 100644
--- a/src/plugins/cinterion/mm-broadband-modem-mbim-cinterion.c
+++ b/src/plugins/cinterion/mm-broadband-modem-mbim-cinterion.c
@@ -69,6 +69,7 @@
                          MM_BASE_MODEM_DATA_NET_SUPPORTED, TRUE,
                          MM_BASE_MODEM_DATA_TTY_SUPPORTED, FALSE,
                          MM_IFACE_MODEM_SIM_HOT_SWAP_SUPPORTED, TRUE,
+                         MM_IFACE_MODEM_PERIODIC_SIGNAL_CHECK_DISABLED, TRUE,
                          MM_BROADBAND_MODEM_MBIM_INTEL_FIRMWARE_UPDATE_UNSUPPORTED, TRUE,
                          NULL);
 }
diff --git a/src/plugins/mtk/77-mm-mtk-legacy-port-types.rules b/src/plugins/mtk/77-mm-mtk-legacy-port-types.rules
index e0bb706..2c91864 100644
--- a/src/plugins/mtk/77-mm-mtk-legacy-port-types.rules
+++ b/src/plugins/mtk/77-mm-mtk-legacy-port-types.rules
@@ -31,6 +31,10 @@
 ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="00a7", ENV{.MM_USBIFNUM}=="03", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_AT_SECONDARY}="1"
 ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="00a7", ENV{ID_MM_MTK_TAGGED}="1"
 
+ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="0023", ENV{.MM_USBIFNUM}=="02", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_AT_PRIMARY}="1"
+ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="0023", ENV{.MM_USBIFNUM}=="03", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_AT_SECONDARY}="1"
+ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="0023", ENV{ID_MM_MTK_TAGGED}="1"
+
 GOTO="mm_mtk_legacy_port_types_end"
 
 # D-Link devices ---------------------------
diff --git a/src/plugins/telit/mm-broadband-modem-mbim-telit.c b/src/plugins/telit/mm-broadband-modem-mbim-telit.c
index 907c284..ae54e99 100644
--- a/src/plugins/telit/mm-broadband-modem-mbim-telit.c
+++ b/src/plugins/telit/mm-broadband-modem-mbim-telit.c
@@ -221,6 +221,7 @@
                          MM_BASE_MODEM_DATA_NET_SUPPORTED, TRUE,
                          MM_BASE_MODEM_DATA_TTY_SUPPORTED, FALSE,
                          MM_IFACE_MODEM_SIM_HOT_SWAP_SUPPORTED, TRUE,
+                         MM_IFACE_MODEM_PERIODIC_SIGNAL_CHECK_DISABLED, TRUE,
                          NULL);
 }