From a98c21f96f087cf4fc00d00e8f17a352d78d5fa0 Mon Sep 17 00:00:00 2001 From: "jy910.yun" Date: Fri, 7 Jun 2013 16:10:54 +0900 Subject: [PATCH] revise the bug about getting device status before changing, system-server pass wrong parameter to get_status function Change-Id: I14613d0995b0e7def173079674a24c86afb8322e Signed-off-by: jy910.yun --- src/deviced/haptic-module.h | 4 ++-- src/haptic/haptic.c | 9 ++++----- src/shared/haptic.c | 8 ++++---- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/deviced/haptic-module.h b/src/deviced/haptic-module.h index 06f1e8a..5f2e4fb 100644 --- a/src/deviced/haptic-module.h +++ b/src/deviced/haptic-module.h @@ -64,8 +64,8 @@ typedef enum */ typedef enum { - HAPTIC_MODULE_STATE_PLAYING = 0, - HAPTIC_MODULE_STATE_STOP, + HAPTIC_MODULE_STATE_STOP = 0, + HAPTIC_MODULE_STATE_PLAYING, } haptic_module_state; /* Error and Return value codes */ diff --git a/src/haptic/haptic.c b/src/haptic/haptic.c index 961233c..cb5f9a6 100644 --- a/src/haptic/haptic.c +++ b/src/haptic/haptic.c @@ -241,8 +241,7 @@ static DBusMessage *edbus_get_state(E_DBus_Object *obj, DBusMessage *msg) DBusMessageIter iter; DBusMessage *reply; DBusError err; - unsigned int handle; - int state, ret; + int index, state, ret; if (!plugin_intf || !plugin_intf->get_device_state) { ret = -EFAULT; @@ -250,12 +249,12 @@ static DBusMessage *edbus_get_state(E_DBus_Object *obj, DBusMessage *msg) } dbus_error_init(&err); - if (!dbus_message_get_args(msg, &err, DBUS_TYPE_UINT32, &handle, DBUS_TYPE_INVALID)) { + if (!dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID)) { ret = -EINVAL; goto exit; } - ret = plugin_intf->get_device_state(handle, &state); + ret = plugin_intf->get_device_state(index, &state); if (ret < 0) _E("fail to get device state : %d", ret); else @@ -454,7 +453,7 @@ static struct edbus_method { { "StopDevice", "u", "i", edbus_stop_device }, { "VibrateMonotone", "uiii", "i", edbus_vibrate_monotone }, { "VibrateBuffer", "uayiii", "i", edbus_vibrate_buffer }, - { "GetState", "u", "i", edbus_get_state }, + { "GetState", "i", "i", edbus_get_state }, { "GetDuration", "uay", "i", edbus_get_duration }, { "CreateEffect", "iayi", "ayi", edbus_create_effect }, { "SaveBinary", "sis", "i", edbus_save_binary }, diff --git a/src/shared/haptic.c b/src/shared/haptic.c index 6360a0e..af44a58 100644 --- a/src/shared/haptic.c +++ b/src/shared/haptic.c @@ -583,7 +583,7 @@ API int haptic_get_effect_state(haptic_device_h device_handle, haptic_effect_h e { DBusError err; DBusMessage *msg; - char str_handle[32]; + char str_index[32]; char *arr[1]; int ret, ret_val; @@ -603,12 +603,12 @@ API int haptic_get_effect_state(haptic_device_h device_handle, haptic_effect_h e return HAPTIC_ERROR_INVALID_PARAMETER; } - snprintf(str_handle, sizeof(str_handle), "%u", device_handle); - arr[0] = str_handle; + snprintf(str_index, sizeof(str_index), "%d", HAPTIC_DEVICE_0); + arr[0] = str_index; /* request to deviced to open haptic device */ msg = deviced_dbus_method_sync(BUS_NAME, DEVICED_PATH_HAPTIC, DEVICED_INTERFACE_HAPTIC, - METHOD_GET_STATE, "u", arr); + METHOD_GET_STATE, "i", arr); if (!msg) return HAPTIC_ERROR_OPERATION_FAILED; -- 2.7.4