From f014f3843e51a66d3ab3d80d9b63d7c73fb55e10 Mon Sep 17 00:00:00 2001 From: Dan Williams <dan@ioncontrol.co> Date: Mon, 3 Mar 2025 20:25:01 -0600 Subject: [PATCH] broadband-modem,cli: slightly bump 3GPP scan timeout; add some cli dbus timeout slack Add some mmcli D-Bus timeout slack, making them slightly higher than the ModemManager internal timeout, to ensure the cli doesn't time out the D-Bus call when MM succeeds. For 3GPP scan, some modems appear to have internal 5 minute timeouts, so ensure MM doesn't time out right before the modem returns results: ModemManager[282578]: <dbg> [1741054422.321400] [ttyUSB2/at] --> 'AT+COPS=?<CR>' ModemManager[282578]: <wrn> [1741054722.247806] [modem1] failed scanning networks: Serial command timed out ModemManager[282578]: <dbg> [1741054724.119770] [ttyUSB2/at] <-- '<CR><LF>+COPS: (1,"T-Mobile","T-Mobile","310260",0),,(0,1,2,3,4),(0,1,2)<CR><LF><CR><LF>OK<CR><LF>' Signed-off-by: Dan Williams <dan@ioncontrol.co> --- cli/mmcli-modem-3gpp.c | 10 ++++++---- cli/mmcli-modem-simple.c | 6 +++--- src/mm-broadband-modem.c | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/cli/mmcli-modem-3gpp.c b/cli/mmcli-modem-3gpp.c index dc3445672..010f4c8bc 100644 --- a/cli/mmcli-modem-3gpp.c +++ b/cli/mmcli-modem-3gpp.c @@ -551,8 +551,9 @@ get_modem_ready (GObject *source, if (scan_flag) { g_debug ("Asynchronously scanning for networks..."); - /* Setup operation timeout: 5 minutes (to match MM internal timeout) */ - g_dbus_proxy_set_default_timeout (G_DBUS_PROXY (ctx->modem_3gpp), 5 * 60 * 1000); + /* Setup operation timeout: 5 minutes 17 seconds (to match MM internal + * timeout with a bit of slack) */ + g_dbus_proxy_set_default_timeout (G_DBUS_PROXY (ctx->modem_3gpp), ((5 * 60) + 17) * 1000); mm_modem_3gpp_scan (ctx->modem_3gpp, ctx->cancellable, (GAsyncReadyCallback)scan_ready, @@ -564,8 +565,9 @@ get_modem_ready (GObject *source, if (register_in_operator_str || register_home_flag) { g_debug ("Asynchronously registering the modem..."); - /* Setup operation timeout: 2 minutes (to match MM internal timeout) */ - g_dbus_proxy_set_default_timeout (G_DBUS_PROXY (ctx->modem_3gpp), 2 * 60 * 1000); + /* Setup operation timeout: 2 minutes 2 seconds (to match MM internal + * timeout with a bit of slack) */ + g_dbus_proxy_set_default_timeout (G_DBUS_PROXY (ctx->modem_3gpp), ((2 * 60) + 2) * 1000); mm_modem_3gpp_register (ctx->modem_3gpp, (register_in_operator_str ? register_in_operator_str : ""), ctx->cancellable, diff --git a/cli/mmcli-modem-simple.c b/cli/mmcli-modem-simple.c index b09cd0fae..4efa77cd9 100644 --- a/cli/mmcli-modem-simple.c +++ b/cli/mmcli-modem-simple.c @@ -210,9 +210,9 @@ get_modem_ready (GObject *source, g_debug ("Asynchronously connecting the modem..."); - /* Setup operation timeout: 2 minutes (to match MM internal timeout) */ - g_dbus_proxy_set_default_timeout (G_DBUS_PROXY (ctx->modem_simple), 2 * 60 * 1000); - + /* Setup operation timeout: 2 minutes 2 seconds (to match MM internal + * timeout with a bit of slack) */ + g_dbus_proxy_set_default_timeout (G_DBUS_PROXY (ctx->modem_simple), ((2 * 60) + 2) * 1000); properties = mm_simple_connect_properties_new_from_string (connect_str, &error); if (!properties) { g_printerr ("Error parsing connect string: '%s'\n", error->message); diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c index cd031e4c9..ee2165250 100644 --- a/src/mm-broadband-modem.c +++ b/src/mm-broadband-modem.c @@ -5317,7 +5317,7 @@ modem_3gpp_scan_networks (MMIfaceModem3gpp *self, { mm_base_modem_at_command (MM_BASE_MODEM (self), "+COPS=?", - 300, + 315, FALSE, callback, user_data); -- GitLab