[PATCH] qmi: netreg: Fix RAT detection
Ivaylo Dimitrov <[email protected]> Sun, 8 Dec 2024 13:49:34 +0200
| Newsgroups | dev.linux.lists.ofono |
|---|---|
| Message-ID | <[email protected]> |
It is not clear why extract_ss_info is looping over all ss->radio_if_count
interfaces, given that the result of that loops is that it always gets the
last RAT. However, if there is more than one active interface, like:
qmicli -d /dev/cdc-wdm1 --nas-get-serving-system
[/dev/cdc-wdm1] Successfully got serving system:
Registration state: 'registered'
CS: 'attached'
PS: 'detached'
Selected network: '3gpp'
Radio interfaces: '2'
[0]: 'umts'
[1]: 'cdma-1xevdo'
...
the current logic will set tech to invalid (-1).
Fix that by looping backwards until a valid tech is set. That way the logic
is kept intact, besides that invalid RATs are filtered
---
drivers/qmimodem/network-registration.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/qmimodem/network-registration.c b/drivers/qmimodem/network-registration.c
index c0c9338d..3c9df0c1 100644
--- a/drivers/qmimodem/network-registration.c
+++ b/drivers/qmimodem/network-registration.c
@@ -96,10 +96,10 @@ static bool extract_ss_info(struct qmi_result *result, int *status,
*tech = -1;
- for (i = 0; i < ss->radio_if_count; i++) {
- DBG("radio in use %d", ss->radio_if[i]);
+ for (i = ss->radio_if_count; i && *tech == -1; i--) {
+ DBG("radio in use %d", ss->radio_if[i - 1]);
- *tech = qmi_nas_rat_to_tech(ss->radio_if[i]);
+ *tech = qmi_nas_rat_to_tech(ss->radio_if[i - 1]);
}
*roaming = ROAMING_STATUS_NO_CHANGE;
--
2.25.1