From: Michael Pfeifroth Date: Fri, 31 Jul 2026 12:05:38 +0000 (+0200) Subject: modemmanager: skip live report when the service isn't up yet X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=187382d9d1444c0308355f2f34fc0c759ab73440;p=openwrt-packages.git modemmanager: skip live report when the service isn't up yet At boot procd replays every previously-seen uevent before /etc/init.d/modemmanager starts. Each replay walks the hotplug.d/ tree, which calls mm_report_event() in modemmanager.common. That helper does two independent things: 1) appends the event to ${MODEMMANAGER_EVENTS_CACHE}, and 2) runs 'mmcli --report-kernel-event=...' to notify a live MM. Step 1 is what matters for boot; step 2 exists so events fired after MM is running get reported without waiting for the next cache replay. The cache path is intentional: ModemManager-wrapper starts MM, then mm_report_events_from_cache() polls 'mmcli -L' until the bus is available and replays every cached event. At boot the modemmanager service instance hasn't been spawned by procd yet, so step 2 always fails with: daemon.err ModemManager[NNN]: hotplug: Couldn't report kernel event: error: couldn't get bus: Could not connect: No such file or directory That's one daemon.err line per hotplug script per port, per boot. On a dual-modem board that's a dozen spurious errors before the service even starts. Nothing is lost -- the wrapper's cache replay picks them all up seconds later -- but the log noise makes real ModemManager errors harder to spot. Guard the live call with a cheap pidfile-based liveness check. The pidfile is procd's, so it proves the service instance has been spawned, not that MM is already reachable on the bus; the brief wrapper-startup window (procd spawns the wrapper -> wrapper execs MM -> MM reaches the bus) is not covered. In practice no fresh uevents fire in that window on the boards this was tested on, and events that do arrive there are still cached. If the service hasn't been spawned yet, the event is silently cached and the wrapper handles it. If it has, behavior is unchanged. Signed-off-by: Michael Pfeifroth --- diff --git a/net/modemmanager/Makefile b/net/modemmanager/Makefile index 52f3b749a..f5f9bc040 100644 --- a/net/modemmanager/Makefile +++ b/net/modemmanager/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=modemmanager PKG_VERSION:=1.24.0 -PKG_RELEASE:=11 +PKG_RELEASE:=12 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://gitlab.freedesktop.org/mobile-broadband/ModemManager.git diff --git a/net/modemmanager/files/usr/share/ModemManager/modemmanager.common b/net/modemmanager/files/usr/share/ModemManager/modemmanager.common index bc35eaca9..2e07082df 100644 --- a/net/modemmanager/files/usr/share/ModemManager/modemmanager.common +++ b/net/modemmanager/files/usr/share/ModemManager/modemmanager.common @@ -158,6 +158,12 @@ mm_report_event() { ;; esac + # Skip live report if MM isn't up; wrapper will replay from cache. + if [ ! -s "${MODEMMANAGER_PID_FILE}" ] || \ + ! kill -0 "$(cat "${MODEMMANAGER_PID_FILE}" 2>/dev/null)" 2>/dev/null; then + return + fi + # Report the event mm_log "debug" "Report event: action=${action}, name=${name}, subsystem=${subsystem}" result=$(mmcli --report-kernel-event="action=${action},name=${name},subsystem=${subsystem}" 2>&1)