From 0b10f1b03e7ca3257290d731baf44eec70929e03 Mon Sep 17 00:00:00 2001 From: "pr.jung" Date: Tue, 8 Mar 2016 16:01:36 +0900 Subject: [PATCH] Differentiate vibrator Not Supported and Access Denied errors Change-Id: I47405c0973b7965c86e69bb60070328c98fdc4ed Signed-off-by: pr.jung --- src/vibrator.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) 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; -- 2.34.1