~mil/sxmo-devel

sxmo-utils: sxmo_modem.sh: retry if failed to delete sms v3 APPLIED

Anjandev Momi: 1
 sxmo_modem.sh: retry if failed to delete sms

 1 files changed, 12 insertions(+), 1 deletions(-)
#1000615 test.yml success
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~mil/sxmo-devel/patches/41607/mbox | git am -3
Learn more about email & git

[PATCH sxmo-utils v3] sxmo_modem.sh: retry if failed to delete sms Export this patch

On sdm845 devices, I would get the same text multiple times. Even
though, the person sending the text only sent it once.

I ran the sxmo modemmonitor daemon manually and got the following
log:

```
dbus-monitor: unable to enable new-style monitoring: org.freedesktop.DBus.Error.AccessDenied: "Rejected send message, 1 matched rules; type="method_call", sender=":1.13225" (uid=10000 pid=24991 comm="dbus-monitor --system interface='org.freedesktop.M") interface="org.freedesktop.DBus.Monitoring" member="BecomeMonitor" error name="(unset)" requested_reply="0" destination="org.freedesktop.DBus" (bus)". Falling back to eavesdropping.
dbus-monitor: unable to enable new-style monitoring: org.freedesktop.DBus.Error.AccessDenied: "Rejected send message, 1 matched rules; type="method_call", sender=":1.13227" (uid=10000 pid=24994 comm="dbus-monitor --system interface='org.freedesktop.M") interface="org.freedesktop.DBus.Monitoring" member="BecomeMonitor" error name="(unset)" requested_reply="0" destination="org.freedesktop.DBus" (bus)". Falling back to eavesdropping.
dbus-monitor: unable to enable new-style monitoring: org.freedesktop.DBus.Error.AccessDenied: "Rejected send message, 1 matched rules; type="method_call", sender=":1.13226" (uid=10000 pid=24999 comm="dbus-monitor --system interface='org.freedesktop.D") interface="org.freedesktop.DBus.Monitoring" member="BecomeMonitor" error name="(unset)" requested_reply="0" destination="org.freedesktop.DBus" (bus)". Falling back to eavesdropping.
Failed to open connection to session bus: Failed to connect to socket /tmp/dbus-QIILCAmZIu: No such file or directory
dbus-monitor: unable to enable new-style monitoring: org.freedesktop.DBus.Error.AccessDenied: "Rejected send message, 1 matched rules; type="method_call", sender=":1.13228" (uid=10000 pid=25007 comm="dbus-monitor --system interface='org.freedesktop.M") interface="org.freedesktop.DBus.Monitoring" member="BecomeMonitor" error name="(unset)" requested_reply="0" destination="org.freedesktop.DBus" (bus)". Falling back to eavesdropping.
error: couldn't delete SMS: 'GDBus.Error:org.freedesktop.ModemManager1.Error.Core.Failed: Couldn't delete 1 parts from this SMS'
/home/user/.config/sxmo/hooks/sxmo_hook_sms.sh: line 20: go-sendxmpp: not found
successfully deleted SMS from modem
/home/user/.config/sxmo/hooks/sxmo_hook_sms.sh: line 20: go-sendxmpp: not found
```

The important line is:

```
error: couldn't delete SMS: 'GDBus.Error:org.freedesktop.ModemManager1.Error.Core.Failed: Couldn't delete 1 parts from this SMS'
```

After applying this patch, I only recieve texts once. I dont know why deleting
text command fails the first time. Moreover, this patch fixes the double
text issue on sdm845 devices.
---
 scripts/modem/sxmo_modem.sh | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/scripts/modem/sxmo_modem.sh b/scripts/modem/sxmo_modem.sh
index d5939d4..b5dd092 100755
--- a/scripts/modem/sxmo_modem.sh
+++ b/scripts/modem/sxmo_modem.sh
@@ -242,7 +242,18 @@ checkfornewtexts() {
		stderr "Text from number: $NUM (TEXTID: $TEXTID)"
		sxmo_hook_smslog.sh "recv" "$NUM" "$NUM" "$TIME" "$TEXT" >> "$SXMO_LOGDIR/$NUM/sms.txt"
		printf %b "$TIME\trecv_txt\t$NUM\t${#TEXT} chars\n" >> "$SXMO_LOGDIR/modemlog.tsv"
		mmcli -m any --messaging-delete-sms="$TEXTID"

		tries=1
		while ! mmcli -m any --messaging-delete-sms="$TEXTID";
		do
			if [ $tries -gt 5 ];
			then
				break
			fi
			echo "Failed to delete text $TEXTID. Will retry"
			sleep 3
			tries=$((tries+1))
		done
		CONTACTNAME=$(sxmo_contacts.sh --name-or-number "$NUM")

		if [ -z "$SXMO_DISABLE_SMS_NOTIFS" ]; then
-- 
2.40.1
sxmo-utils/patches/test.yml: SUCCESS in 49s

[sxmo_modem.sh: retry if failed to delete sms][0] v3 from [Anjandev Momi][1]

[0]: https://lists.sr.ht/~mil/sxmo-devel/patches/41607
[1]: mailto:anjan@momi.ca

✓ #1000615 SUCCESS sxmo-utils/patches/test.yml https://builds.sr.ht/~mil/job/1000615
Thanks!

To git@git.sr.ht:~mil/sxmo-utils
   7ea019e..bb0c557  master -> master