mirror of
https://github.com/commaai/agnos-builder.git
synced 2026-07-12 02:12:05 +08:00
Remove ModemManager & friends (#561)
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
import json
|
||||
import time
|
||||
import subprocess
|
||||
|
||||
@@ -20,25 +19,6 @@ def test_reset():
|
||||
assert proc.poll() is None
|
||||
proc.terminate()
|
||||
|
||||
def test_modem():
|
||||
out = run("mmcli -m 0 --output-json")
|
||||
mm = json.loads(out)
|
||||
from pprint import pprint
|
||||
pprint(mm)
|
||||
|
||||
# modem is up
|
||||
g = mm['modem']['generic']
|
||||
assert g['manufacturer'] == 'QUALCOMM INCORPORATED'
|
||||
assert g['model'] == 'QUECTEL Mobile Broadband Module'
|
||||
assert g['revision'] == 'EG25GGBR07A08M2G'
|
||||
|
||||
# sim is present
|
||||
assert g['sim'] == '/org/freedesktop/ModemManager1/SIM/0'
|
||||
|
||||
# blue prime is active
|
||||
out = run("nmcli con show --active")
|
||||
assert "blue-prime" in out
|
||||
|
||||
def test_wifi():
|
||||
out = run("nmcli dev wifi")
|
||||
networks = out.strip().splitlines()[1:]
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import json
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
def mmcli(cmd):
|
||||
try:
|
||||
out = subprocess.check_output(["mmcli", "-J", *cmd])
|
||||
return json.loads(out)
|
||||
except Exception as e:
|
||||
raise Exception(f"modem command failed: {cmd}") from e
|
||||
|
||||
def test_modem():
|
||||
# wait for the modem to come back up after flashing
|
||||
n = 0
|
||||
cnt = 0
|
||||
while n == 0:
|
||||
n = len(mmcli(["-L"])['modem-list'])
|
||||
if n > 1:
|
||||
raise Exception(f"Wrong number of modems ({n})")
|
||||
|
||||
cnt += 1
|
||||
if cnt > 100:
|
||||
raise Exception("Modem never came up")
|
||||
|
||||
time.sleep(1)
|
||||
|
||||
cnt = 0
|
||||
while True:
|
||||
modem = mmcli(["-m", "any"])
|
||||
if modem['modem']['generic']['sim'] != '--':
|
||||
break
|
||||
|
||||
cnt += 1
|
||||
if cnt > 100:
|
||||
raise Exception("SIM missing")
|
||||
|
||||
time.sleep(1)
|
||||
|
||||
# force to LTE
|
||||
#os.system("mmcli -m any --set-allowed-modes='4g'")
|
||||
|
||||
# set initial eps bearer apn
|
||||
#sim_id = mmcli(['-i', '0'])['sim']['properties']['iccid']
|
||||
#if sim_id.startswith('8901410'):
|
||||
# os.system('mmcli -m any --3gpp-set-initial-eps-bearer-settings="apn=Broadband"')
|
||||
|
||||
print("waiting for cell connection")
|
||||
time.sleep(7)
|
||||
|
||||
expected = [
|
||||
# key, expected value, error msg
|
||||
(['generic', 'manufacturer'], "QUALCOMM INCORPORATED", "Modem: wrong manufacturer"),
|
||||
(['generic', 'model'], "QUECTEL Mobile Broadband Module", "Modem: wrong model"),
|
||||
(['generic', 'revision'], "EG25GGBR07A08M2G", "Modem: wrong revision"),
|
||||
(['generic', 'carrier-configuration'], ["VoLTE-ATT", "Commercial-TMO_VoLTE"], "Modem: wrong carrier configuration"),
|
||||
(['generic', 'carrier-configuration-revision'], ["0501033C", "05010505"], "Modem: wrong carrier configuration revision"),
|
||||
|
||||
(['generic', 'supported-capabilities'], [['gsm-umts, lte'], ], "Modem: wrong capabilities"),
|
||||
(['3gpp', 'operator-name'], ["--", "AT&T", "T-Mobile"], "Modem: wrong operator"),
|
||||
]
|
||||
for key, val, err_msg in expected:
|
||||
v = modem['modem']
|
||||
for k in key:
|
||||
v = v.get(k)
|
||||
if isinstance(val, list):
|
||||
assert v in val, f"{err_msg} ({v})"
|
||||
else:
|
||||
assert v == val, f"{err_msg} ({v})"
|
||||
|
||||
os.system("date >> /data/tmp/modem_log")
|
||||
os.system("sudo su -c 'tail /data/tmp/modem_log > /dev/console'")
|
||||
os.system("sudo su -c 'wc -l /data/tmp/modem_log > /dev/console'")
|
||||
os.sync()
|
||||
|
||||
time.sleep(2)
|
||||
os.system("sudo reboot")
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_modem()
|
||||
@@ -1,28 +0,0 @@
|
||||
[connection]
|
||||
id=lte
|
||||
uuid=6586fb1f-4a66-46d4-9164-0100b73750ee
|
||||
type=gsm
|
||||
permissions=
|
||||
autoconnect=true
|
||||
autoconnect-retries=100
|
||||
metered=1
|
||||
|
||||
[gsm]
|
||||
apn=
|
||||
home-only=false
|
||||
auto-config=true
|
||||
|
||||
[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]
|
||||
Reference in New Issue
Block a user