change device node control api from plugin to device-node
authorjy910.yun <jy910.yun@samsung.com>
Tue, 4 Jun 2013 13:39:42 +0000 (22:39 +0900)
committerjy910.yun <jy910.yun@samsung.com>
Tue, 4 Jun 2013 13:39:42 +0000 (22:39 +0900)
Signed-off-by: giyeol.ok <giyeol.ok@samsung.com>
CMakeLists.txt
include/ss_data.h
packaging/system-server.spec
ss_device_change_handler.c
ss_lowbat_handler.c
ss_pmon_handler.c
ss_predefine.c
ss_procmgr.c

index c9eea3a..ce19a03 100755 (executable)
@@ -57,7 +57,6 @@ pkg_check_modules(pkgs REQUIRED
        dlog
        syspopup-caller
        notification
-       devman
        device-node
        libsmack)
 
index dac4149..0a08245 100644 (file)
@@ -85,6 +85,8 @@ enum {
 #define PREDEF_DEVICE_CHANGED  "device_changed"
 #define PREDEF_INTERNAL_POWEROFF       "internal_poweroff"
 
+#define PROCESS_GROUP_SET              "process_group_set"
+
 #define OOMADJ_SU                       (-17)
 #define OOMADJ_INIT                     (-16)
 #define OOMADJ_FOREGRD_LOCKED           (-15)
index fbce09e..b117178 100755 (executable)
@@ -16,7 +16,6 @@ BuildRequires:  pkgconfig(heynoti)
 BuildRequires:  pkgconfig(vconf)
 BuildRequires:  pkgconfig(sysman)
 BuildRequires:  pkgconfig(tapi)
-BuildRequires:  pkgconfig(devman)
 BuildRequires:  pkgconfig(pmapi)
 BuildRequires:  pkgconfig(edbus)
 BuildRequires:  pkgconfig(dlog)
index 178f126..acde084 100755 (executable)
@@ -95,13 +95,13 @@ static int check_lowbat_charge_device(int bInserted)
        int bat_state = -1;
        int ret = -1;
        if (bInserted == 1) {
-               if (device_get_property(DEVICE_TYPE_POWER, PROP_POWER_CHARGE_NOW, &val) == 0) {
+               if (device_get_property(DEVICE_TYPE_POWER, PROP_POWER_CHARGE_NOW, &val) < 0) {
                        if (val == 1)
                                bChargeDeviceInserted = 1;
                        return 0;
                }
        } else if (bInserted == 0) {
-               if (device_get_property(DEVICE_TYPE_POWER, PROP_POWER_CHARGE_NOW, &val) == 0) {
+               if (device_get_property(DEVICE_TYPE_POWER, PROP_POWER_CHARGE_NOW, &val) < 0) {
                        if (val == 0 && bChargeDeviceInserted == 1) {
                                bChargeDeviceInserted = 0;
                                //low bat popup during charging device removing
@@ -210,7 +210,6 @@ static void earkey_chgdet_cb(struct ss_main_data *ad)
 {
        int val;
        PRT_TRACE("jack - earkey changed\n");
-
        if (device_get_property(DEVICE_TYPE_EXTCON, PROP_EXTCON_EARKEY_ONLINE, &val) == 0)
                vconf_set_int(VCONFKEY_SYSMAN_EARJACKKEY, val);
 }
index 8999d54..b091de9 100755 (executable)
@@ -200,9 +200,7 @@ static int lowbat_process(int bat_percent, void *ad)
        } else {
                new_bat_state = BATTERY_NORMAL;
                if (new_bat_capacity == BATTERY_FULL) {
-                       if (device_get_property(DEVICE_TYPE_POWER, PROP_POWER_CHARGE_FULL, &bat_full) < 0) {
-                               PRT_TRACE_ERR("fail to read charge full from kernel");
-                       }
+                       device_get_property(DEVICE_TYPE_POWER, PROP_POWER_CHARGE_FULL, &bat_full);
                        if (bat_full == 1) {
                                if (vconf_state != VCONFKEY_SYSMAN_BAT_FULL)
                                ret=vconf_set_int(VCONFKEY_SYSMAN_BATTERY_STATUS_LOW, VCONFKEY_SYSMAN_BAT_FULL);
@@ -256,10 +254,7 @@ static int lowbat_read()
 {
        int bat_percent;
 
-       if (device_get_property(DEVICE_TYPE_POWER, PROP_POWER_CAPACITY, &bat_percent) < 0) {
-               PRT_TRACE_ERR("fail to read power capacity from kernel");
-               return -1;
-       }
+       device_get_property(DEVICE_TYPE_POWER, PROP_POWER_CAPACITY, &bat_percent);
 
        return bat_percent;
 }
index 42ef9e1..c5476be 100644 (file)
@@ -150,7 +150,6 @@ static int pmon_process(int pid, void *ad)
                                        return -1;
                                }
                                close(fd);
-
                                if ( device_set_property(DEVICE_TYPE_PROCESS, PROP_PROCESS_MP_PNP, new_pid) < 0) {
                                        PRT_TRACE_ERR("Write new pid failed");
                                }
index 7e57841..bf3a441 100644 (file)
@@ -30,7 +30,6 @@
 #include <syspopup_caller.h>
 #include <sys/reboot.h>
 #include <sys/time.h>
-#include <devman.h>
 #include <mntent.h>
 #include <sys/mount.h>
 
index 9a6faee..2d48c7b 100755 (executable)
@@ -20,6 +20,7 @@
 #include <unistd.h>
 #include <dirent.h>
 #include <sys/types.h>
+#include <device-node.h>
 
 #include <sysman.h>
 #include "include/ss_data.h"
@@ -28,6 +29,8 @@
 
 #define LIMITED_BACKGRD_NUM 15
 #define MAX_BACKGRD_OOMADJ (OOMADJ_BACKGRD_UNLOCKED + LIMITED_BACKGRD_NUM)
+#define PROCESS_VIP            "process_vip"
+#define PROCESS_PERMANENT      "process_permanent"
 
 int get_app_oomadj(int pid, int *oomadj)
 {
@@ -368,6 +371,28 @@ int set_backgrd_action(int argc, char **argv)
        return ret;
 }
 
+int set_process_group_action(int argc, char **argv)
+{
+       int pid = -1;
+       int ret = -1;
+
+       if (argc != 2)
+               return -1;
+       if ((pid = atoi(argv[0])) < 0)
+               return -1;
+
+       if (strncmp(argv[1], PROCESS_VIP, strlen(PROCESS_VIP)) == 0)
+               ret = device_set_property(DEVICE_TYPE_PROCESS, PROP_PROCESS_MP_VIP, pid);
+       else if (strncmp(argv[1], PROCESS_PERMANENT, strlen(PROCESS_PERMANENT)) == 0)
+               ret = device_set_property(DEVICE_TYPE_PROCESS, PROP_PROCESS_MP_PNP, pid);
+
+       if (ret == 0)
+               PRT_TRACE_ERR("%s : pid %d", argv[1], pid);
+       else
+               PRT_TRACE_ERR("fail to set %s : pid %d",argv[1], pid);
+       return 0;
+}
+
 int ss_process_manager_init(void)
 {
        ss_action_entry_add_internal(PREDEF_FOREGRD, set_foregrd_action, NULL,
@@ -379,5 +404,6 @@ int ss_process_manager_init(void)
        ss_action_entry_add_internal(PREDEF_INACTIVE, set_inactive_action, NULL,
                                     NULL);
        ss_action_entry_add_internal(OOMADJ_SET, set_oomadj_action, NULL, NULL);
+       ss_action_entry_add_internal(PROCESS_GROUP_SET, set_process_group_action, NULL, NULL);
        return 0;
 }