Change in pysim[master]: ModemATCommandLink: improve response time for "+CME ERROR"

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Fri May 7 21:49:54 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/24158 )

Change subject: ModemATCommandLink: improve response time for "+CME ERROR"
......................................................................

ModemATCommandLink: improve response time for "+CME ERROR"

Change-Id: I41af33c1898f5ed3d1c5238e45f956c6ceab2826
---
M pySim/transport/modem_atcmd.py
1 file changed, 10 insertions(+), 6 deletions(-)

Approvals:
  Jenkins Builder: Verified
  fixeria: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved



diff --git a/pySim/transport/modem_atcmd.py b/pySim/transport/modem_atcmd.py
index 3d39a20..04f9221 100644
--- a/pySim/transport/modem_atcmd.py
+++ b/pySim/transport/modem_atcmd.py
@@ -67,12 +67,16 @@
 		t_start = time.time()
 		while True:
 			rsp = rsp + self._sl.read(self._sl.in_waiting)
-			if rsp.endswith(b'OK\r\n'):
-				log.debug('Command finished with result: OK')
-				break
-			if rsp.endswith(b'ERROR\r\n'):
-				log.error('Command finished with result: ERROR')
-				break
+			lines = rsp.split(b'\r\n')
+			if len(lines) >= 2:
+				res = lines[-2]
+				if res == b'OK':
+					log.debug('Command finished with result: %s', res)
+					break
+				if res == b'ERROR' or res.startswith(b'+CME ERROR:'):
+					log.error('Command failed with result: %s', res)
+					break
+
 			if time.time() - t_start >= timeout:
 				log.info('Command finished with timeout >= %ss', timeout)
 				break

-- 
To view, visit https://gerrit.osmocom.org/c/pysim/+/24158
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I41af33c1898f5ed3d1c5238e45f956c6ceab2826
Gerrit-Change-Number: 24158
Gerrit-PatchSet: 2
Gerrit-Owner: Falkenber9 <robert.falkenberg at tu-dortmund.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210507/34f26d75/attachment.htm>


More information about the gerrit-log mailing list