From 979938abbaa6fe670fb714f5976dafe972bc545a Mon Sep 17 00:00:00 2001 From: Yunmi Ha Date: Tue, 31 Mar 2020 15:18:57 +0900 Subject: [PATCH] Check vibration feature before the running - If vibration feature is false, feedbackd will not be run. Change-Id: I6c8234c5a93bb65167b01a7257d9e16ae0f4ac8c Signed-off-by: Yunmi Ha --- src/core/main.c | 16 ++++++++++++++-- systemd/feedbackd.service | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/core/main.c b/src/core/main.c index 03d1169..be0d5db 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -19,15 +19,19 @@ #include #include -#include #include -#include +#include + +#include #include +#include #include "core/log.h" #include "core/common.h" #include "haptic/haptic.h" +#define VIBRATION_FEATURE "http://tizen.org/feature/feedback.vibration" + static GMainLoop *mainloop = NULL; static void sig_quit(int signo) @@ -55,6 +59,13 @@ int main(int argc, char **argv) { int ret; dbus_handle_h handle = NULL; + bool haptic_avail = false; + + ret = system_info_get_platform_bool(VIBRATION_FEATURE, &haptic_avail); + if ((ret < 0) || !haptic_avail) { + _I("Vibration feature is not supported."); + return 0; + } mainloop = g_main_loop_new(NULL, FALSE); @@ -65,6 +76,7 @@ int main(int argc, char **argv) ret = haptic_probe(); if (ret != 0) { _E("'Haptic' probe fail."); + g_main_loop_unref(mainloop); return ret; } haptic_init(); diff --git a/systemd/feedbackd.service b/systemd/feedbackd.service index 50399c5..7b381da 100644 --- a/systemd/feedbackd.service +++ b/systemd/feedbackd.service @@ -5,7 +5,7 @@ Description=System Vibrator Daemon Type=notify SmackProcessLabel=System ExecStart=/usr/bin/feedbackd -Restart=always +Restart=on-failure RestartSec=0 KillSignal=SIGUSR1 CapabilityBoundingSet=~CAP_MAC_ADMIN -- 2.7.4