summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksandermj@chromium.org>2023-04-19 13:02:06 +0000
committerAleksander Morgado <aleksandermj@chromium.org>2023-05-03 12:38:43 +0000
commit2895a4bb52eeb46d8752412ab22c7559ad769046 (patch)
tree587feaa4c3682404e3355b291650ea873f340600
parentf922a6be2d1e1e7c763da783e2a97de38bee39bc (diff)
downloadModemManager-2895a4bb52eeb46d8752412ab22c7559ad769046.tar.gz
broadband-modem-mbim: ignore registration set error if NwError=0 reported
Returning an error in the registration set request completely breaks the async operation requesting the explicit registration, even if the modem may have already been registered via indications while waiting for the set request to be completed. We now ignore the registration set error if it returns a generic failure with NwError=0, as in certain Qualcomm based devices. We ignore unconditionally, without explicitly checking if we're registered or not, because the upper logic will anyway do that. Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/723
-rw-r--r--src/mm-broadband-modem-mbim.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/mm-broadband-modem-mbim.c b/src/mm-broadband-modem-mbim.c
index 1ebdabe9e..1759db75d 100644
--- a/src/mm-broadband-modem-mbim.c
+++ b/src/mm-broadband-modem-mbim.c
@@ -6393,13 +6393,12 @@ register_state_set_ready (MbimDevice *device,
GAsyncResult *res,
GTask *task)
{
- MMBroadbandModemMbim *self;
- MbimMessage *response;
- GError *error = NULL;
+ MMBroadbandModemMbim *self;
+ g_autoptr(MbimMessage) response = NULL;
+ GError *error = NULL;
self = g_task_get_source_object (task);
- response = mbim_device_command_finish (device, res, &error);
/* According to Mobile Broadband Interface Model specification 1.0,
* Errata 1, table 10.5.9.8: Status codes for MBIM_CID_REGISTER_STATE,
* NwError field of MBIM_REGISTRATION_STATE_INFO structure is valid
@@ -6410,9 +6409,8 @@ register_state_set_ready (MbimDevice *device,
* However, some modems do not set this value to 0 when registered,
* causing ModemManager to drop to idle state, while modem itself is
* registered.
- * Also NwError "0" is defined in 3GPP TS 24.008 as "Unknown error",
- * not "No error", making it unsuitable as condition for registration check.
*/
+ response = mbim_device_command_finish (device, res, &error);
if (response &&
!mbim_message_response_get_result (response,
MBIM_MESSAGE_TYPE_COMMAND_DONE,
@@ -6432,13 +6430,22 @@ register_state_set_ready (MbimDevice *device,
NULL, /* provider_name */
NULL, /* roaming_text */
NULL, /* registration_flag */
- &error))
- error = mm_mobile_equipment_error_from_mbim_nw_error (nw_error, self);
+ &error)) {
+ /* NwError "0" is defined in 3GPP TS 24.008 as "Unknown error",
+ * not "No error", making it unsuitable as condition for registration check.
+ * Still, there are certain modems (e.g. Fibocom NL668) that will
+ * report Failure+NwError=0 even after the modem has already reported a
+ * succesful registration via indications after the set operation. If
+ * that is the case, log about it and ignore the error; we are anyway
+ * reloading the registration info after the set, so it should not be
+ * a big issue. */
+ if (nw_error == 0)
+ mm_obj_dbg (self, "ignored failure reported in register operation");
+ else
+ error = mm_mobile_equipment_error_from_mbim_nw_error (nw_error, self);
+ }
}
- if (response)
- mbim_message_unref (response);
-
if (error)
g_task_return_error (task, error);
else