mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-03-17 02:48:34 +03:00
ModemATCommandLink: improve response time for "+CME ERROR"
Change-Id: I41af33c1898f5ed3d1c5238e45f956c6ceab2826
This commit is contained in:
@@ -67,12 +67,16 @@ class ModemATCommandLink(LinkBase):
|
|||||||
t_start = time.time()
|
t_start = time.time()
|
||||||
while True:
|
while True:
|
||||||
rsp = rsp + self._sl.read(self._sl.in_waiting)
|
rsp = rsp + self._sl.read(self._sl.in_waiting)
|
||||||
if rsp.endswith(b'OK\r\n'):
|
lines = rsp.split(b'\r\n')
|
||||||
log.debug('Command finished with result: OK')
|
if len(lines) >= 2:
|
||||||
break
|
res = lines[-2]
|
||||||
if rsp.endswith(b'ERROR\r\n'):
|
if res == b'OK':
|
||||||
log.error('Command finished with result: ERROR')
|
log.debug('Command finished with result: %s', res)
|
||||||
break
|
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:
|
if time.time() - t_start >= timeout:
|
||||||
log.info('Command finished with timeout >= %ss', timeout)
|
log.info('Command finished with timeout >= %ss', timeout)
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in New Issue
Block a user