All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] huawei: do not query sim state on pre_sim
@ 2011-01-19 14:34 Lucas De Marchi
  2011-01-19 14:40 ` Marcel Holtmann
  0 siblings, 1 reply; 2+ messages in thread
From: Lucas De Marchi @ 2011-01-19 14:34 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2837 bytes --]

Sim state is already known after modem is enabled and there's no need to
query it again. Before this patch, query_sim_state() was called upon
huawei_enable() and huawei_pre_sim(). Both functions might call
notify_sim_state() with a valid state. Hence we could eventually end up
sending AT+CFUN=5 command twice.
---

Hi Marcel,

I think this is the right approach for this problem. Before this patch I had
the following log when enabling a huawei modem with not pins locked:

ofonod[7217]: oFono version 0.38
ofonod[7217]: plugins/huawei.c:huawei_probe() 0x1580610
ofonod[7217]: plugins/huawei.c:huawei_enable() 0x1580610
ofonod[7217]: plugins/huawei.c:open_device() Modem /dev/ttyUSB0
ofonod[7217]: plugins/huawei.c:open_device() Pcui /dev/ttyUSB1
ofonod[7217]: plugins/huawei.c:query_sim_state() 
ofonod[7217]: PCUI: > ATE0 +CMEE=1\r
ofonod[7217]: PCUI: < ATE0 +CMEE=1\r
ofonod[7217]: PCUI: < \r\nOK\r\n
ofonod[7217]: PCUI: > AT+CFUN=1\r
ofonod[7217]: PCUI: < \r\nOK\r\n
ofonod[7217]: plugins/huawei.c:cfun_enable() 
ofonod[7217]: PCUI: > AT^SYSINFO\r
ofonod[7217]: PCUI: < \r\n^SYSINFO:2,1,0,5,3,0,4\r\n\r\nOK\r\n
ofonod[7217]: plugins/huawei.c:sysinfo_cb() 
ofonod[7217]: plugins/huawei.c:notify_sim_state() 3
ofonod[7217]: plugins/huawei.c:huawei_pre_sim() 0x1580610
ofonod[7217]: plugins/huawei.c:query_sim_state() 
ofonod[7217]: PCUI: > AT^U2DIAG?\r
ofonod[7217]: PCUI: < \r\nERROR\r\n
ofonod[7217]: PCUI: > AT^GETPORTMODE\r
ofonod[7217]: PCUI: < \r\nCOMMAND NOT SUPPORT\r\n
ofonod[7217]: PCUI: > AT^USSDMODE=?\r
ofonod[7217]: PCUI: < \r\nCOMMAND NOT SUPPORT\r\n
ofonod[7217]: PCUI: > AT^CVOICE=?\r
ofonod[7217]: PCUI: < \r\nCOMMAND NOT SUPPORT\r\n
ofonod[7217]: PCUI: > AT^SYSINFO\r
ofonod[7217]: PCUI: < \r\n^SYSINFO:2,1,0,5,3,0,4\r\n\r\nOK\r\n
ofonod[7217]: plugins/huawei.c:sysinfo_cb() 
ofonod[7217]: plugins/huawei.c:notify_sim_state() 3
ofonod[7217]: PCUI: > AT+CFUN=5\r
ofonod[7217]: PCUI: < \r\nOK\r\n
ofonod[7217]: PCUI: > AT+CGMI\r
ofonod[7217]: PCUI: < \r\nhuawei\r\n\r\nOK\r\n
ofonod[7217]: PCUI: > AT+CFUN=5\r
ofonod[7217]: PCUI: < \r\nOK\r\n
<...>


The second call to query_sim_state() triggered a call to query_sim_state()
that called to notify_sim_state() with state == 3 again.



 plugins/huawei.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/plugins/huawei.c b/plugins/huawei.c
index b4b7436..09a7a3e 100644
--- a/plugins/huawei.c
+++ b/plugins/huawei.c
@@ -621,9 +621,6 @@ static void huawei_pre_sim(struct ofono_modem *modem)
 	ofono_devinfo_create(modem, 0, "atmodem", data->pcui);
 	data->sim = ofono_sim_create(modem, OFONO_VENDOR_HUAWEI,
 					"atmodem", data->pcui);
-
-	data->sim_poll_count = 0;
-	query_sim_state(modem);
 }
 
 static void huawei_post_sim(struct ofono_modem *modem)
-- 
1.7.3.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] huawei: do not query sim state on pre_sim
  2011-01-19 14:34 [PATCH] huawei: do not query sim state on pre_sim Lucas De Marchi
@ 2011-01-19 14:40 ` Marcel Holtmann
  0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2011-01-19 14:40 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 399 bytes --]

Hi Lucas,

> Sim state is already known after modem is enabled and there's no need to
> query it again. Before this patch, query_sim_state() was called upon
> huawei_enable() and huawei_pre_sim(). Both functions might call
> notify_sim_state() with a valid state. Hence we could eventually end up
> sending AT+CFUN=5 command twice.

patch has been applied. Thanks.

Regards

Marcel



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-01-19 14:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-19 14:34 [PATCH] huawei: do not query sim state on pre_sim Lucas De Marchi
2011-01-19 14:40 ` Marcel Holtmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.