[PATCH 1/3] mbm: fix initial polling for sim

2010-08-19 Thread Pekka . Pessi
From: Pekka Pessi pekka.pe...@nokia.com

There seems to be no specific error codes returned when SIM is missing. Poll
at least 5 times upon an error and give up after that.
---
 plugins/mbm.c |8 +++-
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/plugins/mbm.c b/plugins/mbm.c
index 6f71553..bebf5aa 100644
--- a/plugins/mbm.c
+++ b/plugins/mbm.c
@@ -108,10 +108,8 @@ static void simpin_check(gboolean ok, GAtResult *result, 
gpointer user_data)
 
DBG();
 
-   /* Modem returns +CME ERROR: 10 if SIM is not ready. */
-   if (!ok  result-final_or_pdu 
-   !strcmp(result-final_or_pdu, +CME ERROR: 10) 
-   data-cpin_poll_count++  5) {
+   /* Modem returns an error if SIM is not ready. */
+   if (!ok  data-cpin_poll_count++  5) {
data-cpin_poll_source =
g_timeout_add_seconds(1, init_simpin_check, modem);
return;
@@ -119,7 +117,7 @@ static void simpin_check(gboolean ok, GAtResult *result, 
gpointer user_data)
 
data-cpin_poll_count = 0;
 
-   /* Modem returns ERROR if there is no SIM in slot. */
+   /* There is probably no SIM if SIM is not ready after 5 seconds. */
data-have_sim = ok;
 
ofono_modem_set_powered(modem, TRUE);
-- 
1.7.0.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH 1/3] mbm: fix initial polling for sim

2010-08-19 Thread Marcel Holtmann
Hi Pekka,

 There seems to be no specific error codes returned when SIM is missing. Poll
 at least 5 times upon an error and give up after that.
 ---
  plugins/mbm.c |8 +++-
  1 files changed, 3 insertions(+), 5 deletions(-)
 
 diff --git a/plugins/mbm.c b/plugins/mbm.c
 index 6f71553..bebf5aa 100644
 --- a/plugins/mbm.c
 +++ b/plugins/mbm.c
 @@ -108,10 +108,8 @@ static void simpin_check(gboolean ok, GAtResult *result, 
 gpointer user_data)
  
   DBG();
  
 - /* Modem returns +CME ERROR: 10 if SIM is not ready. */
 - if (!ok  result-final_or_pdu 
 - !strcmp(result-final_or_pdu, +CME ERROR: 10) 
 - data-cpin_poll_count++  5) {
 + /* Modem returns an error if SIM is not ready. */
 + if (!ok  data-cpin_poll_count++  5) {
   data-cpin_poll_source =
   g_timeout_add_seconds(1, init_simpin_check, modem);

maybe the STE modem is a bit more specific here than the MBM one. Which
MBM modem did you test this with?

Regards

Marcel


___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH 1/3] mbm: fix initial polling for sim

2010-08-19 Thread Sjur Brændeland
Marcel Holtmann mar...@holtmann.org wrote:

 maybe the STE modem is a bit more specific here than the MBM one. Which
 MBM modem did you test this with?

I have been using MBM as template for my sim ready changes, so I don't think
there is any point at looking at STE driver at this point in time.

Regards
Sjur
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH 1/3] mbm: fix initial polling for sim

2010-08-19 Thread Pekka Pessi
Hi Marcel and Sjur,

  There seems to be no specific error codes returned when SIM is missing. Poll
  at least 5 times upon an error and give up after that.
  ---
   plugins/mbm.c |8 +++-
   1 files changed, 3 insertions(+), 5 deletions(-)
 
  diff --git a/plugins/mbm.c b/plugins/mbm.c
  index 6f71553..bebf5aa 100644
  --- a/plugins/mbm.c
  +++ b/plugins/mbm.c
  @@ -108,10 +108,8 @@ static void simpin_check(gboolean ok, GAtResult 
  *result, gpointer user_data)
 
  DBG();
 
  -   /* Modem returns +CME ERROR: 10 if SIM is not ready. */
  -   if (!ok  result-final_or_pdu 
  -   !strcmp(result-final_or_pdu, +CME ERROR: 10) 
  -   data-cpin_poll_count++  5) {
  +   /* Modem returns an error if SIM is not ready. */
  +   if (!ok  data-cpin_poll_count++  5) {
  data-cpin_poll_source =
  g_timeout_add_seconds(1, init_simpin_check, modem);

 maybe the STE modem is a bit more specific here than the MBM one. Which
 MBM modem did you test this with?

I've been testing with F3507g, branded as Dell 5530.

The existing mbm sim detection logic is based on my earlier tests
without connman. It worked when I manually called test/enable-modem.

When using ofono with connman, the modem gets powered immediately after
it gets configured by kernel. Sometimes mbm seems to be still in the middle of
its initialization when ofono tries to enable it.

--Pekka

-- 
Pekka.Pessi mail at nokia.com
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono