~mil/sxmo-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
3 3

[PATCH 1/2] Make suspendtimeout for screenlock cutomizable via SXMO_SUSPENDTIMEOUTS

Details
Message ID
<20201108175621.18042-1-m@milesalan.com>
DKIM signature
fail
Download raw message
Patch: +6 -2 DKIM signature: fail
From: Miles Alan <m@milesalan.com>

This way if someone wants a longer or shorter timeout that possible
by setting the env var SXMO_SUSPENDTIMEOUTS.

Also change the default to be 35s. This is roughly the duration of
ringing for an incoming phone call.
---
 programs/sxmo_screenlock.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/programs/sxmo_screenlock.c b/programs/sxmo_screenlock.c
index 34ed5e7..d7aba7f 100644
--- a/programs/sxmo_screenlock.c
+++ b/programs/sxmo_screenlock.c
@@ -52,6 +52,7 @@ void writefile(char *filepath, char *str);
// Variables
Display *dpy;
enum State state = StateNoInput;
int suspendtimeouts = 35;
int suspendpendingsceenon = 0;
int suspendpendingtimeouts = 0;
KeySym lastkeysym = XK_Cancel;
@@ -298,8 +299,8 @@ readinputloop(Display *dpy, int screen) {
			}
		} else if (state == StateSuspendPending) {
			suspendpendingtimeouts++;
			// # E.g. after 4s kick back into suspend
			if (suspendpendingtimeouts > 4) state = StateSuspend;
			// # E.g. after suspendtimeouts seconds kick back into suspend
			if (suspendpendingtimeouts > suspendtimeouts) state = StateSuspend;
			syncstate();
		}

@@ -439,6 +440,9 @@ main(int argc, char **argv) {

	signal(SIGTERM, sigterm);

	const char* suspendtimeouts_str = getenv("SXMO_SUSPENDTIMEOUTS");
	if (suspendtimeouts_str != NULL) suspendtimeouts = atoi(suspendtimeouts_str);

	const char* rtcwakeinterval = getenv("SXMO_RTCWAKEINTERVAL");
	if (rtcwakeinterval != NULL) wakeinterval = atoi(rtcwakeinterval);

-- 
2.28.0

[PATCH 2/2] Missed call rework: Use dbus to check for missed calls & properly delete pickup

Details
Message ID
<20201108175621.18042-2-m@milesalan.com>
In-Reply-To
<20201108175621.18042-1-m@milesalan.com> (view parent)
DKIM signature
fail
Download raw message
Patch: +19 -4 DKIM signature: fail
From: Miles Alan <m@milesalan.com>

Use dbus to monitor for missed calls. Missed calls used to work but had a
regression due to the work to make text/calls used dbus. This adds the proper
dbus hook for missed calls as well and also changes the incoming call
notification to allow for multiple incoming calls (theoretically).

Tested for a single caller and transitioning the pickup notification
into a missed call notification and all is working good.
---
 scripts/modem/sxmo_modemmonitor.sh       | 20 +++++++++++++++++---
 scripts/modem/sxmo_modemmonitortoggle.sh |  3 ++-
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/scripts/modem/sxmo_modemmonitor.sh b/scripts/modem/sxmo_modemmonitor.sh
index aca23ea..bfb9916 100755
--- a/scripts/modem/sxmo_modemmonitor.sh
+++ b/scripts/modem/sxmo_modemmonitor.sh
@@ -41,6 +41,8 @@ checkformissedcalls() {
		); do
			MISSEDNUMBER="$(lookupnumberfromcallid "$MISSEDCALLID")"
			mmcli -m "$(modem_n)" --voice-delete-call "$MISSEDCALLID"
			rm -f "$NOTIFDIR/incomingcall_${MISSEDCALLID}_notification"


			TIME="$(date --iso-8601=seconds)"
			mkdir -p "$LOGDIR"
@@ -62,7 +64,6 @@ checkforincomingcalls() {
		grep -Eo '[0-9]+ incoming \(ringing-in\)' |
		grep -Eo '[0-9]+'
	)"
	echo "$VOICECALLID" | grep -v . && rm -f "$NOTIFDIR/incomingcall" && return

	# Determine the incoming phone number
	echo "Incoming Call:"
@@ -79,7 +80,7 @@ checkforincomingcalls() {
	printf %b "$TIME\tcall_ring\t$INCOMINGNUMBER\n" >> "$LOGDIR/modemlog.tsv"

	sxmo_notificationwrite.sh \
		"$NOTIFDIR/incomingcall" \
		"$NOTIFDIR/incomingcall_${VOICECALLID}_notification" \
		"sxmo_modemcall.sh pickup $VOICECALLID" \
		none \
		"Pickup - $(sxmo_contacts.sh | grep -E "^\\$INCOMINGNUMBER")" &
@@ -125,15 +126,28 @@ checkfornewtexts() {

mainloop() {
	checkformissedcalls
	checkforincomingcalls
	checkfornewtexts

	# Monitor for incoming calls
	dbus-monitor --system "interface='org.freedesktop.ModemManager1.Modem.Voice',type='signal',member='CallAdded'" | \
		while read -r; do
			checkforincomingcalls
			checkformissedcalls
		done &

	# Monitor for incoming texts
	dbus-monitor --system "interface='org.freedesktop.ModemManager1.Modem.Messaging',type='signal',member='Added'" | \
		while read -r; do
			checkfornewtexts
		done &

	# Monitor for missed calls
	dbus-monitor --system "interface='org.freedesktop.DBus.Properties',member='PropertiesChanged',arg0='org.freedesktop.ModemManager1.Call'" | \
		while read -r; do
			checkformissedcalls
		done &

	wait
	wait
	wait
}
diff --git a/scripts/modem/sxmo_modemmonitortoggle.sh b/scripts/modem/sxmo_modemmonitortoggle.sh
index e90f002..39c2f8c 100755
--- a/scripts/modem/sxmo_modemmonitortoggle.sh
+++ b/scripts/modem/sxmo_modemmonitortoggle.sh
@@ -5,7 +5,8 @@ else
	sxmo_modemmonitor.sh &
fi

rm /tmp/sxmo_incomingcall
NOTIFDIR="$XDG_CONFIG_HOME"/sxmo/notifications
rm $NOTIFDIR/incomingcall*

# E.g. wait until process killed or started -- maybe there's a better way..
sleep 1
-- 
2.28.0

Re: [PATCH 2/2] Missed call rework: Use dbus to check for missed calls & properly delete pickup

Details
Message ID
<20201108180704.GA22587@mail.hallyn.com>
In-Reply-To
<20201108175621.18042-2-m@milesalan.com> (view parent)
DKIM signature
missing
Download raw message
On Sun, Nov 08, 2020 at 11:56:21AM -0600, m@milesalan.com wrote:
> From: Miles Alan <m@milesalan.com>
> 
> Use dbus to monitor for missed calls. Missed calls used to work but had a
> regression due to the work to make text/calls used dbus. This adds the proper
> dbus hook for missed calls as well and also changes the incoming call
> notification to allow for multiple incoming calls (theoretically).
> 
> Tested for a single caller and transitioning the pickup notification
> into a missed call notification and all is working good.

Oh awesome, thanks!  Yeah dbus is definately not my forté.

> ---
>  scripts/modem/sxmo_modemmonitor.sh       | 20 +++++++++++++++++---
>  scripts/modem/sxmo_modemmonitortoggle.sh |  3 ++-
>  2 files changed, 19 insertions(+), 4 deletions(-)
> 
> diff --git a/scripts/modem/sxmo_modemmonitor.sh b/scripts/modem/sxmo_modemmonitor.sh
> index aca23ea..bfb9916 100755
> --- a/scripts/modem/sxmo_modemmonitor.sh
> +++ b/scripts/modem/sxmo_modemmonitor.sh
> @@ -41,6 +41,8 @@ checkformissedcalls() {
>  		); do
>  			MISSEDNUMBER="$(lookupnumberfromcallid "$MISSEDCALLID")"
>  			mmcli -m "$(modem_n)" --voice-delete-call "$MISSEDCALLID"
> +			rm -f "$NOTIFDIR/incomingcall_${MISSEDCALLID}_notification"
> +
>  
>  			TIME="$(date --iso-8601=seconds)"
>  			mkdir -p "$LOGDIR"
> @@ -62,7 +64,6 @@ checkforincomingcalls() {
>  		grep -Eo '[0-9]+ incoming \(ringing-in\)' |
>  		grep -Eo '[0-9]+'
>  	)"
> -	echo "$VOICECALLID" | grep -v . && rm -f "$NOTIFDIR/incomingcall" && return
>  
>  	# Determine the incoming phone number
>  	echo "Incoming Call:"
> @@ -79,7 +80,7 @@ checkforincomingcalls() {
>  	printf %b "$TIME\tcall_ring\t$INCOMINGNUMBER\n" >> "$LOGDIR/modemlog.tsv"
>  
>  	sxmo_notificationwrite.sh \
> -		"$NOTIFDIR/incomingcall" \
> +		"$NOTIFDIR/incomingcall_${VOICECALLID}_notification" \
>  		"sxmo_modemcall.sh pickup $VOICECALLID" \
>  		none \
>  		"Pickup - $(sxmo_contacts.sh | grep -E "^\\$INCOMINGNUMBER")" &
> @@ -125,15 +126,28 @@ checkfornewtexts() {
>  
>  mainloop() {
>  	checkformissedcalls
> +	checkforincomingcalls
> +	checkfornewtexts
> +
> +	# Monitor for incoming calls
>  	dbus-monitor --system "interface='org.freedesktop.ModemManager1.Modem.Voice',type='signal',member='CallAdded'" | \
>  		while read -r; do
>  			checkforincomingcalls
> -			checkformissedcalls
>  		done &
> +
> +	# Monitor for incoming texts
>  	dbus-monitor --system "interface='org.freedesktop.ModemManager1.Modem.Messaging',type='signal',member='Added'" | \
>  		while read -r; do
>  			checkfornewtexts
>  		done &
> +
> +	# Monitor for missed calls
> +	dbus-monitor --system "interface='org.freedesktop.DBus.Properties',member='PropertiesChanged',arg0='org.freedesktop.ModemManager1.Call'" | \
> +		while read -r; do
> +			checkformissedcalls
> +		done &
> +
> +	wait
>  	wait
>  	wait
>  }
> diff --git a/scripts/modem/sxmo_modemmonitortoggle.sh b/scripts/modem/sxmo_modemmonitortoggle.sh
> index e90f002..39c2f8c 100755
> --- a/scripts/modem/sxmo_modemmonitortoggle.sh
> +++ b/scripts/modem/sxmo_modemmonitortoggle.sh
> @@ -5,7 +5,8 @@ else
>  	sxmo_modemmonitor.sh &
>  fi
>  
> -rm /tmp/sxmo_incomingcall
> +NOTIFDIR="$XDG_CONFIG_HOME"/sxmo/notifications
> +rm $NOTIFDIR/incomingcall*
>  
>  # E.g. wait until process killed or started -- maybe there's a better way..
>  sleep 1
> -- 
> 2.28.0
Details
Message ID
<20201120162915.pawavloawsqxb5ek@worker.anaproy.lxd>
In-Reply-To
<20201108175621.18042-1-m@milesalan.com> (view parent)
DKIM signature
missing
Download raw message
This looks useful indeed! I saw this and the other patch in this series wasn't applied yet, so I applied it
now.

--

Maarten van Gompel (proycon)
https://proycon.anaproy.nl
Reply to thread Export thread (mbox)