From e2c9b530b9d46f192e443a5fccfdbdf7028d1b29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Sun, 16 Jun 2024 10:21:54 +0200 Subject: [PATCH 1/2] cli: Reindent Gbp-Dch: Ignore --- cli/fbcli.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/cli/fbcli.c b/cli/fbcli.c index ca7cf79..6081ede 100644 --- a/cli/fbcli.c +++ b/cli/fbcli.c @@ -37,7 +37,7 @@ on_watch_expired (gpointer unused) } static void -on_feedback_ended (LfbEvent *event, int* data) +on_feedback_ended (LfbEvent *event, int *data) { g_return_if_fail (LFB_IS_EVENT (event)); @@ -49,7 +49,7 @@ on_feedback_ended (LfbEvent *event, int* data) static gboolean on_user_input (GIOChannel *channel, GIOCondition cond, LfbEvent *event) { - g_autoptr(GError) err = NULL; + g_autoptr (GError) err = NULL; if (cond == G_IO_IN) { g_print ("Ending feedback\n"); @@ -62,9 +62,9 @@ on_user_input (GIOChannel *channel, GIOCondition cond, LfbEvent *event) static gboolean trigger_event (const char *name, const gchar *profile, gboolean important, gint timeout) { - g_autoptr(GError) err = NULL; - g_autoptr(LfbEvent) event = NULL; - g_autoptr(GIOChannel) input = NULL; + g_autoptr (GError) err = NULL; + g_autoptr (LfbEvent) event = NULL; + g_autoptr (GIOChannel) input = NULL; int success = FALSE; g_unix_signal_add (SIGTERM, on_shutdown_signal, NULL); @@ -133,8 +133,8 @@ set_profile (const gchar *profile) int main (int argc, char *argv[0]) { - g_autoptr(GOptionContext) opt_context = NULL; - g_autoptr(GError) err = NULL; + g_autoptr (GOptionContext) opt_context = NULL; + g_autoptr (GError) err = NULL; g_autofree char *profile = NULL; g_autofree char *app_id = NULL; const char *name = NULL; @@ -173,9 +173,9 @@ main (int argc, char *argv[0]) return 1; } - if (profile && !name) + if (profile && !name) { success = set_profile (profile); - else { + } else { if (!name) name = g_strdup (DEFAULT_EVENT); From 212682fb0f72da8cfc749a012f874df2b42da1f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Sun, 16 Jun 2024 10:26:15 +0200 Subject: [PATCH 2/2] cli: Inform user when no feedback was found This might either be because the event doesn't exist or when the profile doesn't have any feedback on the current level. Closes: https://source.puri.sm/Librem5/feedbackd/-/issues/76 --- cli/fbcli.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cli/fbcli.c b/cli/fbcli.c index 6081ede..c412ebf 100644 --- a/cli/fbcli.c +++ b/cli/fbcli.c @@ -93,6 +93,9 @@ trigger_event (const char *name, const gchar *profile, gboolean important, gint g_main_loop_run (loop); g_main_loop_unref (loop); + if (lfb_event_get_end_reason (event) == LFB_EVENT_END_REASON_NOT_FOUND) + g_print ("No feedback found for '%s' at level '%s'\n", name, lfb_get_feedback_profile ()); + return success; }