diff mbox series

[02/10] sim7100: wait for modem to start while enabling

Message ID 20240430115234.180185-2-martin@geanix.com (mailing list archive)
State Accepted
Commit 4b98bea96881a9c582271c102cdfa8335b6e307c
Headers show
Series [01/10] sim7100: simplify serial device opening | expand

Commit Message

Martin Hundebøll April 30, 2024, 11:52 a.m. UTC
The sim7100_enable() returns 0 just after queuing the AT+CFUN=1 command,
which ofono core interprets as the modem being powered up and in pre-sim
state. In fact, the pre-sim state isn't reached until the modem returns
OK, which is caught in cfun_set_on_cb() in sim7100.c.

Delay the transition from off to pre-sim until the respone is received
by return EINPROGRESS instead, and let the (existing)
ofono_modem_set_powered() call signal pre-sim to ofono core.
---
 plugins/sim7100.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/plugins/sim7100.c b/plugins/sim7100.c
index 4a1ac782..b5e65891 100644
--- a/plugins/sim7100.c
+++ b/plugins/sim7100.c
@@ -149,7 +149,7 @@  static int sim7100_enable(struct ofono_modem *modem)
 	g_at_chat_send(data->at, "AT+CFUN=1", NULL, cfun_set_on_cb,
 								modem, NULL);
 
-	return 0;
+	return -EINPROGRESS;
 }
 
 static void cfun_set_off_cb(gboolean ok, GAtResult *result, gpointer user_data)