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

* feat: remove esim.nmconnection, use AGNOS lte conn

* unused

* remove old
pull/35391/head
Trey Moen 3 months ago committed by GitHub
parent e51243f2cd
commit 255b606fe4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 3
      system/hardware/base.py
  2. 30
      system/hardware/tici/esim.nmconnection
  3. 24
      system/hardware/tici/hardware.py

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

@ -1,30 +0,0 @@
[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,7 +3,6 @@ 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
@ -518,18 +517,19 @@ class Tici(HardwareBase):
except Exception:
pass
# eSIM prime
# we use the lte connection built into AGNOS. cleanup esim connection if it exists
dest = "/etc/NetworkManager/system-connections/esim.nmconnection"
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}")
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
def get_networks(self):
r = {}

Loading…
Cancel
Save