4 * Copyright (c) 2016 - 2017 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the License);
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
22 #include <sys/reboot.h>
24 #include <libgdbus/dbus-system.h>
27 #include "core/common.h"
28 #include "haptic/haptic.h"
30 static GMainLoop *mainloop = NULL;
32 static void sig_quit(int signo)
34 _D("received SIGTERM signal %d", signo);
37 static void sig_usr1(int signo)
39 _D("received SIGUSR1 signal %d, feedbackd'll be finished!", signo);
42 if (g_main_loop_is_running(mainloop))
43 g_main_loop_quit(mainloop);
48 int main(int argc, char **argv)
52 mainloop = g_main_loop_new(NULL, FALSE);
54 if (!dbus_handle_init(G_BUS_TYPE_SYSTEM, VIBRATOR_BUS_NAME, NULL, NULL)) {
55 _E("failed to init dbus connection");
60 _E("[haptic] probe fail");
65 signal(SIGTERM, sig_quit);
66 signal(SIGUSR1, sig_usr1);
69 g_main_loop_run(mainloop);
71 _D("[haptic] deinitialize");
73 g_main_loop_unref(mainloop);