len = strlen(str);
if (len > SYSTEM_NOTI_MAXSTR)
len = SYSTEM_NOTI_MAXSTR;
- write(fd, &len, sizeof(int));
+ ret = write(fd, &len, sizeof(int));
+ if (ret < 0)
+ _E("Failed to write (%d)", errno);
ret = write(fd, str, len);
+ if (ret < 0)
+ _E("Failed to write (%d)", errno);
}
return ret;
}
return result;
}
-static int dbus_flightmode_handler(char* type, char *buf)
-{
- DBusError err;
- DBusMessage *msg;
- char *pa[3];
- int ret, val;
-
- pa[0] = type;
- pa[1] = "1";
- pa[2] = buf;
-
- msg = dbus_method_sync_with_reply(DEVICED_BUS_NAME,
- DEVICED_PATH_POWER, DEVICED_INTERFACE_POWER,
- pa[0], "sis", pa);
- if (!msg)
- return -EBADMSG;
-
- dbus_error_init(&err);
-
- ret = dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &val, DBUS_TYPE_INVALID);
- if (!ret) {
- _E("no message : [%s:%s]", err.name, err.message);
- val = -EBADMSG;
- }
-
- dbus_message_unref(msg);
- dbus_error_free(&err);
-
- _D("%s-%s : %d", DEVICED_INTERFACE_POWER, pa[0], val);
- return val;
-}
-
API int deviced_call_predef_action(const char *type, int num, ...)
{
struct sysnoti *msg;
DBusMessageIter iter;
DBusMessage *reply;
DBusError err;
- int r;
conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
if (!conn) {
int ret;
/* check if handle is valid */
- if (device_handle == NULL) {
+ if (!device_handle) {
_E("Invalid parameter : device_handle");
return HAPTIC_ERROR_INVALID_PARAMETER;
}
int ret;
/* check if handle is valid */
- if (device_handle == NULL) {
+ if (!device_handle) {
_E("Invalid parameter : device_handle");
return HAPTIC_ERROR_INVALID_PARAMETER;
}
API int haptic_vibrate_file(haptic_device_h device_handle, const char *file_path, haptic_effect_h *effect_handle)
{
- char *vibe_buffer;
+ unsigned char *vibe_buffer;
int size, ret;
vibe_buffer = convert_file_to_buffer(file_path, &size);
}
ret = haptic_vibrate_buffers_with_detail(device_handle,
- vibe_buffer,
+ (const unsigned char *)vibe_buffer,
size,
HAPTIC_ITERATION_ONCE,
HAPTIC_FEEDBACK_AUTO,
haptic_priority_e priority,
haptic_effect_h *effect_handle)
{
- char *vibe_buffer;
+ unsigned char *vibe_buffer;
int size, ret;
vibe_buffer = convert_file_to_buffer(file_path, &size);
}
ret = haptic_vibrate_buffers_with_detail(device_handle,
- vibe_buffer,
+ (const unsigned char *)vibe_buffer,
size,
iteration,
feedback,
int ret;
/* check if handle is valid */
- if (device_handle == NULL) {
+ if (!device_handle) {
_E("Invalid parameter : device_handle");
return HAPTIC_ERROR_INVALID_PARAMETER;
}
int ret;
/* check if handle is valid */
- if (device_handle == NULL) {
+ if (!device_handle) {
_E("Invalid parameter : device_handle");
return HAPTIC_ERROR_INVALID_PARAMETER;
}
int ret;
/* check if handle is valid */
- if (device_handle == NULL) {
+ if (!device_handle) {
_E("Invalid parameter : device_handle");
return HAPTIC_ERROR_INVALID_PARAMETER;
}
const char *file_path)
{
struct stat buf;
- int size, ret;
+ int ret;
/* check if passed arguments are valid */
if (vibe_buffer == NULL) {
API int haptic_get_file_duration(haptic_device_h device_handle, const char *file_path, int *file_duration)
{
- char *vibe_buffer;
+ unsigned char *vibe_buffer;
int size, ret;
vibe_buffer = convert_file_to_buffer(file_path, &size);
}
ret = haptic_get_buffers_duration(device_handle,
- vibe_buffer,
+ (const unsigned char *)vibe_buffer,
size,
file_duration);
free(vibe_buffer);
int ret;
/* check if handle is valid */
- if (device_handle == NULL) {
+ if (!device_handle) {
_E("Invalid parameter : device_handle");
return HAPTIC_ERROR_INVALID_PARAMETER;
}
API int haptic_save_led(const unsigned char *vibe_buffer, int max_bufsize, const char *file_path)
{
struct stat buf;
- char str_bufsize[32];
char *arr[3];
struct dbus_byte bytes;
int ret;
#define EXT_PARENT_PATH "/opt/storage"
#define EXT_OPTION1_PATH "/mnt/mmc"
-static bool check_ext_mount(void)
-{
- struct stat parent, ext;
-
- if (stat(EXT_PATH, &ext) != 0 || stat(EXT_PARENT_PATH, &parent) != 0)
- return false;
-
- if (ext.st_dev == parent.st_dev)
- return false;
-
- return true;
-}
-
-API int storage_get_path(int type, unsigned char *path, int size)
+API int storage_get_path(int type, char *path, int size)
{
char *ext_path = EXT_PATH;
- int option;
if (type < 0 || type > STORAGE_MAX || !path)
return -EINVAL;