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 <redacted>
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
;;
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)