Merge pull request #22485 from osedl/modemmanager-fix-race-condition
Modemmanager fix race condition
This commit is contained in:
commit
7d75637eac
2 changed files with 13 additions and 9 deletions
|
@ -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:=3
|
||||||
|
|
||||||
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
|
||||||
|
|
|
@ -277,7 +277,7 @@ mm_report_event() {
|
||||||
local sysfspath="$4"
|
local sysfspath="$4"
|
||||||
|
|
||||||
# Do not save virtual devices
|
# Do not save virtual devices
|
||||||
local virtual
|
local virtual result
|
||||||
virtual="$(echo "$sysfspath" | cut -d'/' -f4)"
|
virtual="$(echo "$sysfspath" | cut -d'/' -f4)"
|
||||||
[ "$virtual" = "virtual" ] && {
|
[ "$virtual" = "virtual" ] && {
|
||||||
mm_log "debug" "sysfspath is a virtual device ($sysfspath)"
|
mm_log "debug" "sysfspath is a virtual device ($sysfspath)"
|
||||||
|
@ -298,11 +298,15 @@ mm_report_event() {
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Report the event
|
# Report the event
|
||||||
mm_log "debug" "event reported: action=${action}, name=${name}, subsystem=${subsystem}"
|
mm_log "debug" "Report event: action=${action}, name=${name}, subsystem=${subsystem}"
|
||||||
mmcli --report-kernel-event="action=${action},name=${name},subsystem=${subsystem}" 1>/dev/null 2>&1 &
|
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() {
|
mm_report_event_from_cache_line() {
|
||||||
|
@ -319,9 +323,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 +347,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}"
|
||||||
|
|
Loading…
Reference in a new issue