From f85c5a45077beddf3bfe9da2d82397864aa7c371 Mon Sep 17 00:00:00 2001 From: Jung Date: Wed, 21 Dec 2016 00:31:36 -0800 Subject: [PATCH] Revert "haptic: Do not check handle value on emulator" This reverts commit c070415ffb2959cf508cfdb7857a528498b13e2e. Change-Id: I13f4346f3d3728ebda8f4e051599b80ac967d0a6 --- src/common.c | 30 ------------------------------ src/common.h | 2 -- src/haptic.c | 31 ++++++++++++------------------- 3 files changed, 12 insertions(+), 51 deletions(-) diff --git a/src/common.c b/src/common.c index 40e8516..4936577 100644 --- a/src/common.c +++ b/src/common.c @@ -17,8 +17,6 @@ #include #include #include -#include -#include #include "common.h" #define MAX_LINE 128 @@ -27,9 +25,6 @@ #define NEWLINE "\n\r" #define COMMENT '#' -#define MODEL_NAME "http://tizen.org/system/model_name" -#define MODEL_EMULATOR "Emulator" - static inline char *trim_str(char *s) { char *t; @@ -131,28 +126,3 @@ error: _E("Failed to read %s:%d!", file_name, lineno); return ret; } - -bool is_emulator(void) -{ - int ret; - char *model_name = NULL; - static bool emul = false; - static int set = 0; - - if (set) - return emul; - - ret = system_info_get_platform_string(MODEL_NAME, &model_name); - if (ret < 0) { - _E("Cannot get model name(%d)", ret); - return emul; - } - - if (!strncmp(MODEL_EMULATOR, model_name, strlen(model_name) + 1)) - emul = true; - - set = 1; - free(model_name); - - return emul; -} diff --git a/src/common.h b/src/common.h index e1bdcc6..1f8a96c 100644 --- a/src/common.h +++ b/src/common.h @@ -66,6 +66,4 @@ int config_parse(const char *file_name, int cb(struct parse_result *result, void *data), void *user_data); -bool is_emulator(void); - #endif /* __COMMON_H__ */ diff --git a/src/haptic.c b/src/haptic.c index 2d80445..2fcf096 100644 --- a/src/haptic.c +++ b/src/haptic.c @@ -127,13 +127,11 @@ int device_haptic_open(int device_index, haptic_device_h *device_handle) if (ret < 0) return errno_to_device_error(ret); //LCOV_EXCL_LINE System Error - if (!is_emulator()) { - DD_LIST_FOREACH(handle_list, elem, temp) { - if (temp->handle == ret) { - found = true; - temp->index = device_index; - break; - } + DD_LIST_FOREACH(handle_list, elem, temp) { + if (temp->handle == ret) { + found = true; + temp->index = device_index; + break; } } @@ -144,7 +142,6 @@ int device_haptic_open(int device_index, haptic_device_h *device_handle) DD_LIST_APPEND(handle_list, handle); *device_handle = (haptic_device_h)handle; } - if (DD_LIST_LENGTH(handle_list) == 1) { ret = register_signal_handler(); if (ret < 0) @@ -167,19 +164,15 @@ int device_haptic_close(haptic_device_h device_handle) if (!device_handle) return DEVICE_ERROR_INVALID_PARAMETER; - if (!is_emulator()) { - - DD_LIST_FOREACH(handle_list, elem, temp) { - if (temp->handle != handle->handle) - continue; - found = true; - break; - } - - if (!found) - return DEVICE_ERROR_OPERATION_FAILED; + DD_LIST_FOREACH(handle_list, elem, temp) { + if (temp->handle != handle->handle) + continue; + found = true; + break; } + if (!found) + return DEVICE_ERROR_OPERATION_FAILED; DD_LIST_REMOVE(handle_list, handle); snprintf(str_handle, sizeof(str_handle), "%u", (unsigned int)handle->handle); free(handle); -- 2.7.4