From f96c9ded631eb315ec9af139e3c49d840332ebd8 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); }