From e1f0b83d25a97f951fe8543199b87470b7957312 Mon Sep 17 00:00:00 2001 From: Evangelos Ribeiro Tzaras Date: Fri, 4 Nov 2022 09:48:41 +0100 Subject: [PATCH] ringer: Break loop if triggered event was ended immediately When the only feedback of an event is unavailable on a system (e.g. no vibration motor or LED) the "feedback-ended" signal is emitted immediately and the end reason will be LFB_EVENT_END_REASON_NOT_FOUND. In this case we need to change the target state, so that our logic does not end up retriggering the event infinitely. --- src/calls-ringer.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/calls-ringer.c b/src/calls-ringer.c index 0b5df7e..db07ed3 100644 --- a/src/calls-ringer.c +++ b/src/calls-ringer.c @@ -198,6 +198,12 @@ on_feedback_ended (LfbEvent *event, return; } + /* When no feedback is available on the system (e.g. no vibration motor or LEDs) + * it will get ended immediately on triggering. Changing the target state will + * break loop that would otherwise occur. */ + if (lfb_event_get_end_reason (event) == LFB_EVENT_END_REASON_NOT_FOUND) + self->target_state = CALLS_RING_STATE_INACTIVE; + set_ring_state (self, CALLS_RING_STATE_INACTIVE); }