[pkg-fso-commits] [SCM] FSO frameworkd Debian packaging branch, master, updated. milestone4-368-g700ab82
Daniel Willmann
daniel at totalueberwachung.de
Mon Feb 2 18:51:55 UTC 2009
The following commit has been merged in the master branch:
commit e650884184bb6840d534277be025edf67fd507a7
Author: Daniel Willmann <daniel at totalueberwachung.de>
Date: Mon Jan 12 17:16:14 2009 +0100
ogsmd: Safeguard if modem replies to +CGM{L,R} with unsolicited messages
This will prevent Tracebacks like in
http://trac.freesmartphone.org/ticket/314, but the underlying actual
problem should still be fixed.
diff --git a/framework/subsystems/ogsmd/modems/abstract/mediator.py b/framework/subsystems/ogsmd/modems/abstract/mediator.py
index ecaeffa..a788310 100644
--- a/framework/subsystems/ogsmd/modems/abstract/mediator.py
+++ b/framework/subsystems/ogsmd/modems/abstract/mediator.py
@@ -866,7 +866,7 @@ class SimRetrieveMessagebook( SimMediator ):
# if you request a category for which no messages are found
if response[-1] in ( "OK", "+CMS ERROR: 321" ):
result = []
- curmsg = None
+ inbody = False
for line in response[:-1]:
#print "parsing line", line
if line.startswith( "+CMGL" ):
@@ -879,11 +879,20 @@ class SimRetrieveMessagebook( SimMediator ):
else:
direction = "sms-submit"
length = int(header.groupdict()["pdulen"])
- else:
+ inbody = True
+ elif inbody == True:
# Now we decode the actual PDU
-
- sms = ogsmd.gsm.sms.SMS.decode( line, direction )
- result.append( ( index, status, str(sms.oa), sms.ud, sms.properties ) )
+ inbody = False
+ try:
+ sms = ogsmd.gsm.sms.SMS.decode( line, direction )
+ except UnicodeError:
+ # Report an error so ogsmd doesn't bail out and we can
+ # see which PDU makes trouble
+ result.append( ( index, status, "Error decoding", "Error decoding", {} ) )
+ else:
+ result.append( ( index, status, str(sms.oa), sms.ud, sms.properties ) )
+ else:
+ logger.warning( "SinRetrieveMessagebook encountered strange answer to AT+CMGL: '%s'" % line )
self._ok( result )
else:
SimMediator.responseFromChannel( self, request, response )
@@ -899,6 +908,7 @@ class SimRetrieveMessage( SimMediator ):
if response[-1] != "OK":
SimMediator.responseFromChannel( self, request, response )
else:
+ inbody = False
for line in response[:-1]:
#print "parsing line", line
if line.startswith( "+CMGR" ):
@@ -910,10 +920,14 @@ class SimRetrieveMessage( SimMediator ):
else:
direction = "sms-submit"
length = int(header.groupdict()["pdulen"])
- else:
+ inbody = True
+ elif inbody == True:
+ inbody = False
# Now we decode the actual PDU
sms = ogsmd.gsm.sms.SMS.decode( line, direction )
result = ( status, str(sms.oa), sms.ud, sms.properties )
+ else:
+ logger.warning( "SinRetrieveMessage encountered strange answer to AT+CMGR: '%s'" % line )
self._ok( *result )
--
FSO frameworkd Debian packaging
More information about the pkg-fso-commits
mailing list