Skip to content

Commit 11f3037

Browse files
tokangasrlubos
authored andcommitted
samples: cellular: modem_shell: Fix LTE cell printing during search
Commit 8caef9d caused regression when printing LTE cell information during network search. This PR reverts the original functionality in link_api_xmonitor_read() and instead removes an error log which was printed when link_api_xmonitor_read() returned an error. It's simpler to let link_api_xmonitor_read() fail if cell ID and TAC can not be parsed. Signed-off-by: Tommi Kangas <[email protected]>
1 parent bd15bfa commit 11f3037

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

samples/cellular/modem_shell/src/link/link_api.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ int link_api_xmonitor_read(struct lte_xmonitor_resp_t *resp)
227227
{
228228
int ret = 0;
229229
int len;
230-
uint32_t reg_status;
231230
char tmp_cell_id_str[OP_CELL_ID_STR_MAX_LEN + 1] = { 0 };
232231
char tmp_tac_str[OP_TAC_STR_MAX_LEN + 1] = { 0 };
233232

@@ -242,12 +241,9 @@ int link_api_xmonitor_read(struct lte_xmonitor_resp_t *resp)
242241
resp->cell_id = -1;
243242
resp->tac = -1;
244243

245-
/* reg_status is not used but can not be ignored, otherwise the function returns an error
246-
* for a notification which only contains the registration status.
247-
*/
248244
ret = nrf_modem_at_scanf("AT%XMONITOR",
249245
"%%XMONITOR: "
250-
"%u," /* <reg_status> */
246+
"%*u," /* <reg_status>: ignored */
251247
"%"L(OP_FULL_NAME_STR_MAX_LEN)"[^,]," /* <full_name> with quotes */
252248
"%"L(OP_SHORT_NAME_STR_MAX_LEN)"[^,],"/* <short_name> with quotes*/
253249
"%"L(OP_PLMN_STR_MAX_LEN)"[^,]," /* <plmn> */
@@ -259,7 +255,6 @@ int link_api_xmonitor_read(struct lte_xmonitor_resp_t *resp)
259255
"%*u," /* <EARFCN>: ignored */
260256
"%d," /* <rsrp> */
261257
"%d", /* <snr> */
262-
&reg_status,
263258
resp->full_name_str,
264259
resp->short_name_str,
265260
resp->plmn_str,
@@ -300,7 +295,9 @@ static void link_api_modem_operator_info_read_for_shell(void)
300295
int ret = link_api_xmonitor_read(&xmonitor_resp);
301296

302297
if (ret) {
303-
mosh_error("link_api_xmonitor_read failed, result: ret %d", ret);
298+
/* Reading the information fails if modem is no longer registered, but
299+
* don't want to print an error in this case.
300+
*/
304301
return;
305302
}
306303

0 commit comments

Comments
 (0)