auto-test: Add auto-test for feedbackd 09/169709/7
authorpr.jung <pr.jung@samsung.com>
Thu, 8 Feb 2018 11:29:59 +0000 (20:29 +0900)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Mon, 12 Feb 2018 04:45:20 +0000 (04:45 +0000)
Change-Id: Iee10703dc89bb94ecffc37424be259552c537f86
Signed-off-by: pr.jung <pr.jung@samsung.com>
CMakeLists.txt
packaging/feedbackd.spec
src/auto-test/CMakeLists.txt [new file with mode: 0644]
src/auto-test/haptic.c [new file with mode: 0755]
src/auto-test/main.c [new file with mode: 0644]
src/auto-test/result.c [new file with mode: 0644]
src/auto-test/test.c [new file with mode: 0644]
src/auto-test/test.h [new file with mode: 0644]
src/core/dbus.h
src/haptic/haptic.c
src/haptic/standard.c

index a509c75..55c3880 100644 (file)
@@ -72,3 +72,5 @@ INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/systemd/ DESTINATION lib/systemd/system
 INSTALL(FILES ${CMAKE_SOURCE_DIR}/systemd/org.tizen.system.vibrator.service DESTINATION /usr/share/dbus-1/system-services)
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/haptic/conf/haptic-level3.conf DESTINATION /etc/feedbackd)
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/haptic/conf/haptic-level6.conf DESTINATION /etc/feedbackd)
+
+ADD_SUBDIRECTORY(src/auto-test)
index b74c9f6..fbffb0d 100644 (file)
@@ -108,6 +108,13 @@ Conflicts: %{name}-conf-level3
 %description conf-level6
 Feedbackd configuration file.
 
+%package auto-test
+Summary:  Feedbackd auto test tool
+Group:    System/Utilities
+%description auto-test
+Feedbackd helper programs.
+This package can be installed optional for auto dbus test.
+
 %prep
 %setup -q
 
@@ -321,3 +328,7 @@ mv %{_sysconfdir}/feedbackd/haptic-level6.conf %{_sysconfdir}/feedbackd/haptic.c
 %manifest %{name}.manifest
 %config %{_sysconfdir}/feedbackd/haptic-level6.conf
 
+%files auto-test
+%license LICENSE
+%manifest %{name}.manifest
+%{_bindir}/feedbackd-auto-test
diff --git a/src/auto-test/CMakeLists.txt b/src/auto-test/CMakeLists.txt
new file mode 100644 (file)
index 0000000..5e40bd7
--- /dev/null
@@ -0,0 +1,28 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(feedbackd-auto-test C)
+
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src)
+
+SET(SRCS
+       test.c
+       main.c
+       result.c
+       ../core/dbus.c
+       haptic.c
+)
+
+INCLUDE(FindPkgConfig)
+
+FOREACH(flag ${pkgs_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Werror")
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g -fno-omit-frame-pointer -finstrument-functions")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -lrt -fPIE")
+SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
+
+ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs2_LDFLAGS} "-ldl" "-lm")
+
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
diff --git a/src/auto-test/haptic.c b/src/auto-test/haptic.c
new file mode 100755 (executable)
index 0000000..7171d38
--- /dev/null
@@ -0,0 +1,327 @@
+/*
+ * feedbackd auto-test
+ *
+ * Copyright (c) 2018 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 requhapticed 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 "test.h"
+
+#define METHOD_HAPTIC_GETCOUNT         "GetCount"
+#define METHOD_HAPTIC_OPENDEVICE       "OpenDevice"
+#define METHOD_HAPTIC_CLOSEDEVICE      "CloseDevice"
+#define METHOD_HAPTIC_STOPDEVICE       "StopDevice"
+#define METHOD_HAPTIC_VIBRATEMONOTONE  "VibrateMonotone"
+#define METHOD_HAPTIC_VIBRATEEFFECT    "VibrateEffect"
+#define METHOD_HAPTIC_GETSTATE         "GetState"
+#define METHOD_HAPTIC_SHOWHANDLELIST   "ShowHandleList"
+#define METHOD_HAPTIC_ISSUPPORTED      "IsSupported"
+
+static bool request_haptic_method(const char *method, GVariant *param)
+{
+       GVariant *msg;
+       int val;
+       bool ret = FALSE;
+
+       msg = dbus_method_sync_with_reply_var(VIBRATOR_BUS_NAME,
+               VIBRATOR_PATH_HAPTIC,
+               VIBRATOR_INTERFACE_HAPTIC,
+               method, param);
+
+       if (!msg) {
+               _E("fail (%s): no reply", method);
+               return ret;
+       }
+
+       if (!dh_get_param_from_var(msg, "(i)", &val))
+               _E("fail (%s): no message", method);
+       else {
+               if ((val == -ENOTSUP) || (val == -ENOSYS)) {
+                       _I("Not supported feature! (%s): %d", method, val);
+                       ret = TRUE;
+               } else if (val == -ENODEV) {
+                       _E("fail (%s): device open fail (%d)", method, val);
+               } else if (val < 0) {
+                       _E("fail (%s): returned fail (%d)", method, val);
+               } else {
+                       _I("success (%s): %d", method, val);
+                       ret = TRUE;
+               }
+       }
+
+       g_variant_unref(msg);
+       return ret;
+}
+
+static bool haptic_getcount()
+{
+       _D("----------------------------------------------------------------------------------");
+       return request_haptic_method(METHOD_HAPTIC_GETCOUNT, NULL);
+}
+
+static bool haptic_opendevice(int index)
+{
+       _D("----------------------------------------------------------------------------------");
+       return request_haptic_method(METHOD_HAPTIC_OPENDEVICE, g_variant_new("(i)", index));
+}
+
+static bool haptic_closedevice()
+{
+       GVariant *msg;
+       int handle;
+       bool ret = FALSE;
+
+       _D("----------------------------------------------------------------------------------");
+       msg = dbus_method_sync_with_reply_var(VIBRATOR_BUS_NAME,
+               VIBRATOR_PATH_HAPTIC,
+               VIBRATOR_INTERFACE_HAPTIC,
+               METHOD_HAPTIC_OPENDEVICE,
+               g_variant_new("(i)", 0));
+
+       if (!msg) {
+               _E("fail (%s): no reply", METHOD_HAPTIC_OPENDEVICE);
+               return ret;
+       }
+
+       if (!dh_get_param_from_var(msg, "(i)", &handle)) {
+               _E("fail (%s): no message", METHOD_HAPTIC_OPENDEVICE);
+               return ret;
+       }
+       g_variant_unref(msg);
+
+       return request_haptic_method(METHOD_HAPTIC_CLOSEDEVICE, g_variant_new("(u)", handle));
+}
+
+static bool haptic_vibratemonotone(int duration, int level, int priority)
+{
+       GVariant *msg;
+       int handle;
+       bool ret = FALSE;
+
+       _D("----------------------------------------------------------------------------------");
+       msg = dbus_method_sync_with_reply_var(VIBRATOR_BUS_NAME,
+               VIBRATOR_PATH_HAPTIC,
+               VIBRATOR_INTERFACE_HAPTIC,
+               METHOD_HAPTIC_OPENDEVICE,
+               g_variant_new("(i)", 0));
+
+       if (!msg) {
+               _E("fail (%s): no reply", METHOD_HAPTIC_OPENDEVICE);
+               return ret;
+       }
+
+       if (!dh_get_param_from_var(msg, "(i)", &handle)) {
+               _E("fail (%s): no message", METHOD_HAPTIC_OPENDEVICE);
+               return ret;
+       }
+       g_variant_unref(msg);
+
+       return request_haptic_method(METHOD_HAPTIC_VIBRATEMONOTONE, g_variant_new("(uiii)", handle, duration, level, priority));
+}
+
+static bool haptic_vibrateeffect(char *pattern, int level, int priority)
+{
+       GVariant *msg;
+       int handle;
+       bool ret = FALSE;
+
+       _D("----------------------------------------------------------------------------------");
+       msg = dbus_method_sync_with_reply_var(VIBRATOR_BUS_NAME,
+               VIBRATOR_PATH_HAPTIC,
+               VIBRATOR_INTERFACE_HAPTIC,
+               METHOD_HAPTIC_OPENDEVICE,
+               g_variant_new("(i)", 0));
+
+       if (!msg) {
+               _E("fail (%s): no reply", METHOD_HAPTIC_OPENDEVICE);
+               return ret;
+       }
+
+       if (!dh_get_param_from_var(msg, "(i)", &handle)) {
+               _E("fail (%s): no message", METHOD_HAPTIC_OPENDEVICE);
+               return ret;
+       }
+       g_variant_unref(msg);
+
+       return request_haptic_method(METHOD_HAPTIC_VIBRATEEFFECT, g_variant_new("(usii)", handle, pattern, level, priority));
+}
+
+static bool haptic_stopdevice()
+{
+       struct timespec time = {0,};
+       GVariant *msg;
+       int handle;
+       bool ret = FALSE;
+
+       _D("----------------------------------------------------------------------------------");
+       msg = dbus_method_sync_with_reply_var(VIBRATOR_BUS_NAME,
+               VIBRATOR_PATH_HAPTIC,
+               VIBRATOR_INTERFACE_HAPTIC,
+               METHOD_HAPTIC_OPENDEVICE,
+               g_variant_new("(i)", 0));
+
+       if (!msg) {
+               _E("fail (%s): no reply", METHOD_HAPTIC_OPENDEVICE);
+               return ret;
+       }
+
+       if (!dh_get_param_from_var(msg, "(i)", &handle)) {
+               _E("fail (%s): no message", METHOD_HAPTIC_OPENDEVICE);
+               return ret;
+       }
+       g_variant_unref(msg);
+
+       msg = dbus_method_sync_with_reply_var(VIBRATOR_BUS_NAME,
+               VIBRATOR_PATH_HAPTIC,
+               VIBRATOR_INTERFACE_HAPTIC,
+               METHOD_HAPTIC_VIBRATEMONOTONE,
+               g_variant_new("(uiii)", handle, 1000, 100, 0));
+
+       if (!msg) {
+               _E("fail (%s): no reply", METHOD_HAPTIC_VIBRATEMONOTONE);
+               return ret;
+       }
+
+       _D("sleep 300ms");
+       time.tv_nsec = 300 * NANO_SECOND_MULTIPLIER;
+       nanosleep(&time, NULL);
+       _D("wakeup");
+
+       return request_haptic_method(METHOD_HAPTIC_STOPDEVICE, g_variant_new("(u)", handle));
+}
+
+static bool haptic_getstate(int index)
+{
+       _D("----------------------------------------------------------------------------------");
+       return request_haptic_method(METHOD_HAPTIC_GETSTATE, g_variant_new("(i)", index));
+}
+
+static bool haptic_showhandlelist()
+{
+       GVariant *msg;
+
+       _D("----------------------------------------------------------------------------------");
+       msg = dbus_method_sync_with_reply_var(VIBRATOR_BUS_NAME,
+               VIBRATOR_PATH_HAPTIC,
+               VIBRATOR_INTERFACE_HAPTIC,
+               METHOD_HAPTIC_SHOWHANDLELIST,
+               NULL);
+
+       if (!msg) {
+               _E("fail (%s): no reply", METHOD_HAPTIC_OPENDEVICE);
+               return FALSE;
+       }
+       g_variant_unref(msg);
+       return TRUE;
+}
+
+static bool haptic_issupported(char *pattern)
+{
+       _D("----------------------------------------------------------------------------------");
+       return request_haptic_method(METHOD_HAPTIC_ISSUPPORTED, g_variant_new("(s)", pattern));
+}
+
+void haptic_test_all(int *success, int *fail)
+{
+       struct timespec time = {0,};
+       int s = 0;
+       int f = 0;
+
+       time.tv_sec = 1;
+
+       (haptic_getcount())                                     ? s++ : f++;
+       (haptic_opendevice(0))                                  ? s++ : f++;
+       (haptic_closedevice())                                  ? s++ : f++;
+       (haptic_stopdevice())                                   ? s++ : f++;
+       nanosleep(&time, NULL);
+       (haptic_vibratemonotone(300, 100, 0))                   ? s++ : f++;
+       nanosleep(&time, NULL);
+       (haptic_vibrateeffect("FEEDBACK_PATTERN_SIP", 100, 0))  ? s++ : f++;
+       nanosleep(&time, NULL);
+       (haptic_getstate(0))                                    ? s++ : f++;
+       (haptic_showhandlelist())                               ? s++ : f++;
+       (haptic_issupported("FEEDBACK_PATTERN_SIP"))            ? s++ : f++;
+
+
+       if (NULL != success)    *success = s;
+       if (NULL != fail)       *fail = f;
+}
+
+static void haptic_init(void *data)
+{
+       int success = 0;
+       int fail = 0;
+
+       _I("start test");
+
+       haptic_test_all(&success, &fail);
+
+       _I("Total: %d, Success: %d, Fail: %d", success+fail, success, fail);
+}
+
+static void haptic_exit(void *data)
+{
+       _I("end test");
+}
+
+static int haptic_unit(int argc, char **argv)
+{
+       struct timespec time = {0,};
+
+       if (argc < 2) {
+               int success = 0;
+               int fail = 0;
+
+               _I("start test");
+               haptic_test_all(&success, &fail);
+               _I("Total: %d, Success: %d, Fail: %d", success+fail, success, fail);
+       } else if (0 == strcasecmp(argv[1], METHOD_HAPTIC_GETCOUNT)) {
+               haptic_getcount();
+       } else if (0 == strcasecmp(argv[1], METHOD_HAPTIC_OPENDEVICE)) {
+               haptic_opendevice(atoi(argv[2]));
+       } else if (0 == strcasecmp(argv[1], METHOD_HAPTIC_CLOSEDEVICE)) {
+               haptic_closedevice();
+       } else if (0 == strcasecmp(argv[1], METHOD_HAPTIC_STOPDEVICE)) {
+               time.tv_sec = 1;
+               haptic_stopdevice();
+               nanosleep(&time, NULL);
+       } else if (0 == strcasecmp(argv[1], METHOD_HAPTIC_VIBRATEMONOTONE)) {
+               haptic_vibratemonotone(atoi(argv[2]), atoi(argv[3]), atoi(argv[4]));
+               time.tv_sec = 1 + (atoi(argv[2]) / 1000);
+               nanosleep(&time, NULL);
+       } else if (0 == strcasecmp(argv[1], METHOD_HAPTIC_VIBRATEEFFECT)) {
+               haptic_vibrateeffect(argv[2], atoi(argv[3]), atoi(argv[4]));
+               time.tv_sec = 2;
+               nanosleep(&time, NULL);
+       } else if (0 == strcasecmp(argv[1], METHOD_HAPTIC_GETSTATE)) {
+               haptic_getstate(atoi(argv[2]));
+       } else if (0 == strcasecmp(argv[1], METHOD_HAPTIC_SHOWHANDLELIST)) {
+               haptic_showhandlelist();
+       } else if (0 == strcasecmp(argv[1], METHOD_HAPTIC_ISSUPPORTED)) {
+               haptic_issupported(argv[2]);
+       } else {
+               _E("Unknown test case!!!");
+       }
+
+       return 0;
+}
+
+static const struct test_ops haptic_test_ops = {
+       .priority = TEST_PRIORITY_NORMAL,
+       .name     = "haptic",
+       .init     = haptic_init,
+       .exit    = haptic_exit,
+       .unit    = haptic_unit,
+};
+
+TEST_OPS_REGISTER(&haptic_test_ops)
diff --git a/src/auto-test/main.c b/src/auto-test/main.c
new file mode 100644 (file)
index 0000000..85148c8
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * feedbackd auto-test
+ *
+ * Copyright (c) 2018 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 "test.h"
+
+static void test_main(int argc, char **argv)
+{
+       _I("auto test all");
+       test_init((void *)NULL);
+       test_exit((void *)NULL);
+}
+
+static void unit_test(int argc, char **argv)
+{
+       const struct test_ops *ops;
+
+       ops = find_test("haptic");
+       if (!ops) {
+               _E("there is no test ops : haptic");
+               return;
+       }
+       ops->unit(argc, argv);
+}
+
+void show_usage()
+{
+       printf("Usage: deviced-auto-test [UNIT-METHOD] [OPTS]\n\n");
+       printf("Optional arguments\nIf you don't give any optional arguments, all supported modules will be tested.\n");
+       printf("All module list is as below.\nAs per profile, supported modules are different.\n");
+       printf("[UNIT-METHOD]           [OPTS]\n");
+       printf("GetCount                0\n");
+       printf("OpenDevice              0\n");
+       printf("CloseDevice             0\n");
+       printf("StopDevice              0\n");
+       printf("VibrateMonotone         duration, level, priority\n");
+       printf("VibrateEffect           pattern string, level, priority\n");
+       printf("GetState                0\n");
+       printf("ShowHandleList          0\n");
+       printf("IsSupported             pattern string\n");
+}
+
+int main(int argc, char **argv)
+{
+       if (argc == 2) {
+               if (!strncmp(argv[1], "help", strlen("help") + 1)) {
+                       show_usage();
+                       return 0;
+               }
+       }
+
+       if (argc >= 2)
+               unit_test(argc, argv);
+       else
+               test_main(argc, argv);
+
+
+       return 0;
+}
+
diff --git a/src/auto-test/result.c b/src/auto-test/result.c
new file mode 100644 (file)
index 0000000..c0f07fb
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * feedbackd auto-test
+ *
+ * Copyright (c) 2018 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 "core/log.h"
+
+#define BUF_MAX 256
+
+void _R(const char *format, ...)
+{
+       va_list args;
+       char buf[BUF_MAX];
+
+       va_start(args, format);
+       vsnprintf(buf, BUF_MAX, format, args);
+       va_end(args);
+
+       _D("%s", buf);
+}
diff --git a/src/auto-test/test.c b/src/auto-test/test.c
new file mode 100644 (file)
index 0000000..15f27be
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * feedbackd auto-test
+ *
+ * Copyright (c) 2018 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 "test.h"
+
+static dd_list *dd_head;
+
+void add_test(const struct test_ops *d)
+{
+       if (d->priority == TEST_PRIORITY_HIGH)
+               DD_LIST_PREPEND(dd_head, d);
+       else
+               DD_LIST_APPEND(dd_head, d);
+}
+
+void remove_test(const struct test_ops *d)
+{
+       DD_LIST_REMOVE(dd_head, d);
+}
+
+const struct test_ops *find_test(const char *name)
+{
+       dd_list *elem;
+       const struct test_ops *d;
+
+       DD_LIST_FOREACH(dd_head, elem, d) {
+               if (!strcasecmp(d->name, name))
+                       return d;
+       }
+       return NULL;
+}
+
+void test_init(void *data)
+{
+       dd_list *elem;
+       const struct test_ops *d;
+
+       _D("test module count(%d)", DD_LIST_LENGTH(dd_head));
+       DD_LIST_FOREACH(dd_head, elem, d) {
+               _D("[%s] initialize", d->name);
+               if (d->init)
+                       d->init(data);
+       }
+}
+
+void test_exit(void *data)
+{
+       dd_list *elem;
+       const struct test_ops *d;
+
+       DD_LIST_FOREACH(dd_head, elem, d) {
+               _D("[%s] deinitialize", d->name);
+               if (d->exit)
+                       d->exit(data);
+       }
+}
diff --git a/src/auto-test/test.h b/src/auto-test/test.h
new file mode 100644 (file)
index 0000000..e5d5801
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * feedbackd auto-test
+ *
+ * Copyright (c) 2018 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.
+ */
+
+
+#ifndef __TEST_H__
+#define __TEST_H__
+#include <stdio.h>
+#include <errno.h>
+
+#include "core/list.h"
+#include "core/log.h"
+#include "core/dbus.h"
+#include "core/common.h"
+
+#ifdef ENABLE_TEST_DLOG
+#define ENABLE_DLOG
+#endif
+
+//#define LOG_TAG "AUTO_TEST"
+
+enum test_priority {
+       TEST_PRIORITY_NORMAL = 0,
+       TEST_PRIORITY_HIGH,
+};
+
+struct test_ops {
+       enum test_priority priority;
+       char *name;
+       void (*init) (void *data);
+       void (*exit) (void *data);
+       int (*start) (void);
+       int (*stop) (void);
+       int (*status) (void);
+       int (*unit) (int argc, char **argv);
+};
+
+enum test_ops_status {
+       TEST_OPS_STATUS_UNINIT,
+       TEST_OPS_STATUS_START,
+       TEST_OPS_STATUS_STOP,
+       TEST_OPS_STATUS_MAX,
+};
+
+void test_init(void *data);
+void test_exit(void *data);
+
+static inline int test_start(const struct test_ops *c)
+{
+       if (c && c->start)
+               return c->start();
+
+       return -EINVAL;
+}
+
+static inline int test_stop(const struct test_ops *c)
+{
+       if (c && c->stop)
+               return c->stop();
+
+       return -EINVAL;
+}
+
+static inline int test_get_status(const struct test_ops *c)
+{
+       if (c && c->status)
+               return c->status();
+
+       return -EINVAL;
+}
+
+#define TEST_OPS_REGISTER(c)   \
+static void __CONSTRUCTOR__ module_init(void)  \
+{      \
+       add_test(c);    \
+}      \
+static void __DESTRUCTOR__ module_exit(void)   \
+{      \
+       remove_test(c); \
+}
+void add_test(const struct test_ops *c);
+void remove_test(const struct test_ops *c);
+const struct test_ops *find_test(const char *name);
+void _R(const char *format, ...);
+#endif
index 4d35471..cca491a 100644 (file)
@@ -176,7 +176,6 @@ typedef struct {
  * @since_tizen 4.0
  */
 typedef struct {
-       dbus_object_handle_h oh;
        const char *name;
        const dbus_method_s *methods;
        int nr_methods;
index 231e374..e1a64e6 100644 (file)
@@ -829,7 +829,6 @@ static const dbus_method_s hdbus_methods[] = {
 };
 
 static const dbus_interface_u dbus_interface = {
-       .oh = NULL,
        .name = VIBRATOR_INTERFACE_HAPTIC,
        .methods = hdbus_methods,
        .nr_methods = ARRAY_SIZE(hdbus_methods),
index 8e77b20..39f6866 100644 (file)
@@ -601,6 +601,8 @@ static int stop_device(int device_handle)
        r = ff_stop(ff_fd, &info->effect);
        if (r < 0)
                _E("failed to stop effect(id:%d) : %d", info->effect.id, r);
+       else
+               _D("succeed to stop effect");
 
        /* unregister existing timer */
        if (r >= 0 && info->timer) {