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/.

Falkenber9 gerrit-no-reply at lists.osmocom.org
Thu May 6 07:58:16 UTC 2021


Falkenber9 has uploaded this change for review. ( 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, 7 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/58/24158/1

diff --git a/pySim/transport/modem_atcmd.py b/pySim/transport/modem_atcmd.py
index 6557b02..b8a9186 100644
--- a/pySim/transport/modem_atcmd.py
+++ b/pySim/transport/modem_atcmd.py
@@ -67,12 +67,13 @@
 		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.debug('Command finished with result: ERROR')
-				break
+			lines = rsp.split(b'\r\n')
+			if len(lines) >= 2:
+				res = lines[-2]
+				if any(res.startswith(val) for val in [b'OK', b'ERROR', b'+CME ERROR:']):
+					log.debug('Command finished with result: %s', res)
+					break
+
 			if time.time() - t_start >= timeout:
 				log.debug('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: 1
Gerrit-Owner: Falkenber9 <robert.falkenberg at tu-dortmund.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210506/6b67f24d/attachment.htm>


More information about the gerrit-log mailing list