2009/12/14 arne anka <openm...@ginguppin.de>:
>
> not afaik.
> a normal per call or startup option would have been my first choice, but
>  from everything i could gather, there's no way to do that.
> i'd expected the patch mentioned to add exactly that kind of option, but
> it turned out to add only a build time option.

OK, thanks.

> but yesterday the phone (or maybe only zhone) lost connection to the
> network which made me miss an appointment and several calls (once a year
> people call ...).
> in a hurry i restarted the whole phone but zhone was showing exactly the
> same issues again :-(

I think the main problem here is not dbus request timeout.  When ogsmd
is still starting up, dbus calls to it - i.e. the antenna power and
authentication status calls - actually complete very quickly with a
"device is not enabled" error.  If the antenna power call fails like
this, zhone decides to try reading the authentication status.  If the
auth status call fails, zhone does nothing ever after.  So if you're
unlucky with timing, you can easily reach a situation where GSM is not
up and nothing else ever happens.

For me the attached zhone patches fix this.  They change the GSM
startup sequence so that authentication is handled before switching on
the antenna, and add retrying in the case where the auth call fails.

(Another detail in the zhone GSM startup sequence is that it assumes
that if the SetAntennaPower call fails, it may be because a SIM PIN is
needed.  But this complicates the retry logic, and it seems plausible
to me to handle any authentication first.)

A big caveat is that I don't have SIM authentication and so haven't
been able to test if the auth/antenna swapping really works.  If
someone with a PIN could do that, it would be great.

Regards,
       Neil
From 45d0393cc9e8816ffaf9acd19b1fb30007c270c8 Mon Sep 17 00:00:00 2001
From: Neil Jerram <neiljer...@googlemail.com>
Date: Tue, 15 Dec 2009 00:55:47 +0000
Subject: [PATCH 1/3] Named entry points turnOnAntenna and handleAuth

---
 zhone |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/zhone b/zhone
index 771a32b..f184855 100755
--- a/zhone
+++ b/zhone
@@ -2158,6 +2158,9 @@ class GSMAgent( Agent ):
         """
         This is called to start the authentication process
         """
+        self.turnOnAntenna()
+
+    def turnOnAntenna( self ):
         self.setState( _("Turning on Antenna") )
         dbus_object.gsm_device_iface.SetAntennaPower(
             True,
@@ -2175,6 +2178,9 @@ class GSMAgent( Agent ):
 
     def cbAntennaPowerError( self, e ):
         logger.info( "SIM seems to be protected. Checking auth status now." )
+        self.handleAuth()
+
+    def handleAuth( self ):
         self.setState( _("Reading authentication status") )
         dbus_object.gsm_sim_iface.GetAuthStatus(
             reply_handler=self.cbAuthStatusReply,
-- 
1.6.5.4

From 58dd86f51b7f54a3f4e63b8d3c4c4683683131a0 Mon Sep 17 00:00:00 2001
From: Neil Jerram <neiljer...@googlemail.com>
Date: Tue, 15 Dec 2009 00:58:14 +0000
Subject: [PATCH 2/3] Do auth first, then turn on antenna

---
 zhone |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/zhone b/zhone
index f184855..6ec72f9 100755
--- a/zhone
+++ b/zhone
@@ -2158,7 +2158,7 @@ class GSMAgent( Agent ):
         """
         This is called to start the authentication process
         """
-        self.turnOnAntenna()
+        self.handleAuth()
 
     def turnOnAntenna( self ):
         self.setState( _("Turning on Antenna") )
@@ -2190,8 +2190,8 @@ class GSMAgent( Agent ):
     def cbAuthStatusReply( self, authstatus ):
         if authstatus == "READY":
             self.setState( _("Telephony Ready") )
-            # restart auth, should lead to registering this time...
-            self.cbResourceReady()
+            # Now turn on antenna
+            self.turnOnAntenna()
         elif authstatus == "SIM PIN":
             self.setState( _("Waiting for PIN") )
             self.main.groups["pin_edit"].setup(
-- 
1.6.5.4

From acdd194ea63068605139917daa3f3f0ba060168d Mon Sep 17 00:00:00 2001
From: Neil Jerram <neiljer...@googlemail.com>
Date: Tue, 15 Dec 2009 00:59:50 +0000
Subject: [PATCH 3/3] If first auth attempt fails, try again

---
 zhone |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/zhone b/zhone
index 6ec72f9..c0da2ae 100755
--- a/zhone
+++ b/zhone
@@ -23,6 +23,8 @@ You have been warned :)
 __version__ = "0.0.0"
 MODULE_NAME = "zhone"
 
+from time import sleep
+
 # Locale support
 import gettext
 
@@ -2216,6 +2218,9 @@ class GSMAgent( Agent ):
     def cbAuthStatusError( self, e ):
         self.setState( _("Failed to read authentication status") )
         logger.exception( e )
+        sleep(5)
+        # Retry
+        self.handleAuth()
 
     def cbPINDone( self, pin, *args ):
         self.setState( _("Sending PIN") )
-- 
1.6.5.4

_______________________________________________
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community

Reply via email to