From: pr.jung Date: Tue, 8 Mar 2016 07:01:36 +0000 (+0900) Subject: Differentiate vibrator Not Supported and Access Denied errors X-Git-Tag: submit/tizen/20160308.074412^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0b10f1b03e7ca3257290d731baf44eec70929e03;p=platform%2Fcore%2Fsystem%2Flibsvi.git Differentiate vibrator Not Supported and Access Denied errors Change-Id: I47405c0973b7965c86e69bb60070328c98fdc4ed Signed-off-by: pr.jung --- diff --git a/src/vibrator.c b/src/vibrator.c index f02a575..a2c6f3a 100644 --- a/src/vibrator.c +++ b/src/vibrator.c @@ -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;