From 01fb59f4e2366e89f96c432ff66b355f600302d6 Mon Sep 17 00:00:00 2001 From: Oliver Sedlbauer Date: Mon, 16 Oct 2023 16:42:25 +0200 Subject: [PATCH] modemmanager: check status of report-kernel-event At mm_report_modem_wait a wait status is set. When attempting to report an event (via hotplug or during startup) and the DBus is not yet available, the status in the sysfs cache is set to 'processed' incorrectly, even if mmcli fails. This is fixed by aborting the operation and logging an error when the kernel report fails. Signed-off-by: Oliver Sedlbauer --- net/modemmanager/Makefile | 2 +- net/modemmanager/files/modemmanager.common | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/net/modemmanager/Makefile b/net/modemmanager/Makefile index bdbdd236ea..82216ae4c1 100644 --- a/net/modemmanager/Makefile +++ b/net/modemmanager/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=modemmanager PKG_SOURCE_VERSION:=1.22.0 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://gitlab.freedesktop.org/mobile-broadband/ModemManager.git diff --git a/net/modemmanager/files/modemmanager.common b/net/modemmanager/files/modemmanager.common index 2a604c9b68..d157cebf86 100644 --- a/net/modemmanager/files/modemmanager.common +++ b/net/modemmanager/files/modemmanager.common @@ -277,7 +277,7 @@ mm_report_event() { local sysfspath="$4" # Do not save virtual devices - local virtual + local virtual result virtual="$(echo "$sysfspath" | cut -d'/' -f4)" [ "$virtual" = "virtual" ] && { mm_log "debug" "sysfspath is a virtual device ($sysfspath)" @@ -298,11 +298,15 @@ mm_report_event() { esac # Report the event - mm_log "debug" "event reported: action=${action}, name=${name}, subsystem=${subsystem}" - mmcli --report-kernel-event="action=${action},name=${name},subsystem=${subsystem}" 1>/dev/null 2>&1 & + mm_log "debug" "Report event: action=${action}, name=${name}, subsystem=${subsystem}" + result=$(mmcli --report-kernel-event="action=${action},name=${name},subsystem=${subsystem}" 2>&1) + if [ "$?" -eq "0" ]; then + # Wait for added modem if a sysfspath is given + [ -n "${sysfspath}" ] && [ "$action" = "add" ] && mm_report_modem_wait "${sysfspath}" + else + mm_log "error" "Couldn't report kernel event: ${result}" + fi - # Wait for added modem if a sysfspath is given - [ -n "${sysfspath}" ] && [ "$action" = "add" ] && mm_report_modem_wait "${sysfspath}" } mm_report_event_from_cache_line() { -- 2.30.2