From 8e15c1849857c5b7ab6279698e8a8252bf1d2e21 Mon Sep 17 00:00:00 2001 From: Robert Falkenberg Date: Sat, 1 May 2021 08:07:27 +0200 Subject: [PATCH] transport/AT: Make sure PDU has upper case hex digits Some modems may reject AT+CSIM if PDU contains lower case hex digits [a-f]. Modem response is "ERROR" without any error code. This patch converts each PDU to upper case. Tested with Sierra Wireless EM7565. Example: AT+CSIM=14,"00a40004023F00" ERROR AT+CSIM=14,"00A40004023F00" +CSIM: 4,"612F" OK Change-Id: I318e36abc7ae975c62d32b7fe0ec949bf5997d13 --- pySim/transport/modem_atcmd.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pySim/transport/modem_atcmd.py b/pySim/transport/modem_atcmd.py index ecf463cc..eef38cb3 100644 --- a/pySim/transport/modem_atcmd.py +++ b/pySim/transport/modem_atcmd.py @@ -99,6 +99,9 @@ class ModemATCommandLink(LinkBase): pass # Nothing to do really ... def _send_apdu_raw(self, pdu): + # Make sure pdu has upper case hex digits [A-F] + pdu = pdu.upper() + # Prepare the command as described in 8.17 cmd = 'AT+CSIM=%d,\"%s\"' % (len(pdu), pdu)