Re: [PATCH] rilmodem: fix a problem that manager_dial_callback is never called

2021-12-16 Thread Denis Kenzior

Hi Xiaoyi,

On 12/16/21 03:30, Xiaoyi Chen wrote:

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 | 7 +++
  drivers/rilmodem/voicecall.h | 1 +
  2 files changed, 8 insertions(+)

diff --git a/drivers/rilmodem/voicecall.c b/drivers/rilmodem/voicecall.c
index 6c169166..00a1bd9e 100644
--- a/drivers/rilmodem/voicecall.c
+++ b/drivers/rilmodem/voicecall.c
@@ -396,6 +396,7 @@ 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;


I added an extra newline here to comply with doc/coding-style.txt item M1


if (message->error == RIL_E_SUCCESS ||
(g_ril_vendor(vd->ril) == OFONO_RIL_VENDOR_AOSP &&
message->error == RIL_E_DIAL_MODIFIED_TO_DIAL)) {
@@ -447,6 +448,7 @@ static void dial(struct ofono_voicecall *vc,
clir);
  
  	/* Send request to RIL */

+   vd->suppress_clcc_poll = TRUE;


I moved this statement inside the if ...


if (g_ril_send(vd->ril, RIL_REQUEST_DIAL, ,
rild_cb, cbd, g_free) > 0)


here to be on the safe side.  There's almost never a time where g_ril_send will 
fail, but setting suppress_clcc_poll should only happen if the command could be 
scheduled successfully.



return;
@@ -593,6 +595,10 @@ void ril_call_state_notify(struct ril_msg *message, 
gpointer user_data)
struct ril_voicecall_data *vd = ofono_voicecall_get_data(vc);
  
  	g_ril_print_unsol_no_args(vd->ril, message);

+   if (vd->suppress_clcc_poll) {
+   ofono_info("suppress clcc poll!");


I changed this ofono_info to a DBG()


+   return;
+   }
  
  	/* Just need to request the call list again */

ril_poll_clcc(vc);
@@ -829,6 +835,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,




Applied, thanks.

Regards,
-Denis
___
ofono mailing list -- ofono@ofono.org
To unsubscribe send an email to ofono-le...@ofono.org


[PATCH] rilmodem: fix a problem that manager_dial_callback is never called

2021-12-16 Thread Xiaoyi Chen
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 | 7 +++
 drivers/rilmodem/voicecall.h | 1 +
 2 files changed, 8 insertions(+)

diff --git a/drivers/rilmodem/voicecall.c b/drivers/rilmodem/voicecall.c
index 6c169166..00a1bd9e 100644
--- a/drivers/rilmodem/voicecall.c
+++ b/drivers/rilmodem/voicecall.c
@@ -396,6 +396,7 @@ 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)) {
@@ -447,6 +448,7 @@ static void dial(struct ofono_voicecall *vc,
clir);
 
/* Send request to RIL */
+   vd->suppress_clcc_poll = TRUE;
if (g_ril_send(vd->ril, RIL_REQUEST_DIAL, ,
rild_cb, cbd, g_free) > 0)
return;
@@ -593,6 +595,10 @@ void ril_call_state_notify(struct ril_msg *message, 
gpointer user_data)
struct ril_voicecall_data *vd = ofono_voicecall_get_data(vc);
 
g_ril_print_unsol_no_args(vd->ril, message);
+   if (vd->suppress_clcc_poll) {
+   ofono_info("suppress clcc poll!");
+   return;
+   }
 
/* Just need to request the call list again */
ril_poll_clcc(vc);
@@ -829,6 +835,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,
-- 
2.17.1
___
ofono mailing list -- ofono@ofono.org
To unsubscribe send an email to ofono-le...@ofono.org