From 9cc367bd42a9862ebe24234a5c7a011311002213 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=81nis=20Eisaks?= Date: Mon, 13 Jan 2025 17:17:35 +0200 Subject: [PATCH] Update modem.py Some modems reply without blanks in response, so I suggest cleaning any of them out before checking the answer --- gsmmodem/modem.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gsmmodem/modem.py b/gsmmodem/modem.py index e468f34..f99e37b 100644 --- a/gsmmodem/modem.py +++ b/gsmmodem/modem.py @@ -378,7 +378,9 @@ def _unlockSim(self, pin): else: # Nothing read (real timeout) raise timeout - if cpinResponse != '+CPIN: READY': + #if cpinResponse != '+CPIN: READY': + #some modems reply w/o blanks in response + if cpinResponse.replace(' ', '') != '+CPIN:READY': if pin != None: self.write('AT+CPIN="{0}"'.format(pin)) else: