From 60cb56b646b2016f355745cbc976382b70ff5939 Mon Sep 17 00:00:00 2001 From: XiaoXX Date: Tue, 1 Sep 2026 12:35:56 +0800 Subject: [PATCH] modem.py: accept hex chars in ICCID (#38735) E.118 specifies decimal digits, but many real SIMs carry hex characters in EF_ICCID (e.g. China Mobile's 898600B5... range, some MVNO/IoT SIMs). AT+QCCID returns them verbatim, and the strict isdigit() check blanked the ICCID, leaving the modem daemon stuck in INITIALIZING forever and cellular dead. ModemManager parses ICCID as hex for the same reason. Verified on a comma four with a China Mobile SIM (EG916Q-GL): previously stuck retrying 'identity read incomplete', now dials and passes traffic. (cherry picked from commit e10c0fd960016e385f1135d9af4af03b634a7ad2) --- openpilot/common/hardware/comma/modem.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openpilot/common/hardware/comma/modem.py b/openpilot/common/hardware/comma/modem.py index a4f59702d..16e5cb8d2 100755 --- a/openpilot/common/hardware/comma/modem.py +++ b/openpilot/common/hardware/comma/modem.py @@ -5,6 +5,7 @@ import logging import os import select import signal +import string import struct import subprocess import tempfile @@ -354,7 +355,7 @@ class Modem: imei = "" iccid = (self._atv("AT+QCCID", "+QCCID:") or "").rstrip("F") - if not iccid.isdigit(): + if not all(c in string.hexdigits for c in iccid): iccid = "" imsi = first_line("AT+CIMI")