modemmanager: add support for wwan subsystem in hotplug
authorAleksander Morgado <[email protected]>
Mon, 4 Oct 2021 19:40:22 +0000 (21:40 +0200)
committerFederico Capoano <[email protected]>
Thu, 27 Oct 2022 16:48:21 +0000 (13:48 -0300)
WWAN devices may now be exposed in the new 'wwan' subsystem in the
kernel (since 5.13), initially applicable to devices exposed in PCIe
(no USB), but at some point may also apply to USB devices that until
now were exposed via other subsystems (e.g. usbmisc, tty).

Signed-off-by: Aleksander Morgado <[email protected]>
(cherry picked from commit 2a31359c478025850a9feeb684b758ede62bf9c4)

net/modemmanager/Makefile
net/modemmanager/files/25-modemmanager-wwan [new file with mode: 0644]

index c89a0b0f6551c8f446137be0329251ac5e449016..ce87b0a36ab2ac0256702f36098dc50a2ffdeca1 100644 (file)
@@ -131,6 +131,9 @@ define Package/modemmanager/install
        $(INSTALL_DIR) $(1)/etc/hotplug.d/tty
        $(INSTALL_DATA) ./files/25-modemmanager-tty $(1)/etc/hotplug.d/tty
 
+       $(INSTALL_DIR) $(1)/etc/hotplug.d/wwan
+       $(INSTALL_DATA) ./files/25-modemmanager-wwan $(1)/etc/hotplug.d/wwan
+
        $(INSTALL_DIR) $(1)/lib/netifd/proto
        $(INSTALL_BIN) ./files/modemmanager.proto $(1)/lib/netifd/proto/modemmanager.sh
 endef
diff --git a/net/modemmanager/files/25-modemmanager-wwan b/net/modemmanager/files/25-modemmanager-wwan
new file mode 100644 (file)
index 0000000..c4dc6b8
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+# Copyright (C) 2021 Aleksander Morgado <[email protected]>
+
+# Load hotplug common utilities
+. /usr/share/ModemManager/modemmanager.common
+
+# We require a device name
+[ -n "$DEVNAME" ] || exit
+
+# Always make sure the rundir exists
+mkdir -m 0755 -p "${MODEMMANAGER_RUNDIR}"
+
+# Report wwan
+mm_log "${ACTION} wwan control port ${DEVNAME}: event processed"
+mm_report_event "${ACTION}" "${DEVNAME}" "wwan" "/sys${DEVPATH}"