From c1388636a28b880e5c9b07bcaa8fbf867e23f02a Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Mon, 11 Apr 2022 15:33:58 -0700 Subject: [PATCH] comma three: correctly set initial EPS bearer settings for AT&T sim cards (#24175) * 3g sunset * only for blue prime * pass * full att code Co-authored-by: Comma Device --- selfdrive/hardware/base.py | 3 +++ selfdrive/hardware/tici/hardware.py | 19 +++++++++++++++++++ selfdrive/thermald/thermald.py | 7 +++++++ 3 files changed, 29 insertions(+) diff --git a/selfdrive/hardware/base.py b/selfdrive/hardware/base.py index 8e4ba72b2e..c05c75bbb2 100644 --- a/selfdrive/hardware/base.py +++ b/selfdrive/hardware/base.py @@ -152,6 +152,9 @@ class HardwareBase(ABC): def initialize_hardware(self): pass + def configure_modem(self): + pass + @abstractmethod def get_networks(self): pass diff --git a/selfdrive/hardware/tici/hardware.py b/selfdrive/hardware/tici/hardware.py index 53338e6c85..77f3265386 100644 --- a/selfdrive/hardware/tici/hardware.py +++ b/selfdrive/hardware/tici/hardware.py @@ -463,6 +463,25 @@ class Tici(HardwareBase): sudo_write("performance", "/sys/class/devfreq/soc:qcom,memlat-cpu0/governor") sudo_write("performance", "/sys/class/devfreq/soc:qcom,memlat-cpu4/governor") + def configure_modem(self): + sim_id = self.get_sim_info().get('sim_id', '') + + # blue prime config + if sim_id.startswith('8901410'): + cmds = [ + 'AT+QNVW=5280,0,"0102000000000000"', + 'AT+QNVFW="/nv/item_files/ims/IMS_enable",00', + 'AT+QNVFW="/nv/item_files/modem/mmode/ue_usage_setting",01', + ] + modem = self.get_modem() + for cmd in cmds: + try: + modem.Command(cmd, math.ceil(TIMEOUT), dbus_interface=MM_MODEM, timeout=TIMEOUT) + except Exception: + pass + os.system('mmcli -m 0 --3gpp-set-initial-eps-bearer-settings="apn=Broadband"') + + def get_networks(self): r = {} diff --git a/selfdrive/thermald/thermald.py b/selfdrive/thermald/thermald.py index 16887e9f74..2fbf48d170 100755 --- a/selfdrive/thermald/thermald.py +++ b/selfdrive/thermald/thermald.py @@ -101,6 +101,7 @@ def hw_state_thread(end_event, hw_queue): modem_version = None modem_nv = None + modem_configured = False while not end_event.is_set(): # these are expensive calls. update every 10s @@ -143,6 +144,12 @@ def hw_state_thread(end_event, hw_queue): os.system("nmcli conn up lte") registered_count = 0 + # TODO: remove this once the config is in AGNOS + if not modem_configured and len(HARDWARE.get_sim_info().get('sim_id', '')) > 0: + cloudlog.warning("configuring modem") + HARDWARE.configure_modem() + modem_configured = True + prev_hw_state = hw_state except Exception: cloudlog.exception("Error getting hardware state")