From 1ec2b86239c3686e22034baae0068bd5d52779ae Mon Sep 17 00:00:00 2001 From: "Jan Alexander Steffens (heftig)" Date: Fri, 11 Apr 2025 03:20:09 +0200 Subject: [PATCH 1/8] docs: Fix gtk-doc build Fix a duplicate `id` and the inclusions of gdbus docs. Signed-off-by: Jan Alexander Steffens (heftig) (cherry picked from commit 078a92cd5cb0a58da32e8c6c879917ee51ce95ac) --- .../api/ModemManager-dbus-reference.xml | 46 +++++++++---------- docs/reference/api/meson.build | 5 ++ 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/docs/reference/api/ModemManager-dbus-reference.xml b/docs/reference/api/ModemManager-dbus-reference.xml index d6237242..815b0628 100644 --- a/docs/reference/api/ModemManager-dbus-reference.xml +++ b/docs/reference/api/ModemManager-dbus-reference.xml @@ -92,7 +92,7 @@ This object also controls any process-wide operation, such as the log level being used by the daemon. - + @@ -129,22 +129,22 @@ or the CDMA interface. - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + @@ -155,7 +155,7 @@ may expose one or more Bearer objects, which can then be used to get the modem into connected state. - + @@ -166,7 +166,7 @@ expose up to one SIM object, which allows SIM-specific actions such as PIN unlocking. - + @@ -176,7 +176,7 @@ Messaging interface will export one SMS object for each SMS stored in the device. - + @@ -186,17 +186,17 @@ Voice interface will export one Call object for each Call managed in the device. - + - + The <literal>/org/freedesktop/ModemManager/CBM</literal> objects Modems implementing the Cell Broadcast interface will export one CBM object for each Cell Broadcast message received by the device. - + diff --git a/docs/reference/api/meson.build b/docs/reference/api/meson.build index d7c420c7..2c02648a 100644 --- a/docs/reference/api/meson.build +++ b/docs/reference/api/meson.build @@ -22,6 +22,9 @@ expand_content_files = [ 'ModemManager-overview.xml', # FIXME: workaround because only strings can be included and not custom targets (gen_docs) generated_build_dir / 'mm-gdbus-doc-org.freedesktop.ModemManager1.Bearer.xml', + generated_build_dir / 'mm-gdbus-doc-org.freedesktop.ModemManager1.Call.xml', + generated_build_dir / 'mm-gdbus-doc-org.freedesktop.ModemManager1.Cbm.xml', + generated_build_dir / 'mm-gdbus-doc-org.freedesktop.ModemManager1.Modem.CellBroadcast.xml', generated_build_dir / 'mm-gdbus-doc-org.freedesktop.ModemManager1.Modem.Firmware.xml', generated_build_dir / 'mm-gdbus-doc-org.freedesktop.ModemManager1.Modem.Location.xml', generated_build_dir / 'mm-gdbus-doc-org.freedesktop.ModemManager1.Modem.Messaging.xml', @@ -30,9 +33,11 @@ expand_content_files = [ generated_build_dir / 'mm-gdbus-doc-org.freedesktop.ModemManager1.Modem.Modem3gpp.xml', generated_build_dir / 'mm-gdbus-doc-org.freedesktop.ModemManager1.Modem.ModemCdma.xml', generated_build_dir / 'mm-gdbus-doc-org.freedesktop.ModemManager1.Modem.Oma.xml', + generated_build_dir / 'mm-gdbus-doc-org.freedesktop.ModemManager1.Modem.Sar.xml', generated_build_dir / 'mm-gdbus-doc-org.freedesktop.ModemManager1.Modem.Signal.xml', generated_build_dir / 'mm-gdbus-doc-org.freedesktop.ModemManager1.Modem.Simple.xml', generated_build_dir / 'mm-gdbus-doc-org.freedesktop.ModemManager1.Modem.Time.xml', + generated_build_dir / 'mm-gdbus-doc-org.freedesktop.ModemManager1.Modem.Voice.xml', generated_build_dir / 'mm-gdbus-doc-org.freedesktop.ModemManager1.Modem.xml', generated_build_dir / 'mm-gdbus-doc-org.freedesktop.ModemManager1.Sim.xml', generated_build_dir / 'mm-gdbus-doc-org.freedesktop.ModemManager1.Sms.xml', From 0c7d57396921a385228b2597f0eca77b3bc72c48 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Sat, 12 Apr 2025 23:17:45 -0500 Subject: [PATCH 2/8] modem-helpers: fix checking of CDMA/EVDO access technology Missing ! for strncmp() meant the test was backwards and would erroneously report 1xRTT and EVDOr0 when those access technologies were not in use. Signed-off-by: Dan Williams (cherry picked from commit 9e205f47847ab9ef5887b79c077ef8468d769af0) --- src/mm-modem-helpers.c | 6 +++--- src/tests/test-modem-helpers.c | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/mm-modem-helpers.c b/src/mm-modem-helpers.c index 4f0c6248..fd958401 100644 --- a/src/mm-modem-helpers.c +++ b/src/mm-modem-helpers.c @@ -4160,11 +4160,11 @@ mm_string_to_access_tech (const gchar *string) * are included in other strings too. */ len = strlen (string); - if (strncmp (string, "EVDO", 4) && (len >= 4 && !isalnum (string[4]))) + if (!strncmp (string, "EVDO", 4) && (len >= 4 && !isalnum (string[4]))) act |= MM_MODEM_ACCESS_TECHNOLOGY_EVDO0; - if (strncmp (string, "CDMA", 4) && (len >= 4 && !isalnum (string[4]))) + if (!strncmp (string, "CDMA", 4) && (len >= 4 && !isalnum (string[4]))) act |= MM_MODEM_ACCESS_TECHNOLOGY_1XRTT; - if (strncmp (string, "CDMA-EVDO", 9) && (len >= 9 && !isalnum (string[9]))) + if (!strncmp (string, "CDMA-EVDO", 9) && (len >= 9 && !isalnum (string[9]))) act |= MM_MODEM_ACCESS_TECHNOLOGY_1XRTT | MM_MODEM_ACCESS_TECHNOLOGY_EVDO0; return act; diff --git a/src/tests/test-modem-helpers.c b/src/tests/test-modem-helpers.c index 6692e56d..6836bbdd 100644 --- a/src/tests/test-modem-helpers.c +++ b/src/tests/test-modem-helpers.c @@ -4866,6 +4866,29 @@ test_mnc_length (void) /*****************************************************************************/ +typedef struct { + const gchar *str; + const MMModemAccessTechnology act; +} TestActData; + +static const TestActData test_act_data[] = { + { "EDGE", MM_MODEM_ACCESS_TECHNOLOGY_EDGE }, + /* Ensure WCDMA does not get counted as 3GPP2 CDMA */ + { "WCDMA", MM_MODEM_ACCESS_TECHNOLOGY_UMTS }, + { "CDMA-EVDO", MM_MODEM_ACCESS_TECHNOLOGY_1XRTT | MM_MODEM_ACCESS_TECHNOLOGY_EVDO0 }, +}; + +static void +test_string_to_access_tech (void) +{ + guint i; + + for (i = 0; i < G_N_ELEMENTS (test_act_data); i++) + g_assert_cmpint (mm_string_to_access_tech (test_act_data[i].str), ==, test_act_data[i].act); +} + +/*****************************************************************************/ + #define TESTCASE(t, d) g_test_create_case (#t, 0, d, NULL, (GTestFixtureFunc) t, NULL) int main (int argc, char **argv) @@ -5111,6 +5134,8 @@ int main (int argc, char **argv) g_test_suite_add (suite, TESTCASE (test_spn_to_utf8, NULL)); g_test_suite_add (suite, TESTCASE (test_mnc_length, NULL)); + g_test_suite_add (suite, TESTCASE (test_string_to_access_tech, NULL)); + result = g_test_run (); reg_test_data_free (reg_data); From 018e44084825ab294ad2b5d5b301d2b9e2577eb1 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Sat, 12 Apr 2025 23:56:13 -0500 Subject: [PATCH 3/8] shared-fibocom: don't assume parent implements the firmware interface MMBroadbandModemMbimMtkFibocom doesn't, so don't assert it. Fixes: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/975 Signed-off-by: Dan Williams (cherry picked from commit 046b79a6766b6384db9cd56a9af5d148787bafe4) --- src/plugins/fibocom/mm-shared-fibocom.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/fibocom/mm-shared-fibocom.c b/src/plugins/fibocom/mm-shared-fibocom.c index 89be09ef..0fbc9b59 100644 --- a/src/plugins/fibocom/mm-shared-fibocom.c +++ b/src/plugins/fibocom/mm-shared-fibocom.c @@ -75,8 +75,8 @@ get_private (MMSharedFibocom *self) priv->class_parent = MM_SHARED_FIBOCOM_GET_IFACE (self)->peek_parent_class (self); /* Setup firmware interface of parent class */ - g_assert (MM_SHARED_FIBOCOM_GET_IFACE (self)->peek_parent_firmware_interface); - priv->iface_modem_firmware_parent = MM_SHARED_FIBOCOM_GET_IFACE (self)->peek_parent_firmware_interface (self); + if (MM_SHARED_FIBOCOM_GET_IFACE (self)->peek_parent_firmware_interface) + priv->iface_modem_firmware_parent = MM_SHARED_FIBOCOM_GET_IFACE (self)->peek_parent_firmware_interface (self); g_object_set_qdata_full (G_OBJECT (self), private_quark, priv, (GDestroyNotify)private_free); } From 240a9145ad2524d409ce87fd989b5599549609a5 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Sun, 13 Apr 2025 19:56:56 -0500 Subject: [PATCH 4/8] modem-helpers-cinterion: allow spaces in ^SXRAT test response ^SXRAT: (0-6), (0,2,3), (0,2,3) Fixes: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/974 Signed-off-by: Dan Williams (cherry picked from commit 6b6997362b5530708725c16c80ef36cd21609f20) --- .../cinterion/mm-modem-helpers-cinterion.c | 2 +- .../tests/test-modem-helpers-cinterion.c | 33 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/plugins/cinterion/mm-modem-helpers-cinterion.c b/src/plugins/cinterion/mm-modem-helpers-cinterion.c index b2ef89a9..53f4cff4 100644 --- a/src/plugins/cinterion/mm-modem-helpers-cinterion.c +++ b/src/plugins/cinterion/mm-modem-helpers-cinterion.c @@ -794,7 +794,7 @@ mm_cinterion_parse_sxrat_test (const gchar *response, return FALSE; } - r = g_regex_new ("\\^SXRAT:\\s*\\(([^\\)]*)\\),\\(([^\\)]*)\\)(,\\(([^\\)]*)\\))?(?:\\r\\n)?", + r = g_regex_new ("\\^SXRAT:\\s*\\(([^\\)]*)\\),\\s*\\(([^\\)]*)\\)(,\\s*\\(([^\\)]*)\\))?(?:\\r\\n)?", G_REGEX_DOLLAR_ENDONLY | G_REGEX_RAW, 0, NULL); diff --git a/src/plugins/cinterion/tests/test-modem-helpers-cinterion.c b/src/plugins/cinterion/tests/test-modem-helpers-cinterion.c index e5857ede..2f6e3d10 100644 --- a/src/plugins/cinterion/tests/test-modem-helpers-cinterion.c +++ b/src/plugins/cinterion/tests/test-modem-helpers-cinterion.c @@ -1826,6 +1826,38 @@ test_sxrat_response_els61 (void) g_array_unref (expected_pref2); } +static void +test_sxrat_response_pls63_w (void) +{ + GArray *expected_rat; + GArray *expected_pref1; + GArray *expected_pref2; + const guint vals[] = { 0, 2, 3 }; + guint val; + const gchar *response = + "^SXRAT: (0-6), (0,2,3), (0,2,3)\r\n" + "\r\n"; + + expected_rat = g_array_sized_new (FALSE, FALSE, sizeof (guint), 7); + for (val = 0; val < 7; val++) + g_array_append_val (expected_rat, val); + + expected_pref1 = g_array_sized_new (FALSE, FALSE, sizeof (guint), 3); + g_array_append_vals (expected_pref1, &vals, 3); + + expected_pref2 = g_array_sized_new (FALSE, FALSE, sizeof (guint), 3); + g_array_append_vals (expected_pref2, &vals, 3); + + common_test_sxrat (response, + expected_rat, + expected_pref1, + expected_pref2); + + g_array_unref (expected_rat); + g_array_unref (expected_pref1); + g_array_unref (expected_pref2); +} + static void test_sxrat_response_other (void) { @@ -2177,6 +2209,7 @@ int main (int argc, char **argv) g_test_add_func ("/MM/cinterion/sgauth", test_sgauth_response); g_test_add_func ("/MM/cinterion/sxrat", test_sxrat); g_test_add_func ("/MM/cinterion/sxrat/response/els61", test_sxrat_response_els61); + g_test_add_func ("/MM/cinterion/sxrat/response/pls63w", test_sxrat_response_pls63_w); g_test_add_func ("/MM/cinterion/sxrat/response/other", test_sxrat_response_other); g_test_add_func ("/MM/cinterion/cops/only-mode-2g", test_cops_only_mode_2g); g_test_add_func ("/MM/cinterion/cops/only-mode-3g", test_cops_only_mode_3g); From 9f0db52ed02248ba77e3c242939ba25595dbec3c Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Sat, 12 Apr 2025 23:04:38 -0500 Subject: [PATCH 5/8] iface-modem-voice: recheck call state polling when call is started When an outgoing call is created and added to the call list its state is UNKNOWN. The call list emits the ADDED signal which MMIfaceModemVoice listens for to check whether to begin polling call state. But since UNKNOWN is not an in-progress call state polling isn't started. And nothing was rechecking whether to start polling when the call state changed to something other than UNKNOWN. Do that so that we can track call progress as it dials out and is answered. Signed-off-by: Dan Williams (cherry picked from commit 92e666e1c92c205e896552604e717d5b39528ae3) --- src/mm-iface-modem-voice.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/mm-iface-modem-voice.c b/src/mm-iface-modem-voice.c index 63a960f1..01519bc3 100644 --- a/src/mm-iface-modem-voice.c +++ b/src/mm-iface-modem-voice.c @@ -32,6 +32,10 @@ static GQuark in_call_event_context_quark; G_DEFINE_INTERFACE (MMIfaceModemVoice, mm_iface_modem_voice, MM_TYPE_IFACE_MODEM) +static void setup_call_list_polling (MMCallList *call_list, + const gchar *call_path_added, + MMIfaceModemVoice *self); + /*****************************************************************************/ void @@ -1781,6 +1785,7 @@ typedef enum { IN_CALL_SETUP_STEP_FIRST, IN_CALL_SETUP_STEP_UNSOLICITED_EVENTS, IN_CALL_SETUP_STEP_AUDIO_CHANNEL, + IN_CALL_SETUP_STEP_CHECK_POLLING, IN_CALL_SETUP_STEP_LAST, } InCallSetupStep; @@ -1908,6 +1913,10 @@ in_call_setup_context_step (GTask *task) } ctx->step++; /* fall-through */ + case IN_CALL_SETUP_STEP_CHECK_POLLING: + setup_call_list_polling (NULL, NULL, self); + ctx->step++; + /* fall-through */ case IN_CALL_SETUP_STEP_LAST: g_task_return_boolean (task, TRUE); g_object_unref (task); From dc3a7f0d3bcac4162f98bfa35612dccbb408ea8c Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Wed, 23 Apr 2025 10:10:57 -0500 Subject: [PATCH 6/8] broadband-modem: detect old Mediatek 62xx chipsets as GSM-capable They don't necessarily reply to +WS46 but like old Motorola ESX devices they reply to +CGMM with a known string. Fixes: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/980 Signed-off-by: Dan Williams (cherry picked from commit 8cf25a97a13278c7cfaa60726ed35eee45c1073e) --- src/mm-broadband-modem.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c index 407b6622..f8cdd52d 100644 --- a/src/mm-broadband-modem.c +++ b/src/mm-broadband-modem.c @@ -768,11 +768,14 @@ parse_caps_cgmm (MMBaseModem *self, if (!response) return MM_BASE_MODEM_AT_RESPONSE_PROCESSOR_RESULT_CONTINUE; - /* This check detects some really old Motorola GPRS dongles and phones */ + /* This check detects some really old Motorola and Mediatek GPRS dongles + * and phones. + */ if (strstr (response, "GSM900") || strstr (response, "GSM1800") || strstr (response, "GSM1900") || - strstr (response, "GSM850")) { + strstr (response, "GSM850") || + strstr (response, "MTK2")) { /* At least, it's a GSM modem */ *result = g_variant_new_uint32 (MM_MODEM_CAPABILITY_GSM_UMTS); return MM_BASE_MODEM_AT_RESPONSE_PROCESSOR_RESULT_SUCCESS; From 46cc38570d4a25183c173ecfffbea25cef3b96a6 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Thu, 1 May 2025 15:09:46 -0500 Subject: [PATCH 7/8] broadband-modem: reload registration info after manual registration This refreshes operator information after manual registration. QMI and MBIM implementations return operator info along with registration info so they handle this easily, while with AT-based devices we must run additional commands to retrieve that after the manual registration has finished. Suggested by: Kirill Buksha Fixes: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/971 Signed-off-by: Dan Williams (cherry picked from commit febab17f07f54f8ababed9b5e187e189ccd15841) --- src/mm-broadband-modem.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c index f8cdd52d..6eb04fe2 100644 --- a/src/mm-broadband-modem.c +++ b/src/mm-broadband-modem.c @@ -5594,6 +5594,21 @@ modem_3gpp_run_registration_checks_finish (MMIfaceModem3gpp *self, return g_task_propagate_boolean (G_TASK (res), error); } +static void +run_registration_checks_reload_current_registration_info_ready (MMIfaceModem3gpp *modem, + GAsyncResult *res, + GTask *task) +{ + GError *error = NULL; + + mm_iface_modem_3gpp_reload_current_registration_info_finish (modem, res, &error); + if (error) + g_task_return_error (task, error); + else + g_task_return_boolean (task, TRUE); + g_object_unref (task); +} + static void run_registration_checks_context_step (GTask *task); static void @@ -5835,13 +5850,17 @@ run_registration_checks_context_step (GTask *task) error = g_steal_pointer (&ctx->error_cs); else g_assert_not_reached (); + + g_task_return_error (task, error); + g_object_unref (task); + return; } - if (error) - g_task_return_error (task, error); - else - g_task_return_boolean (task, TRUE); - g_object_unref (task); + /* When everything is done, recheck operator info as it may have changed */ + mm_iface_modem_3gpp_reload_current_registration_info ( + MM_IFACE_MODEM_3GPP (self), + (GAsyncReadyCallback)run_registration_checks_reload_current_registration_info_ready, + task); } static void From 3827a63d33d0a2e785222bff17e2ddb8d8d60578 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 1 Apr 2025 12:53:26 -0500 Subject: [PATCH 8/8] modem-helpers: report C*REG=2 AcT 9 as NB-IOT access technology Signed-off-by: Dan Williams (cherry picked from commit 2e27b02004a332edc282576269df640e8eeba7b9) --- src/mm-modem-helpers.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mm-modem-helpers.c b/src/mm-modem-helpers.c index fd958401..574ec7fc 100644 --- a/src/mm-modem-helpers.c +++ b/src/mm-modem-helpers.c @@ -1218,8 +1218,9 @@ get_mm_access_tech_from_etsi_access_tech (guint val, return MM_MODEM_ACCESS_TECHNOLOGY_HSUPA; case 6: return MM_MODEM_ACCESS_TECHNOLOGY_HSPA; - case 7: /* E-UTRAN */ case 9: /* E-UTRAN (NB-S1) */ + return MM_MODEM_ACCESS_TECHNOLOGY_LTE_NB_IOT; + case 7: /* E-UTRAN */ case 10: /* E-UTRA connected to a 5GCN */ return MM_MODEM_ACCESS_TECHNOLOGY_LTE; case 11: /* NR connected to a 5G CN */