]> git.neil.brown.name Git - plato.git/commitdiff
Allow non-default retry count.
authorNeilBrown <neilb@suse.de>
Thu, 24 Jan 2013 23:26:24 +0000 (10:26 +1100)
committerNeilBrown <neilb@suse.de>
Thu, 24 Jan 2013 23:26:24 +0000 (10:26 +1100)
Somethings should never be retried if they fail - so allow
that to be specified.

Also switch from RESET to POWERDOWN to see if it helps.

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

index 2af2c946053c0b424bd48b181b59aed8b16cd87e..9d297f72858caaa83594027f017533c5dbb84b27 100644 (file)
@@ -93,7 +93,7 @@ class AtAction(Task):
     not_ok = re.compile("^(ERROR|\+CM[SE] ERROR:)")
     def __init__(self, check = None, ok = None, record = None, at = None,
                  timeout=None, handle = None, repeat = None, arg = None,
-                 critical = True, noreply=None):
+                 critical = True, noreply = None, retries = 5):
         Task.__init__(self, repeat)
         self.check = check
         self.okstr = ok
@@ -102,6 +102,7 @@ class AtAction(Task):
         self.record = record
         self.at = at
         self.arg = arg
+        self.retries = retries
         self.timeout_time = timeout
         self.handle = handle
         self.critical = critical
@@ -146,7 +147,7 @@ class AtAction(Task):
             pass
 
     def timeout(self, channel):
-        if channel.state['retries'] >= 5:
+        if channel.state['retries'] >= self.retries:
             if self.critical:
                 channel.force_state('reset')
             channel.advance()
@@ -547,7 +548,8 @@ control['flight'] = [
 
 control['reset'] = [
     # turning power off just kills everything!!!
-    AtAction(at='_ORESET', critical = False),
+    #AtAction(at='_ORESET', critical = False),
+    AtAction(at='$QCPWRDN', critical = False, retries = 0),
     PowerAction('reopen'),
     #PowerAction('off'),
     AtAction(at='E0', timeout=30000),
@@ -701,7 +703,7 @@ control['dtmf'] = [
     ]
 
 control['hangup'] = [
-    AtAction(at='+CHUP'),
+    AtAction(at='+CHUP', critical=False, retries=0),
     ChangeStateAction('idle')
     ]