+++ /dev/null
-/*
- * feedbackd
- *
- * Copyright (c) 2016 - 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#include <stdio.h>
-#include <fcntl.h>
-#include <glib.h>
-#include <sys/reboot.h>
-
-#include <system_info.h>
-#include <systemd/sd-daemon.h>
-#include <libsyscommon/dbus-system.h>
-
-#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)
-{
- _D("Received SIGTERM signal(%d)", signo);
-}
-
-static void sig_usr1(int signo)
-{
- _D("Received SIGUSR1 signal(%d), feedbackd'll be finished.", signo);
-
- if (mainloop) {
- if (g_main_loop_is_running(mainloop))
- g_main_loop_quit(mainloop);
- }
-}
-
-static void dbus_name_acquired(GDBusConnection *connection, const gchar *name, gpointer user_data)
-{
- _I("sd_notify(READY=1)");
- sd_notify(0, "READY=1");
-}
-
-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.");
- sd_notify(0, "READY=1");
- return 0;
- }
-
- mainloop = g_main_loop_new(NULL, FALSE);
-
- handle = dbus_handle_get_connection(G_BUS_TYPE_SYSTEM, FALSE);
- if (!handle)
- _E("Failed to get dbus connection.");;
-
- ret = haptic_probe();
- if (ret != 0) {
- _E("'Haptic' probe fail.");
- g_main_loop_unref(mainloop);
- return ret;
- }
- haptic_init();
-
- ret = dbus_handle_request_bus_name(handle, VIBRATOR_BUS_NAME, dbus_name_acquired, NULL);
- if (ret <= 0) {
- _E("Failed to request bus name.");
- dbus_handle_check_owner_name(NULL, VIBRATOR_BUS_NAME);
- }
-
- signal(SIGTERM, sig_quit);
- signal(SIGUSR1, sig_usr1);
-
- /* g_main_loop */
- g_main_loop_run(mainloop);
-
- _D("'Haptic' deinitialize.");
- haptic_exit();
-
- if (mainloop) {
- g_main_loop_unref(mainloop);
- mainloop = NULL;
- }
-
- return 0;
-}
--- /dev/null
+/*
+ * feedbackd
+ *
+ * Copyright (c) 2016 - 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <stdio.h>
+#include <fcntl.h>
+#include <glib.h>
+#include <sys/reboot.h>
+
+#include <system_info.h>
+#include <systemd/sd-daemon.h>
+#include <libsyscommon/dbus-system.h>
+
+#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)
+{
+ _D("Received SIGTERM signal(%d)", signo);
+}
+
+static void sig_usr1(int signo)
+{
+ _D("Received SIGUSR1 signal(%d), feedbackd'll be finished.", signo);
+
+ if (mainloop) {
+ if (g_main_loop_is_running(mainloop))
+ g_main_loop_quit(mainloop);
+ }
+}
+
+static void dbus_name_acquired(GDBusConnection *connection, const gchar *name, gpointer user_data)
+{
+ _I("sd_notify(READY=1)");
+ sd_notify(0, "READY=1");
+}
+
+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.");
+ sd_notify(0, "READY=1");
+ return 0;
+ }
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+
+ handle = dbus_handle_get_connection(G_BUS_TYPE_SYSTEM, FALSE);
+ if (!handle)
+ _E("Failed to get dbus connection.");;
+
+ ret = haptic_probe();
+ if (ret != 0) {
+ _E("'Haptic' probe fail.");
+ g_main_loop_unref(mainloop);
+ return ret;
+ }
+ haptic_init();
+
+ ret = dbus_handle_request_bus_name(handle, VIBRATOR_BUS_NAME, dbus_name_acquired, NULL);
+ if (ret <= 0) {
+ _E("Failed to request bus name.");
+ dbus_handle_check_owner_name(NULL, VIBRATOR_BUS_NAME);
+ }
+
+ signal(SIGTERM, sig_quit);
+ signal(SIGUSR1, sig_usr1);
+
+ /* g_main_loop */
+ g_main_loop_run(mainloop);
+
+ _D("'Haptic' deinitialize.");
+ haptic_exit();
+
+ if (mainloop) {
+ g_main_loop_unref(mainloop);
+ mainloop = NULL;
+ }
+
+ return 0;
+}