Differentiate vibrator Not Supported and Access Denied errors 78/61478/1 accepted/tizen/common/20160308.143404 accepted/tizen/ivi/20160308.102626 accepted/tizen/mobile/20160308.102529 accepted/tizen/tv/20160308.102545 accepted/tizen/wearable/20160308.102605 submit/tizen/20160308.074412
authorpr.jung <pr.jung@samsung.com>
Tue, 8 Mar 2016 07:01:36 +0000 (16:01 +0900)
committerpr.jung <pr.jung@samsung.com>
Tue, 8 Mar 2016 07:01:36 +0000 (16:01 +0900)
Change-Id: I47405c0973b7965c86e69bb60070328c98fdc4ed
Signed-off-by: pr.jung <pr.jung@samsung.com>
src/vibrator.c

index f02a575..a2c6f3a 100644 (file)
@@ -261,6 +261,11 @@ static void vibrator_init(void)
 
        /* Vibration Init */
        ret = haptic_open();
+       if (ret == -EACCES || ret == -ECOMM || ret == -EPERM) {
+               _E("haptic_open ==> FAIL!! : %d", ret);
+               v_handle = -EACCES;
+               return;
+       }
        if (ret < 0) {
                _E("haptic_open ==> FAIL!! : %d", ret);
                v_handle = -ENOTSUP;
@@ -304,9 +309,9 @@ static int vibrator_play(feedback_pattern_e pattern)
                return -EPERM;
        }
 
-       if (v_handle == -ENOTSUP) {
+       if (v_handle == -ENOTSUP || v_handle == -EACCES) {
                _E("Not supported vibration");
-               return -EACCES;
+               return v_handle;
        }
 
        if (vconf_get_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vibstatus) < 0) {
@@ -376,9 +381,9 @@ static int vibrator_stop(void)
                return -EPERM;
        }
 
-       if (v_handle == -ENOTSUP) {
+       if (v_handle == -ENOTSUP || v_handle == -EACCES) {
                _E("Not supported vibration");
-               return -ENOTSUP;
+               return v_handle;
        }
 
        /* stop haptic device */
@@ -408,7 +413,7 @@ static int vibrator_is_supported(int pattern, bool *supported)
                return -EPERM;
        }
 
-       if (v_handle == -ENOTSUP) {
+       if (v_handle == -ENOTSUP || v_handle == -EACCES) {
                _E("Not supported vibration");
                *supported = false;
                return 0;