From ce2a661f0b93a6cf404807d922ccbde98dc43bbb Mon Sep 17 00:00:00 2001 From: Xiaoyi Chen Date: Thu, 16 Dec 2021 17:30:38 +0800 Subject: rilmodem: fix a problem that manager_dial_callback is never called This problem does not happen each time when dialing. It's only observed with some sim cards under certain network. The time sequence to reproduce the problem is: - send dial request - receive unsol event call state changed - send clcc poll request - clcc poll response (vd->cb is null here) - dial response - setup vd->cb (then it never gets called) --- drivers/rilmodem/voicecall.c | 12 +++++++++++- drivers/rilmodem/voicecall.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/rilmodem/voicecall.c b/drivers/rilmodem/voicecall.c index 6c169166..1fce4a3a 100644 --- a/drivers/rilmodem/voicecall.c +++ b/drivers/rilmodem/voicecall.c @@ -396,6 +396,8 @@ static void rild_cb(struct ril_msg *message, gpointer user_data) * DIAL_MODIFIED_TO_DIAL means redirection. The call we will see when * polling will have a different called number. */ + vd->suppress_clcc_poll = FALSE; + if (message->error == RIL_E_SUCCESS || (g_ril_vendor(vd->ril) == OFONO_RIL_VENDOR_AOSP && message->error == RIL_E_DIAL_MODIFIED_TO_DIAL)) { @@ -448,8 +450,10 @@ static void dial(struct ofono_voicecall *vc, /* Send request to RIL */ if (g_ril_send(vd->ril, RIL_REQUEST_DIAL, &rilp, - rild_cb, cbd, g_free) > 0) + rild_cb, cbd, g_free) > 0) { + vd->suppress_clcc_poll = TRUE; return; + } g_free(cbd); CALLBACK_WITH_FAILURE(cb, data); @@ -594,6 +598,11 @@ void ril_call_state_notify(struct ril_msg *message, gpointer user_data) g_ril_print_unsol_no_args(vd->ril, message); + if (vd->suppress_clcc_poll) { + DBG("suppress clcc poll!"); + return; + } + /* Just need to request the call list again */ ril_poll_clcc(vc); @@ -829,6 +838,7 @@ int ril_voicecall_probe(struct ofono_voicecall *vc, unsigned int vendor, vd->vendor = vendor; vd->cb = NULL; vd->data = NULL; + vd->suppress_clcc_poll = FALSE; clear_dtmf_queue(vd); diff --git a/drivers/rilmodem/voicecall.h b/drivers/rilmodem/voicecall.h index 31e120e3..beb25104 100644 --- a/drivers/rilmodem/voicecall.h +++ b/drivers/rilmodem/voicecall.h @@ -31,6 +31,7 @@ struct ril_voicecall_data { void *data; gchar *tone_queue; gboolean tone_pending; + gboolean suppress_clcc_poll; }; int ril_voicecall_probe(struct ofono_voicecall *vc, unsigned int vendor, -- cgit v1.2.1