From 99099a359ffe8a249298f6cbe804f2437d06a2ba Mon Sep 17 00:00:00 2001 From: "Serge E. Hallyn" Date: Sun, 6 Sep 2020 22:32:26 -0500 Subject: [PATCH] modemmonitor: use dbus-monitor Instead of looping over mmcli commands to check for incoming calls and texts every 3s, use dbus-monitor to tell us when something is coming in. This should save some battery life as well as reduce the delay in new call/msg notification. I was running on the latest released scripts, so have not strictly tested this with git master. Note that I dropped the call to checkmissedcalls. Perhaps we should still run that at firststart? Signed-off-by: Serge Hallyn Signed-off-by: Maarten van Gompel --- scripts/modem/sxmo_modemmonitor.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/scripts/modem/sxmo_modemmonitor.sh b/scripts/modem/sxmo_modemmonitor.sh index 6e06ae2..cf8ad8e 100755 --- a/scripts/modem/sxmo_modemmonitor.sh +++ b/scripts/modem/sxmo_modemmonitor.sh @@ -125,12 +125,16 @@ checkfornewtexts() { } mainloop() { - while true; do - checkformissedcalls - checkforincomingcalls - checkfornewtexts - sleep $TIMEOUT & wait - done + dbus-monitor --system "interface='org.freedesktop.ModemManager1.Modem.Voice',type='signal',member='CallAdded'" | \ + while read line; do + checkforincomingcalls + done & + dbus-monitor --system "interface='org.freedesktop.ModemManager1.Modem.Messaging',type='signal',member='Added'" | \ + while read line; do + checkfornewtexts + done & + wait + wait } mainloop