Revert "haptic: Do not check handle value on emulator" 94/106294/1
authorJung <pr.jung@samsung.com>
Wed, 21 Dec 2016 08:31:36 +0000 (00:31 -0800)
committerJung <pr.jung@samsung.com>
Wed, 21 Dec 2016 08:31:36 +0000 (00:31 -0800)
This reverts commit c070415ffb2959cf508cfdb7857a528498b13e2e.

Change-Id: I13f4346f3d3728ebda8f4e051599b80ac967d0a6

src/common.c
src/common.h
src/haptic.c

index 40e8516..4936577 100644 (file)
@@ -17,8 +17,6 @@
 #include <stdio.h>
 #include <string.h>
 #include <errno.h>
-#include <stdlib.h>
-#include <system_info.h>
 #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;
-}
index e1bdcc6..1f8a96c 100644 (file)
@@ -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__ */
index 2d80445..2fcf096 100644 (file)
@@ -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);