mirror of
https://github.com/commaai/agnos-builder.git
synced 2026-08-05 08:15:47 +08:00
Remove ModemManager & friends (#561)
This commit is contained in:
@@ -57,7 +57,6 @@ apt-fast install --no-install-recommends -yq \
|
||||
libi2c-dev \
|
||||
libncursesw5-dev \
|
||||
libnss-myhostname \
|
||||
libqmi-utils \
|
||||
libssl-dev \
|
||||
locales \
|
||||
llvm \
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
LIBQMI_VERSION="1.36.0"
|
||||
|
||||
cd /tmp
|
||||
|
||||
# meson support for checkinstall
|
||||
git clone https://github.com/keithbowes/meson-install.git
|
||||
|
||||
apt-get update && apt-get install -yq --no-install-recommends \
|
||||
bash-completion \
|
||||
gobject-introspection \
|
||||
gtk-doc-tools \
|
||||
help2man \
|
||||
libgirepository1.0-dev \
|
||||
libglib2.0-dev \
|
||||
libgudev-1.0-dev \
|
||||
meson \
|
||||
ninja-build \
|
||||
|
||||
git clone -b $LIBQMI_VERSION --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libqmi.git
|
||||
cd libqmi
|
||||
meson setup build --prefix=/usr --libdir=/usr/lib/aarch64-linux-gnu -Dmbim_qmux=false -Dqrtr=false
|
||||
ninja -C build
|
||||
|
||||
cd build
|
||||
checkinstall -yD --install=no --fstrans=no --pkgname=libqmi /tmp/meson-install/meson-install
|
||||
mv libqmi*.deb /tmp/libqmi.deb
|
||||
|
||||
apt-get -o Dpkg::Options::="--force-overwrite" install -yq /tmp/libqmi.deb
|
||||
@@ -1,72 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
MM_VERSION="1.22.0"
|
||||
|
||||
cd /tmp
|
||||
|
||||
git clone -b $MM_VERSION --depth 1 https://gitlab.freedesktop.org/mobile-broadband/ModemManager.git
|
||||
|
||||
apt-get install -y --no-install-recommends \
|
||||
cmake \
|
||||
gettext \
|
||||
libdbus-1-dev \
|
||||
libpolkit-gobject-1-dev \
|
||||
libsystemd-dev \
|
||||
udev
|
||||
|
||||
cd ModemManager
|
||||
meson setup build \
|
||||
--prefix=/usr \
|
||||
--libdir=/usr/lib/aarch64-linux-gnu \
|
||||
--sysconfdir=/etc \
|
||||
--buildtype=release \
|
||||
-Dqmi=true \
|
||||
-Dmbim=false \
|
||||
-Dqrtr=false \
|
||||
-Dplugin_generic=enabled \
|
||||
-Dplugin_altair_lte=disabled \
|
||||
-Dplugin_anydata=disabled \
|
||||
-Dplugin_broadmobi=disabled \
|
||||
-Dplugin_cinterion=disabled \
|
||||
-Dplugin_dell=disabled \
|
||||
-Dplugin_dlink=disabled \
|
||||
-Dplugin_fibocom=disabled \
|
||||
-Dplugin_foxconn=disabled \
|
||||
-Dplugin_gosuncn=disabled \
|
||||
-Dplugin_haier=disabled \
|
||||
-Dplugin_huawei=disabled \
|
||||
-Dplugin_intel=disabled \
|
||||
-Dplugin_iridium=disabled \
|
||||
-Dplugin_linktop=disabled \
|
||||
-Dplugin_longcheer=disabled \
|
||||
-Dplugin_mbm=disabled \
|
||||
-Dplugin_motorola=disabled \
|
||||
-Dplugin_mtk=disabled \
|
||||
-Dplugin_nokia=disabled \
|
||||
-Dplugin_nokia_icera=disabled \
|
||||
-Dplugin_novatel=disabled \
|
||||
-Dplugin_novatel_lte=disabled \
|
||||
-Dplugin_option=disabled \
|
||||
-Dplugin_option_hso=disabled \
|
||||
-Dplugin_pantech=disabled \
|
||||
-Dplugin_qcom_soc=disabled \
|
||||
-Dplugin_quectel=enabled \
|
||||
-Dplugin_samsung=disabled \
|
||||
-Dplugin_sierra_legacy=disabled \
|
||||
-Dplugin_sierra=disabled \
|
||||
-Dplugin_simtech=disabled \
|
||||
-Dplugin_telit=disabled \
|
||||
-Dplugin_thuraya=disabled \
|
||||
-Dplugin_tplink=disabled \
|
||||
-Dplugin_ublox=disabled \
|
||||
-Dplugin_via=disabled \
|
||||
-Dplugin_wavecom=disabled \
|
||||
-Dplugin_x22x=disabled \
|
||||
-Dplugin_zte=disabled
|
||||
|
||||
ninja -C build
|
||||
|
||||
cd build
|
||||
checkinstall -yD --install=no --fstrans=no --pkgname=modemmanager /tmp/meson-install/meson-install
|
||||
mv modemmanager*.deb /tmp/modemmanager.deb
|
||||
@@ -1,22 +0,0 @@
|
||||
[Unit]
|
||||
Description=Modem Manager
|
||||
After=polkit.service
|
||||
Requires=polkit.service
|
||||
|
||||
[Service]
|
||||
Type=dbus
|
||||
BusName=org.freedesktop.ModemManager1
|
||||
ExecStart=/usr/sbin/ModemManager --filter-policy=strict --debug
|
||||
StandardError=null
|
||||
Restart=on-abort
|
||||
CapabilityBoundingSet=CAP_SYS_ADMIN
|
||||
ProtectSystem=true
|
||||
ProtectHome=true
|
||||
PrivateTmp=true
|
||||
RestrictAddressFamilies=AF_NETLINK AF_UNIX
|
||||
NoNewPrivileges=true
|
||||
User=root
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Alias=dbus-org.freedesktop.ModemManager1.service
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,6 @@
|
||||
// Allow sudo users to control network & modem
|
||||
// Allow sudo users to control network
|
||||
polkit.addRule(function (action, subject) {
|
||||
if ((action.id.startsWith("org.freedesktop.NetworkManager.") ||
|
||||
action.id.startsWith("org.freedesktop.ModemManager1.")) &&
|
||||
if (action.id.startsWith("org.freedesktop.NetworkManager.") &&
|
||||
subject.isInGroup("sudo")) {
|
||||
return polkit.Result.YES;
|
||||
}
|
||||
|
||||
@@ -39,8 +39,3 @@ source /usr/local/venv/bin/activate
|
||||
|
||||
# custom shims
|
||||
export PATH="/usr/comma/shims:${PATH}"
|
||||
|
||||
# nice AT command helper
|
||||
atc() {
|
||||
mmcli -m any --command="${@}"
|
||||
}
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
# EG25
|
||||
# Interface 0 - GNSS
|
||||
# Interface 2 - AT
|
||||
# Interface 3 - AT
|
||||
SUBSYSTEM=="tty",ATTRS{idVendor}=="2c7c",ATTRS{idProduct}=="0125",ENV{ID_USB_INTERFACE_NUM}=="00",ENV{ID_MM_DEVICE_IGNORE}="1"
|
||||
SUBSYSTEM=="tty",ATTRS{idVendor}=="2c7c",ATTRS{idProduct}=="0125",ENV{ID_USB_INTERFACE_NUM}=="02",SYMLINK+="modem_at0",ENV{ID_MM_PORT_IGNORE}="1"
|
||||
SUBSYSTEM=="tty",ATTRS{idVendor}=="2c7c",ATTRS{idProduct}=="0125",ENV{ID_USB_INTERFACE_NUM}=="03",SYMLINK+="modem_at1",ENV{ID_MM_PORT_IGNORE}="1"
|
||||
|
||||
# EG91
|
||||
# Interface 0 - debug
|
||||
# Interface 1 - GPS
|
||||
# Interface 2 - AT
|
||||
# Interface 3 - AT
|
||||
SUBSYSTEM=="tty",ATTRS{idVendor}=="2c7c",ATTRS{idProduct}=="6007",ENV{ID_USB_INTERFACE_NUM}=="00",ENV{ID_MM_DEVICE_IGNORE}="1"
|
||||
SUBSYSTEM=="tty",ATTRS{idVendor}=="2c7c",ATTRS{idProduct}=="6007",ENV{ID_USB_INTERFACE_NUM}=="01",ENV{ID_MM_DEVICE_IGNORE}="1"
|
||||
SUBSYSTEM=="tty",ATTRS{idVendor}=="2c7c",ATTRS{idProduct}=="6007",ENV{ID_USB_INTERFACE_NUM}=="02",SYMLINK+="modem_at0",ENV{ID_MM_PORT_IGNORE}="1"
|
||||
SUBSYSTEM=="tty",ATTRS{idVendor}=="2c7c",ATTRS{idProduct}=="6007",ENV{ID_USB_INTERFACE_NUM}=="03",SYMLINK+="modem_at1",ENV{ID_MM_PORT_TYPE_AT_PRIMARY}="1"
|
||||
ACTION=="add",SUBSYSTEM=="usb",ATTR{idVendor}=="2c7c",ATTR{idProduct}=="6007",RUN+="/bin/sh -c 'echo -n $kernel:1.4 > /sys/bus/usb/drivers/cdc_ether/unbind'"
|
||||
|
||||
# C16
|
||||
KERNEL=="ttyACM1",ENV{ID_MM_DEVICE_IGNORE}="1"
|
||||
KERNEL=="ttyACM0",ENV{ID_MM_PORT_TYPE_AT_PRIMARY}="1"
|
||||
KERNEL=="ttyACM2",ENV{ID_MM_PORT_TYPE_AT_SECONDARY}="1"
|
||||
SUBSYSTEM=="net", ACTION=="add", ATTRS{idVendor}=="05c6", ATTRS{idProduct}=="9330", NAME="usb%n"
|
||||
@@ -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