- Remove system error, not used function, not supported feature and logs.
- Drops the exclusion reason for Logs
Change-Id: I185107755c5717ee5a3dde91e1943a0b8517c3a4
Signed-off-by: pr.jung <pr.jung@samsung.com>
conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
if (!conn) {
- _E("dbus_bus_get error");
+ _E("dbus_bus_get error"); //LCOV_EXCL_LINE
return -EPERM;
}
msg = dbus_message_new_method_call(dest, path, interface, method);
if (!msg) {
- _E("dbus_message_new_method_call(%s:%s-%s)",
+ _E("dbus_message_new_method_call(%s:%s-%s)", //LCOV_EXCL_LINE
path, interface, method);
return -EBADMSG;
}
dbus_message_iter_init_append(msg, &iter);
ret = append_variant(&iter, sig, param);
if (ret < 0) {
- _E("append_variant error(%d) %s %s:%s-%s",
+ _E("append_variant error(%d) %s %s:%s-%s", //LCOV_EXCL_LINE
ret, dest, path, interface, method);
dbus_message_unref(msg);
return ret;
reply = dbus_connection_send_with_reply_and_block(conn, msg, DBUS_REPLY_TIMEOUT, &err);
dbus_message_unref(msg);
if (!reply) {
- _E("dbus_connection_send error(%s:%s) %s %s:%s-%s",
+ _E("dbus_connection_send error(%s:%s) %s %s:%s-%s", //LCOV_EXCL_LINE
err.name, err.message, dest, path, interface, method);
- dbus_error_free(&err);
+ dbus_error_free(&err); //LCOV_EXCL_LINE System Error
return -ECOMM;
}
ret = dbus_message_get_args(reply, &err, DBUS_TYPE_INT32, &result, DBUS_TYPE_INVALID);
dbus_message_unref(reply);
if (!ret) {
- _E("no message : [%s:%s] %s %s:%s-%s",
+ _E("no message : [%s:%s] %s %s:%s-%s", //LCOV_EXCL_LINE
err.name, err.message, dest, path, interface, method);
- dbus_error_free(&err);
+ dbus_error_free(&err); //LCOV_EXCL_LINE System Error
return -ENOMSG;
}
{
pthread_mutex_lock(&fmutex);
if (!profile) {
- _E("there is no valid profile module.");
+ _E("there is no valid profile module."); //LCOV_EXCL_LINE
pthread_mutex_unlock(&fmutex);
return FEEDBACK_ERROR_NOT_SUPPORTED;
}
/* check initialize */
pthread_mutex_lock(&fmutex);
if (!init_cnt) {
- _E("Not initialized");
+ _E("Not initialized"); //LCOV_EXCL_LINE
pthread_mutex_unlock(&fmutex);
return FEEDBACK_ERROR_NOT_INITIALIZED;
}
if (profile->get_switched_pattern) {
result = profile->get_switched_pattern(pattern, &switched);
if (result) {
- _W("pattern is changed : (%s) -> (%s)",
+ _W("pattern is changed : (%s) -> (%s)", //LCOV_EXCL_LINE
profile->str_pattern[pattern], profile->str_pattern[switched]);
pattern = switched;
}
/* check initialize */
pthread_mutex_lock(&fmutex);
if (!init_cnt) {
- _E("Not initialized");
+ _E("Not initialized"); //LCOV_EXCL_LINE
pthread_mutex_unlock(&fmutex);
return FEEDBACK_ERROR_NOT_INITIALIZED;
}
if (profile->get_switched_pattern) {
result = profile->get_switched_pattern(pattern, &switched);
if (result) {
- _W("pattern is changed : (%s) -> (%s)",
+ _W("pattern is changed : (%s) -> (%s)", //LCOV_EXCL_LINE
profile->str_pattern[pattern], profile->str_pattern[switched]);
pattern = switched;
}
/* play proper device */
dev = find_device(type);
if (!dev) {
- _E("Not supported device : type(%s)", profile->str_type[type]);
+ _E("Not supported device : type(%s)", profile->str_type[type]); //LCOV_EXCL_LINE
return FEEDBACK_ERROR_NOT_SUPPORTED;
}
/* check initialize */
pthread_mutex_lock(&fmutex);
if (!init_cnt) {
- _E("Not initialized");
+ _E("Not initialized"); //LCOV_EXCL_LINE
pthread_mutex_unlock(&fmutex);
return FEEDBACK_ERROR_NOT_INITIALIZED;
}
/* check initialize */
pthread_mutex_lock(&fmutex);
if (!init_cnt) {
- _E("Not initialized");
+ _E("Not initialized"); //LCOV_EXCL_LINE
pthread_mutex_unlock(&fmutex);
return FEEDBACK_ERROR_NOT_INITIALIZED;
}
if (profile->get_switched_pattern) {
result = profile->get_switched_pattern(pattern, &switched);
if (result) {
- _W("pattern is changed : (%s) -> (%s)",
+ _W("pattern is changed : (%s) -> (%s)", //LCOV_EXCL_LINE
profile->str_pattern[pattern], profile->str_pattern[switched]);
pattern = switched;
}
/* play proper device */
dev = find_device(type);
if (!dev) {
- _E("Not supported device : type(%s)", profile->str_type[type]);
+ _E("Not supported device : type(%s)", profile->str_type[type]); //LCOV_EXCL_LINE
return FEEDBACK_ERROR_NOT_SUPPORTED;
}
err = dev->is_supported(pattern, &supported);
if (err == -ENOTSUP)
- return FEEDBACK_ERROR_NOT_SUPPORTED;
+ return FEEDBACK_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE System Error
else if (err == -ECOMM || err == -EACCES)
- return FEEDBACK_ERROR_PERMISSION_DENIED;
+ return FEEDBACK_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE System Error
else if (err < 0) {
- _E("fail to invoke is_supported() : pattern(%s)", profile->str_pattern[pattern]);
+ _E("fail to invoke is_supported() : pattern(%s)", profile->str_pattern[pattern]); //LCOV_EXCL_LINE
return FEEDBACK_ERROR_OPERATION_FAILED;
}
return FEEDBACK_ERROR_NONE;
}
+//LCOV_EXCL_START Internal APIs. TODO Will make iUTC
/* Internal APIs */
API int feedback_play_type_by_name(char *type, char *pattern)
{
return FEEDBACK_ERROR_NONE;
}
+//LCOV_EXCL_STOP
/* open conf file */
f = fopen(file_name, "r");
if (!f) {
- _E("Failed to open file %s", file_name);
+ _E("Failed to open file %s", file_name); //LCOV_EXCL_LINE
ret = -EIO;
goto error;
}
error:
if (f)
fclose(f);
- _E("Failed to read %s:%d!", file_name, lineno);
+ _E("Failed to read %s:%d!", file_name, lineno); //LCOV_EXCL_LINE
return ret;
}
info->data[i].origin = strdup(value);
if (!info->data[i].origin)
- _E("fail to copy %s sound data",
+ _E("fail to copy %s sound data", //LCOV_EXCL_LINE
profile->str_pattern[i]);
break;
}
info->data = calloc(1,
sizeof(struct feedback_data) * profile->max_pattern);
if (!info->data) {
- _E("fail to allocate %s data", path);
- return -ENOMEM;
+ _E("fail to allocate %s data", path); //LCOV_EXCL_LINE
+ return -ENOMEM; //LCOV_EXCL_LINE System Error
}
ret = config_parse(path, load_config, info);
if (ret < 0)
- _E("Failed to load %s, %d Use default value!",
+ _E("Failed to load %s, %d Use default value!", //LCOV_EXCL_LINE
path, ret);
return ret;
return keytone_sndstatus;
}
+//LCOV_EXCL_START Not called Callback
static void feedback_touch_sndstatus_cb(keynode_t *key, void* data)
{
touch_sndstatus = vconf_keynode_get_bool(key);
{
keytone_sndstatus = vconf_keynode_get_bool(key);
}
+//LCOV_EXCL_STOP
static void sound_init(void)
{
/* check sound status */
if (vconf_get_bool(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, &touch_sndstatus) < 0)
- _W("VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL ==> FAIL!!");
+ _W("VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL ==> FAIL!!"); //LCOV_EXCL_LINE
if (vconf_get_bool(VCONFKEY_SETAPPL_BUTTON_SOUNDS_BOOL, &keytone_sndstatus) < 0)
- _W("VCONFKEY_SETAPPL_BUTTON_SOUNDS_BOOL ==> FAIL!!");
+ _W("VCONFKEY_SETAPPL_BUTTON_SOUNDS_BOOL ==> FAIL!!"); //LCOV_EXCL_LINE
if (vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &sndstatus) < 0) {
- _D("fail to get sound status, will work as turning off");
+ _D("fail to get sound status, will work as turning off"); //LCOV_EXCL_LINE
sndstatus = 0;
}
int level;
if (vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &sndstatus) < 0) {
- _D("fail to get sound status, will work as turning off");
+ _D("fail to get sound status, will work as turning off"); //LCOV_EXCL_LINE
sndstatus = 0;
}
if (sndstatus == 0 && profile->get_always_alert_case &&
!profile->get_always_alert_case(FEEDBACK_TYPE_SOUND, pattern)) {
- _D("Sound condition is OFF (sndstatus : %d)", sndstatus);
+ _D("Sound condition is OFF (sndstatus : %d)", sndstatus); //LCOV_EXCL_LINE
return 0;
}
if (sndstatus && profile->get_always_off_case &&
profile->get_always_off_case(FEEDBACK_TYPE_SOUND, pattern)) {
- _D("Sound always off condition");
+ _D("Sound always off condition"); //LCOV_EXCL_LINE
return 0;
}
_D("Play success! SND filename is %s", path);
return 0;
}
- _E("mm_sound_play_keysound() returned error(%d)", ret);
+ _E("mm_sound_play_keysound() returned error(%d)", ret); //LCOV_EXCL_LINE
} while (retry--);
return -EPERM;
bool ret = true;
if (!supported) {
- _E("Invalid parameter : supported(NULL)");
+ _E("Invalid parameter : supported(NULL)"); //LCOV_EXCL_LINE
return -EINVAL;
}
return 0;
}
+//LCOV_EXCL_START Not used function-Internal APIs TODO Will make iUTC
static int sound_get_path(feedback_pattern_e pattern, char *buf, unsigned int buflen)
{
char *cur_path;
profile->str_pattern[pattern], path);
return 0;
}
+//LCOV_EXCL_STOP
static const struct device_ops sound_device_ops = {
.type = FEEDBACK_TYPE_SOUND,
"u", arr);
}
-static int haptic_vibrate_buffer(unsigned int handle,
- const unsigned char *buffer,
- int size,
- int iteration,
- int feedback,
- int priority)
-{
- char *arr[6];
- char buf_handle[32];
- char buf_iteration[32];
- char buf_feedback[32];
- char buf_priority[32];
- struct dbus_byte bytes;
-
- snprintf(buf_handle, sizeof(buf_handle), "%u", handle);
- arr[0] = buf_handle;
- bytes.size = size;
- bytes.data = buffer;
- arr[2] = (char *)&bytes;
- snprintf(buf_iteration, sizeof(buf_iteration), "%d", iteration);
- arr[3] = buf_iteration;
- snprintf(buf_feedback, sizeof(buf_feedback), "%d", feedback);
- arr[4] = buf_feedback;
- snprintf(buf_priority, sizeof(buf_priority), "%d", priority);
- arr[5] = buf_priority;
-
- return dbus_method_sync(DEVICED_BUS_NAME, DEVICED_PATH_HAPTIC,
- DEVICED_INTERFACE_HAPTIC, METHOD_VIBRATE_BUFFER,
- "uayiii", arr);
-}
-
static int haptic_vibrate_monotone(unsigned int handle,
int duration,
int feedback,
"u", arr);
}
-static unsigned char *convert_file_to_buffer(const char *file_name, int *size)
-{
- FILE *pf;
- long file_size;
- unsigned char *pdata = NULL;
-
- if (!file_name)
- return NULL;
-
- /* Get File Stream Pointer */
- pf = fopen(file_name, "rb");
- if (!pf) {
- _E("fopen failed : %d", errno);
- return NULL;
- }
-
- if (fseek(pf, 0, SEEK_END))
- goto error;
-
- file_size = ftell(pf);
- if (fseek(pf, 0, SEEK_SET))
- goto error;
-
- if (file_size < 0)
- goto error;
-
- pdata = (unsigned char *)malloc(file_size);
- if (!pdata)
- goto error;
-
- if (fread(pdata, 1, file_size, pf) != file_size)
- goto err_free;
-
- fclose(pf);
- *size = file_size;
- return pdata;
-
-err_free:
- free(pdata);
-
-error:
- fclose(pf);
-
- _E("failed to convert file to buffer (%d)", errno);
- return NULL;
-}
-
static int get_priority(feedback_pattern_e pattern)
{
if (pattern >= FEEDBACK_PATTERN_TAP && pattern <= FEEDBACK_PATTERN_HW_HOLD)
/* Vibration Init */
ret = haptic_open();
if (ret == -EACCES || ret == -ECOMM || ret == -EPERM) {
- _E("haptic_open ==> FAIL!! : %d", ret);
- v_handle = -EACCES;
- return;
+ _E("haptic_open ==> FAIL!! : %d", ret); //LCOV_EXCL_LINE
+ v_handle = -EACCES; //LCOV_EXCL_LINE System Error
+ return; //LCOV_EXCL_LINE System Error
}
if (ret < 0) {
- _E("haptic_open ==> FAIL!! : %d", ret);
- v_handle = -ENOTSUP;
- return;
+ _E("haptic_open ==> FAIL!! : %d", ret); //LCOV_EXCL_LINE
+ v_handle = -ENOTSUP; //LCOV_EXCL_LINE System Error
+ return; //LCOV_EXCL_LINE System Error
}
/* Set vibration handle */
if (v_handle > 0) {
ret = haptic_close(v_handle);
if (ret < 0)
- _E("haptic_close is failed : %d", ret);
+ _E("haptic_close is failed : %d", ret); //LCOV_EXCL_LINE
v_handle = 0;
}
static int vibrator_play(feedback_pattern_e pattern)
{
struct stat buf;
- char *data;
unsigned char *pbuf;
int size;
int ret;
int duration;
if (!v_handle) {
- _E("Not initialize");
+ _E("Not initialize"); //LCOV_EXCL_LINE
return -EPERM;
}
if (v_handle == -ENOTSUP || v_handle == -EACCES) {
- _E("Not supported vibration");
- return v_handle;
+ _E("Not supported vibration"); //LCOV_EXCL_LINE
+ return v_handle; //LCOV_EXCL_LINE System Error
}
if (vconf_get_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vibstatus) < 0) {
- _D("fail to get vibration status, will work as turning off");
+ _D("fail to get vibration status, will work as turning off"); //LCOV_EXCL_LINE
vibstatus = 0;
}
if (vibstatus == 0 && profile->get_always_alert_case &&
!profile->get_always_alert_case(FEEDBACK_TYPE_VIBRATION, pattern)) {
- _D("Vibration condition is OFF (vibstatus : %d)", vibstatus);
+ _D("Vibration condition is OFF (vibstatus : %d)", vibstatus); //LCOV_EXCL_LINE
return 0;
}
if (vibstatus && profile->get_always_off_case &&
profile->get_always_off_case(FEEDBACK_TYPE_VIBRATION, pattern)) {
- _D("Vibration always off condition");
+ _D("Vibration always off condition"); //LCOV_EXCL_LINE
return 0;
}
else
level = DEFAULT_VIB_LEVEL * HAPTIC_FEEDBACK_STEP;
- /* get vibration data */
- data = get_data(pattern);
- if (!data) {
- _E("Not supported vibration pattern");
- return -ENOTSUP;
- }
-
/* if it has a file path */
- if (!stat(data, &buf)) {
- pbuf = convert_file_to_buffer(data, &size);
- if (!pbuf) {
- _E("fail to convert file to buffer");
- return -EPERM;
- }
-
- ret = haptic_vibrate_buffer(v_handle, pbuf, size,
- HAPTIC_ITERATION_ONCE,
- level, get_priority(pattern));
- free(pbuf);
- } else {
- duration = get_duration(pattern);
- ret = haptic_vibrate_monotone(v_handle, duration,
- level, get_priority(pattern));
- }
+ duration = get_duration(pattern);
+ ret = haptic_vibrate_monotone(v_handle, duration,
+ level, get_priority(pattern));
if (ret < 0) {
- _E("fail to play vibration");
+ _E("fail to play vibration"); //LCOV_EXCL_LINE
if (ret == -ECOMM)
- return ret;
+ return ret; //LCOV_EXCL_LINE System Error
return -EPERM;
}
- _D("Play success! Data is %s", data);
+ _D("Play success! Data is %d", pattern);
return 0;
}
int ret;
if (!v_handle) {
- _E("Not initialize");
+ _E("Not initialize"); //LCOV_EXCL_LINE
return -EPERM;
}
if (v_handle == -ENOTSUP || v_handle == -EACCES) {
- _E("Not supported vibration");
- return v_handle;
+ _E("Not supported vibration"); //LCOV_EXCL_LINE
+ return v_handle; //LCOV_EXCL_LINE System Error
}
/* stop haptic device */
ret = haptic_vibrate_stop(v_handle);
if (ret < 0) {
- _E("haptic_vibrate_stop is failed");
+ _E("haptic_vibrate_stop is failed"); //LCOV_EXCL_LINE
if (ret == -ECOMM)
- return ret;
+ return ret; //LCOV_EXCL_LINE System Error
return -EPERM;
}
bool ret = true;
if (!supported) {
- _E("Invalid parameter : supported(NULL)");
+ _E("Invalid parameter : supported(NULL)"); //LCOV_EXCL_LINE
return -EINVAL;
}
if (!v_handle) {
- _E("Not initialize");
+ _E("Not initialize"); //LCOV_EXCL_LINE
return -EPERM;
}
if (v_handle == -ENOTSUP || v_handle == -EACCES) {
- _E("Not supported vibration");
- *supported = false;
+ _E("Not supported vibration"); //LCOV_EXCL_LINE
+ *supported = false; //LCOV_EXCL_LINE System Error
return v_handle;
}
return 0;
}
+//LCOV_EXCL_START Not used function-Internal APIs TODO Will make iUTC
static int vibrator_get_path(feedback_pattern_e pattern, char *buf, unsigned int buflen)
{
char *data;
profile->str_pattern[pattern], path);
return 0;
}
+//LCOV_EXCL_STOP
static const struct device_ops vibrator_device_ops = {
.type = FEEDBACK_TYPE_VIBRATION,