aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Hundebøll <martin@geanix.com>2024-04-25 13:57:43 +0200
committerDenis Kenzior <denkenz@gmail.com>2024-04-26 09:27:22 -0500
commitd708ed16ba89b3c2f8ee18165aff7f736d0791a5 (patch)
treed6224bf20dff9a2319e7a57de514439b1f3decc1
parent5275f243dbae194029c654092f1d7495c51c5a11 (diff)
downloadofono-d708ed16ba89b3c2f8ee18165aff7f736d0791a5.tar.gz
atmodem: fix detection of ATD*99 for non-muxed serial ports
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 notifications) to after the CGDATA check, which lets the ATD*99 check run uncodionally.
-rw-r--r--drivers/atmodem/gprs-context.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/atmodem/gprs-context.c b/drivers/atmodem/gprs-context.c
index d92b63924..bfe6ae56c 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;
}