* [PATCH] atmodem: fix detection of ATD*99 for non-muxed serial ports
@ 2024-04-25 11:57 Martin Hundebøll
2024-04-25 20:20 ` patchwork-bot+ofono
0 siblings, 1 reply; 2+ messages in thread
From: Martin Hundebøll @ 2024-04-25 11:57 UTC (permalink / raw)
To: ofono; +Cc: Martin Hundebøll
The gprs context probe function has logic to detect whether CGDATA is
supported by the modem, or if ATD*99 should be used instead. However, it
seems like this logic was wrongly placed after registering for CGEV
notification, which did an early return in case the passed chat did not
have a slave.
Thus the ATD*99 detection was skipped for USB modems using separate
"virtual" serial ports for command and data channels (i.e. ttyUSB0 for
AT and ttyUSB1 for PPP).
Fix USB modem case by moving the check for a slave chat (and the
registraion for CGEV notifcations) to after the CGDATA check, which lets
the ATD*99 check run uncodionally.
---
drivers/atmodem/gprs-context.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/atmodem/gprs-context.c b/drivers/atmodem/gprs-context.c
index d92b6392..bfe6ae56 100644
--- a/drivers/atmodem/gprs-context.c
+++ b/drivers/atmodem/gprs-context.c
@@ -458,10 +458,6 @@ static int at_gprs_context_probe(struct ofono_gprs_context *gc,
ofono_gprs_context_set_data(gc, gcd);
- chat = g_at_chat_get_slave(gcd->chat);
- if (chat == NULL)
- return 0;
-
switch (vendor) {
case OFONO_VENDOR_SIMCOM_SIM900:
gcd->use_atd99 = FALSE;
@@ -471,7 +467,10 @@ static int at_gprs_context_probe(struct ofono_gprs_context *gc,
at_cgdata_test_cb, gc, NULL);
}
- g_at_chat_register(chat, "+CGEV:", cgev_notify, FALSE, gc, NULL);
+ chat = g_at_chat_get_slave(gcd->chat);
+ if (chat)
+ g_at_chat_register(chat, "+CGEV:", cgev_notify, FALSE, gc,
+ NULL);
return 0;
}
--
2.44.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-04-25 20:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-25 11:57 [PATCH] atmodem: fix detection of ATD*99 for non-muxed serial ports Martin Hundebøll
2024-04-25 20:20 ` patchwork-bot+ofono
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox