Revert "feat: remove esim.nmconnection, use AGNOS lte conn (#35389)"

This reverts commit 255b606fe4.
pull/35483/head
Adeeb Shihadeh 3 months ago
parent ba2d2677c1
commit 63e7a0ca15
  1. 3
      system/hardware/base.py
  2. 30
      system/hardware/tici/esim.nmconnection
  3. 24
      system/hardware/tici/hardware.py

@ -210,9 +210,6 @@ class HardwareBase(ABC):
def configure_modem(self):
pass
def reboot_modem(self):
pass
@abstractmethod
def get_networks(self):
pass

@ -0,0 +1,30 @@
[connection]
id=esim
uuid=fff6553c-3284-4707-a6b1-acc021caaafb
type=gsm
permissions=
autoconnect=true
autoconnect-retries=100
autoconnect-priority=2
metered=1
[gsm]
apn=
home-only=false
auto-config=true
sim-id=
[ipv4]
route-metric=1000
dns-priority=1000
dns-search=
method=auto
[ipv6]
ddr-gen-mode=stable-privacy
dns-search=
route-metric=1000
dns-priority=1000
method=auto
[proxy]

@ -3,6 +3,7 @@ import math
import os
import subprocess
import time
import tempfile
from enum import IntEnum
from functools import cached_property, lru_cache
from pathlib import Path
@ -499,19 +500,18 @@ class Tici(HardwareBase):
except Exception:
pass
# we use the lte connection built into AGNOS. cleanup esim connection if it exists
# eSIM prime
dest = "/etc/NetworkManager/system-connections/esim.nmconnection"
if os.path.exists(dest):
os.system(f"sudo nmcli con delete {dest}")
self.reboot_modem()
def reboot_modem(self):
modem = self.get_modem()
for state in (0, 1):
try:
modem.Command(f'AT+CFUN={state}', math.ceil(TIMEOUT), dbus_interface=MM_MODEM, timeout=TIMEOUT)
except Exception:
pass
if sim_id.startswith('8985235') and not os.path.exists(dest):
with open(Path(__file__).parent/'esim.nmconnection') as f, tempfile.NamedTemporaryFile(mode='w') as tf:
dat = f.read()
dat = dat.replace("sim-id=", f"sim-id={sim_id}")
tf.write(dat)
tf.flush()
# needs to be root
os.system(f"sudo cp {tf.name} {dest}")
os.system(f"sudo nmcli con load {dest}")
def get_networks(self):
r = {}

Loading…
Cancel
Save