cur_bat_capacity = new_bat_capacity;
}
-
if (vconf_get_int(VCONFKEY_SYSMAN_BATTERY_STATUS_LOW, &vconf_state) < 0) {
_E("vconf_get_int() failed");
return -1;
return 0;
}
-int ss_lowbat_monitor(void *data)
+Eina_Bool ss_lowbat_monitor(void *data)
{
struct ss_main_data *ad = (struct ss_main_data *)data;
int bat_percent, r;
return ret;
}
-int lowbat_popup(void *data)
+static Eina_Bool lowbat_popup(void *data)
{
int ret = -1, state = 0;
ret = vconf_get_int(VCONFKEY_STARTER_SEQUENCE, &state);
if (ret < 0) {
_E("popup lauch failed");
bundle_free(b);
- return 1;
+ return EINA_TRUE;
}
lowbat_popup_id = NULL;
lowbat_popup_option = 0;
bundle_free(b);
- } else {
- _D("boot-animation running yet");
- return 1;
+ return EINA_TRUE;
}
-
- return 0;
+ _D("boot-animation running yet");
+ return EINA_FALSE;
}
int lowbat_def_predefine_action(int argc, char **argv)
else
return 0;
}
+
static void launch_crash_worker(const char *filename, int popup_on)
{
static int popup_pid = 0;
return 0;
}
-static int core_pipe_cb(void *userdata, Ecore_Fd_Handler * fd_handler)
+static Eina_Bool core_pipe_cb(void *userdata, Ecore_Fd_Handler * fd_handler)
{
struct ss_main_data *ad = (struct ss_main_data *)userdata;
struct _internal_msg p_msg;
int r = -1;
if (!ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ)) {
_E("ecore_main_fd_handler_active_get error , return");
- return 1;
+ return EINA_TRUE;
}
while (retry_count < 5) {
ss_run_queue_del_bypid(p_msg.pid);
break;
}
- return 1;
+ return EINA_TRUE;
}
int ss_core_action_run()
{ EXTCON_EARJACK, "/csa/factory/earjack_count", 0, 0},
};
-static int uevent_control_cb(void *data, Ecore_Fd_Handler *fd_handler);
+static Eina_Bool uevent_control_cb(void *data, Ecore_Fd_Handler *fd_handler);
extern int battery_power_off_act(void *data);
extern int battery_charge_err_act(void *data);
static int check_lowbat_charge_device(int bInserted)
snprintf(params, sizeof(params), "%d", CB_NOTI_BATT_CHARGE);
ss_launch_if_noexist("/usr/bin/sys_device_noti", params);
_D("ta device notification");
+ device_notify(DEVICE_NOTIFIER_TA, (void *)TRUE);
}
__sync_usb_status();
}
return 0;
}
-static int uevent_control_cb(void *data, Ecore_Fd_Handler *fd_handler)
+static Eina_Bool uevent_control_cb(void *data, Ecore_Fd_Handler *fd_handler)
{
struct udev_device *dev = NULL;
struct udev_list_entry *list_entry = NULL;
- char *env_name = NULL;
- char *env_value = NULL;
+ const char *env_name = NULL;
+ const char *env_value = NULL;
+ const char *devpath;
+ const char *devnode;
+ const char *action;
int ufd = -1;
int ret = -1;
+ int i, len;
if (!ecore_main_fd_handler_active_get(fd_handler,ECORE_FD_READ))
- return -1;
+ goto out;
if ((ufd = ecore_main_fd_handler_fd_get(fd_handler)) == -1)
- return -1;
+ goto out;
if ((dev = udev_monitor_receive_device(mon)) == NULL)
- return -1;
+ goto out;
env_name = udev_device_get_subsystem(dev);
if (strncmp(env_name, INPUT_SUBSYSTEM, strlen(INPUT_SUBSYSTEM)) == 0) {
char *devpath = udev_device_get_devpath(dev);
/* check new input device */
if (!fnmatch(INPUT_PATH, devpath, 0)) {
- char *action = udev_device_get_action(dev);
- char *devnode = udev_device_get_devnode(dev);
+ action = udev_device_get_action(dev);
+ devnode = udev_device_get_devnode(dev);
if (!strcmp(action, ADD))
- device_notify(DEVICE_NOTIFIER_INPUT_ADD, devnode);
+ device_notify(DEVICE_NOTIFIER_INPUT_ADD, (void *)devnode);
else if (!strcmp(action, REMOVE))
- device_notify(DEVICE_NOTIFIER_INPUT_REMOVE, devnode);
+ device_notify(DEVICE_NOTIFIER_INPUT_REMOVE, (void *)devnode);
udev_device_unref(dev);
uevent_control_stop(ufd);
uevent_control_start();
- return 0;
+ return EINA_TRUE;
}
}
if (ret != 0) {
udev_device_unref(dev);
- return -1;
+ goto out;
}
_I("UEVENT DETECTED (%s)", env_value);
udev_device_unref(dev);
uevent_control_stop(ufd);
uevent_control_start();
-
- return 0;
+out:
+ return EINA_TRUE;
}
int changed_device_def_predefine_action(int argc, char **argv)
ss_noti_add("device_pci_keyboard_add", (void *)pci_keyboard_add_cb, data);
ss_noti_add("device_pci_keyboard_remove", (void *)pci_keyboard_remove_cb, data);
- if (vconf_notify_key_changed(VCONFKEY_SYSMAN_USB_HOST_STATUS, usb_host_chgdet_cb, NULL) < 0) {
+ if (vconf_notify_key_changed(VCONFKEY_SYSMAN_USB_HOST_STATUS,
+ (void *)usb_host_chgdet_cb, NULL) < 0) {
_E("vconf key notify failed(VCONFKEY_SYSMAN_USB_HOST_STATUS)");
}
#ifndef __DEVICE_HANDLER_H__
#define __DEVICE_HANDLER_H__
+#include "data.h"
+
enum extcon_type {
EXTCON_TA = 0,
EXTCON_EARJACK,
/* Battery functions */
int ss_lowbat_is_charge_in_now();
int ss_lowbat_set_charge_on(int onoff);
-int ss_lowbat_monitor(void *data);
+Eina_Bool ss_lowbat_monitor(void *data);
int extcon_set_count(int index);
}
}
-static void device_notifier_exit(void)
+static void device_notifier_exit(void *data)
{
Eina_List *n, *next;
struct device_notifier *notifier;
enum device_notifier_type {
DEVICE_NOTIFIER_LCD,
+ DEVICE_NOTIFIER_TA,
DEVICE_NOTIFIER_INPUT_ADD,
DEVICE_NOTIFIER_INPUT_REMOVE,
DEVICE_NOTIFIER_PROCESS_TERMINATED,
{
int i;
int size;
- struct device_ops *dev;
+ const struct device_ops *dev;
size = ARRAY_SIZE(devices);
for(i = 0; i < size; ++i) {
{
int i;
int size;
- struct device_ops *dev;
+ const struct device_ops *dev;
size = ARRAY_SIZE(devices);
for(i = 0; i < size; ++i) {
void devices_init(void *data);
void devices_exit(void *data);
-static inline int device_start(struct device_ops *dev)
+static inline int device_start(const struct device_ops *dev)
{
if (dev && dev->start)
return dev->start();
return -EINVAL;
}
-static inline int device_stop(struct device_ops *dev)
+static inline int device_stop(const struct device_ops *dev)
{
if (dev && dev->stop)
return dev->stop();
return -EINVAL;
}
-static inline int device_get_status(struct device_ops *dev)
+static inline int device_get_status(const struct device_ops *dev)
{
if (dev && dev->status)
return dev->status();
{
char match[256];
int ret;
- const char *iface, *member, *watch, *arg = NULL;
+ const char *iface, *member, *arg = NULL;
+ char *watch;
Eina_List *l;
if (dbus_message_get_type(message) != DBUS_MESSAGE_TYPE_SIGNAL)
if (strcmp(arg, watch)) continue;
/* notify 'process terminated' to device notifiers */
- device_notify(DEVICE_NOTIFIER_PROCESS_TERMINATED, watch);
+ device_notify(DEVICE_NOTIFIER_PROCESS_TERMINATED, (void *)watch);
/* remove registered sender */
snprintf(match, sizeof(match), NAME_OWNER_MATCH, watch);
int register_edbus_watch(DBusMessage *msg)
{
char match[256];
- const char *sender, *watch;
+ const char *sender;
+ char *watch;
Eina_List *l;
int ret;
{
char *lang;
int ret;
- lang = vconf_get_str(VCONFKEY_LANGSET);
+
+ lang = (char *)vconf_get_str(VCONFKEY_LANGSET);
if (lang == NULL)
return -1;
ret = setenv("LANG", lang, 1);
#define EINA_LIST_REMOVE_LIST(a, b) \
a = eina_list_remove_list(a, b)
-#define EINA_LIST_FREE(a) \
+#define EINA_LIST_FREE_LIST(a) \
a = eina_list_free(a)
#endif
return true;
}
-static int sysnoti_cb(void *data, Ecore_Fd_Handler * fd_handler)
+static Eina_Bool sysnoti_cb(void *data, Ecore_Fd_Handler * fd_handler)
{
int fd;
struct sysnoti *msg;
if (!ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ)) {
_E("ecore_main_fd_handler_active_get error , return");
- return 1;
+ goto out;
}
fd = ecore_main_fd_handler_fd_get(fd_handler);
msg = malloc(sizeof(struct sysnoti));
if (msg == NULL) {
_E("Not enough memory");
- return 1;
+ goto out;
}
client_len = sizeof(client_address);
if (client_sockfd == -1) {
_E("socket accept error");
free(msg);
- return -1;
+ goto out;
}
if (read_message(client_sockfd, msg) < 0) {
_E("recv error msg");
close(client_sockfd);
__sysnoti_stop(fd);
__sysnoti_start();
- return -1;
+ goto out;
}
sync = check_sync_request(msg);
if (sync)
write(client_sockfd, &ret, sizeof(int));
close(client_sockfd);
- return -1;
+ goto out;
}
switch (msg->cmd) {
close(client_sockfd);
free_message(msg);
-
- return 1;
+out:
+ return EINA_TRUE;
}
static int ss_sysnoti_server_init(void)
if (!pid) {
for (i = 0; i < _NSIG; ++i)
signal(i, SIG_DFL);
- r = execv(argv[0], argv);
+ r = execv(argv[0], (char **)argv);
if (r == -1) {
_E("execv() error");
exit(EXIT_FAILURE);
static int kill_app_accessing_mmc(void)
{
int pid;
- char *argv[4] = {"/sbin/fuser", "-mk", MMC_MOUNT_POINT, NULL};
+ const char *argv[4] = {"/sbin/fuser", "-mk", MMC_MOUNT_POINT, NULL};
char buf[256];
int retry = 10;
mmc_mount();
}
-static void mmc_start(void)
+static int mmc_start(void)
{
mmc_disabled = false;
_D("start");
+ return 0;
}
-static void mmc_stop(void)
+static int mmc_stop(void)
{
mmc_disabled = true;
vconf_set_int(VCONFKEY_SYSMAN_MMC_STATUS, VCONFKEY_SYSMAN_MMC_REMOVED);
_D("stop");
+ return 0;
}
const struct device_ops mmc_device_ops = {
struct lowmem_process_entry {
unsigned cur_mem_state;
unsigned new_mem_state;
- int (*action) (void *);
+ Eina_Bool (*action) (void *);
};
static int lowmem_fd = -1;
Ecore_Timer *oom_timer;
#define OOM_TIMER_INTERVAL 5
-static int memory_low_act(void *ad);
-static int memory_oom_act(void *ad);
-static int memory_normal_act(void *ad);
+static Eina_Bool memory_low_act(void *ad);
+static Eina_Bool memory_oom_act(void *ad);
+static Eina_Bool memory_normal_act(void *ad);
static struct lowmem_process_entry lpe[] = {
{MEMNOTIFY_NORMAL, MEMNOTIFY_LOW, memory_low_act},
-static int memory_low_act(void *data)
+static Eina_Bool memory_low_act(void *data)
{
char lowmem_noti_name[NAME_MAX];
vconf_set_int(VCONFKEY_SYSMAN_LOW_MEMORY,
VCONFKEY_SYSMAN_LOW_MEMORY_SOFT_WARNING);
- return 0;
+ return EINA_TRUE;
}
-static int memory_oom_act(void *data)
+static Eina_Bool memory_oom_act(void *data)
{
unsigned int cur_time;
char lowmem_noti_name[NAME_MAX];
vconf_set_int(VCONFKEY_SYSMAN_LOW_MEMORY,
VCONFKEY_SYSMAN_LOW_MEMORY_HARD_WARNING);
- return 1;
+ return EINA_TRUE;
}
-static int memory_normal_act(void *data)
+static Eina_Bool memory_normal_act(void *data)
{
_I("[LOW MEM STATE] memory normal state");
vconf_set_int(VCONFKEY_SYSMAN_LOW_MEMORY,
VCONFKEY_SYSMAN_LOW_MEMORY_NORMAL);
- return 0;
+ return EINA_TRUE;
}
static int lowmem_process(unsigned int mem_state, void *ad)
}
return mem_state;
}
-static int lowmem_cb(void *data, Ecore_Fd_Handler * fd_handler)
+static Eina_Bool lowmem_cb(void *data, Ecore_Fd_Handler * fd_handler)
{
int fd;
struct ss_main_data *ad = (struct ss_main_data *)data;
if (!ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ)) {
_E("ecore_main_fd_handler_active_get error, return");
- return -1;
+ goto out;
}
fd = ecore_main_fd_handler_fd_get(fd_handler);
if (fd < 0) {
_E("ecore_main_fd_handler_fd_get error, return");
- return -1;
+ goto out;
}
mem_state = lowmem_read(fd);
print_lowmem_state(mem_state);
lowmem_process(mem_state, ad);
cur_mem_state = mem_state;
-
- return 1;
+out:
+ return EINA_TRUE;
}
static int set_threshold()
}
*/
-static int pmon_cb(void *data, Ecore_Fd_Handler * fd_handler)
+static Eina_Bool pmon_cb(void *data, Ecore_Fd_Handler * fd_handler)
{
int fd;
struct ss_main_data *ad = (struct ss_main_data *)data;
int dead_pid;
if (!ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ)) {
_E("ecore_main_fd_handler_active_get error , return");
- return -1;
+ goto out;
}
fd = ecore_main_fd_handler_fd_get(fd_handler);
if (fd < 0) {
_E("ecore_main_fd_handler_fd_get error , return");
- return -1;
+ goto out;
}
if (read(fd, &dead_pid, sizeof(dead_pid)) < 0) {
__pmon_stop(fd);
_E("Reading DEAD_PID failed, restart ecore fd");
__pmon_start(ad);
- return -1;
+ goto out;
}
print_pmon_state(dead_pid);
pmon_process(dead_pid, ad);
-
- return 1;
+out:
+ return EINA_TRUE;
}
static int __pmon_start(struct ss_main_data *ad)
{
int pmon_fd = -1;
char pmon_dev_node[PATH_MAX];
- if (device_get_property(DEVICE_TYPE_PROCESS, PROP_PROCESS_NODE, pmon_dev_node) < 0) {
+ if (device_get_property(DEVICE_TYPE_PROCESS, PROP_PROCESS_NODE,
+ (int *)pmon_dev_node) < 0) {
_E("ss_pmon_init get dev node path failed");
return -1;
}
static const time_t default_time = 2147483645; // max(32bit) -3sec
static Ecore_Fd_Handler *tfdh = NULL; // tfd change noti
-static int tfd_cb(void *data, Ecore_Fd_Handler * fd_handler);
+static Eina_Bool tfd_cb(void *data, Ecore_Fd_Handler * fd_handler);
static int timerfd_check_stop(int fd);
static int timerfd_check_start(void);
return 0;
}
-static int tfd_cb(void *data, Ecore_Fd_Handler * fd_handler)
+static Eina_Bool tfd_cb(void *data, Ecore_Fd_Handler * fd_handler)
{
int tfd = -1;
u_int64_t ticks;
if (!ecore_main_fd_handler_active_get(fd_handler,ECORE_FD_READ)) {
_E("error ecore_main_fd_handler_get()");
- return -1;
+ goto out;
}
if((tfd = ecore_main_fd_handler_fd_get(fd_handler)) == -1) {
_E("error ecore_main_fd_handler_fd_get()");
- return -1;
+ goto out;
}
ret = read(tfd,&ticks,sizeof(ticks));
} else {
_D("unexpected read (err:%d)",errno);
}
- return 0;
+out:
+ return EINA_TRUE;
}
static void time_init(void *data)