]> git.neil.brown.name Git - plato.git/commitdiff
gsm: differentiate between different styles of reset.
authorNeilBrown <neilb@suse.de>
Sun, 17 Feb 2013 03:51:12 +0000 (14:51 +1100)
committerNeilBrown <neilb@suse.de>
Sun, 17 Feb 2013 03:51:12 +0000 (14:51 +1100)
A CFUN error only requires a soft reset.  And EOF requires a harder
reset.
In each case, reopen devices just in case.

Also make sure status information is cleared until we are up and
running again.

Signed-off-by: NeilBrown <neilb@suse.de>
gsm/gsmd.py

index ccd30a0f462f7413568243d72f78b67afe6e6592..04ec2caa6482d3328afe79c66a30c38beb35d3fc 100644 (file)
@@ -205,10 +205,17 @@ class PowerAction(Task):
         elif self.cmd == "off":
             record('carrier', '')
             record('cell', '')
-            record('signal_strength','0/32')
+            record('signal_strength','-/32')
             channel.disconnect()
             channel.altchan.disconnect()
         elif self.cmd == 'reopen':
+            record('status','')
+            record('incoming','')
+            record('carrier', '')
+            record('cell', '')
+            record('signal_strength','-/32')
+            calllog_end('incoming')
+            calllog_end('outgoing')
             channel.disconnect()
             channel.altchan.disconnect()
             channel.connect()
@@ -457,7 +464,7 @@ def check_cfun(channel, line, m):
 
         if channel.last_reset + 100 < time.time():
             channel.last_reset = time.time()
-            channel.set_state('reset')
+            channel.set_state('refresh')
         return
 
 def data_handle(channel, line, m):
@@ -511,7 +518,7 @@ def data_hungup(channel, failed):
     if channel.data_APN:
         # We still want a connection
         if failed:
-            channel.set_state('reset')
+            channel.set_state('refresh')
             return
         elif channel.next_data_call <= time.time():
             channel.next_data_call = (time.time() +
@@ -580,12 +587,25 @@ control['flight'] = [
     BlockSuspendAction(False),
     ]
 
+control['refresh'] = [
+    # Soft reset: just use CFUN to turn off/on
+    # also reopen to clear status and just in case.
+    AtAction(at='+CFUN=0',critical=False, retries=0),
+    BlockSuspendAction(False),
+    PowerAction('reopen'),
+    BlockSuspendAction(True),
+    AtAction(at='E0', timeout=30000),
+    ChangeStateAction('init1'),
+    ]
+
 control['reset'] = [
-    # turning power off just kills everything!!!
-    #AtAction(at='_ORESET', critical = False),
-    AtAction(at='$QCPWRDN', critical = False, retries = 0),
+    # Harder reset - use _ORESET and re-open devices.
+    # Don't block suspend if we cannot re-open.
+    AtAction(at='_ORESET', critical = False),
+    #AtAction(at='$QCPWRDN', critical = False, retries = 0),
+    BlockSuspendAction(False),
     PowerAction('reopen'),
-    #PowerAction('off'),
+    BlockSuspendAction(True),
     AtAction(at='E0', timeout=30000),
     ChangeStateAction('init1'),
     ]