modemmanager: remove sysfscache after dbus ready

The mm_report_events_from_cache method is called during the startup and
informs the ModemManager of kernel events. Additionally, hotplug scripts
inform the ModemManager of kernel events. Processed events are stored in
the sysfs cache. It is possible for a hotplug script to write to the
sysfs cache while the mm_report_events_from_cache method is still waiting
for the ModemManager to be available on the bus during startup.
This could lead to a misbehavior where modems are not recognized.
To ensure a clean state on startup, the sysfs cache is cleared after the
ModemManager is available, ensuring reliable processing of kernel events.

Signed-off-by: Oliver Sedlbauer <osedlbauer@tdt.de>
This commit is contained in:
Oliver Sedlbauer 2023-10-16 14:21:21 +02:00
parent ee129c6031
commit 9ae43c14e8
2 changed files with 4 additions and 4 deletions

View file

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=modemmanager PKG_NAME:=modemmanager
PKG_SOURCE_VERSION:=1.22.0 PKG_SOURCE_VERSION:=1.22.0
PKG_RELEASE:=1 PKG_RELEASE:=2
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://gitlab.freedesktop.org/mobile-broadband/ModemManager.git PKG_SOURCE_URL:=https://gitlab.freedesktop.org/mobile-broadband/ModemManager.git

View file

@ -319,9 +319,6 @@ mm_report_event_from_cache_line() {
} }
mm_report_events_from_cache() { mm_report_events_from_cache() {
# Remove the sysfs cache
rm -f "${MODEMMANAGER_SYSFS_CACHE}"
local n=60 local n=60
local step=1 local step=1
local mmrunning=0 local mmrunning=0
@ -346,6 +343,9 @@ mm_report_events_from_cache() {
return return
} }
# Remove the sysfs cache
rm -f "${MODEMMANAGER_SYSFS_CACHE}"
# Report cached kernel events # Report cached kernel events
while IFS= read -r event_line; do while IFS= read -r event_line; do
mm_report_event_from_cache_line "${event_line}" mm_report_event_from_cache_line "${event_line}"