ENDIF()
########################################################
-# Deviced Macros
+# PASS Macros
########################################################
MACRO(ADD_SOURCE DIR OUT)
ENDIF()
IF(DEFINED T_CONF)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${T_CONF}
- DESTINATION /etc/deviced
+ DESTINATION /etc/pass
RENAME ${CONF}.conf)
ENDIF()
ENDMACRO()
########################################################
-# Deviced CMakeLists.txt
+# PASS CMakeLists.txt
########################################################
SET(PREFIX ${CMAKE_INSTALL_PREFIX})
SET(EXEC_PREFIX "${PREFIX}/bin")
SET(VERSION 0.1.0)
SET(SRCS
- src/apps/apps.c
- src/control/control.c
+ src/pass/pass.c
+ src/pass/pass-core.c
+ src/pass/pass-gov-radiation.c
+ src/pass/pass-gov-step.c
+ src/pass/pass-parser.c
+ src/pass/pass-plugin.c
+ src/pass/pass-pmqos.c
+ src/pmqos/pmqos.c
+ src/pmqos/pmqos-parser.c
+ src/shared/pass-systemd.c
src/core/common.c
src/core/config-parser.c
src/core/device-idler.c
src/core/device-notifier.c
src/core/devices.c
src/core/edbus-handler.c
- src/core/execute.c
- src/core/launch.c
src/core/log.c
src/core/main.c
src/core/sig-handler.c
src/core/udev.c
src/core/boot.c
- src/proc/cpu-info.c
- src/proc/proc-handler.c
)
-IF(PASS_MODULE STREQUAL on)
- ADD_SOURCE(src/pass PASS_SRCS)
- SET(SRCS ${SRCS} ${PASS_SRCS})
-ENDIF()
-
-IF(PMQOS_MODULE STREQUAL on)
- ADD_SOURCE(src/pmqos PMQOS_SRCS)
- SET(SRCS ${SRCS} ${PMQOS_SRCS})
-ENDIF()
-
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src/deviced)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src/pass)
SET(PKG_MODULES
ecore
gio-2.0
eventsystem
libtzplatform-config
- hwcommon
mount
)
ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
ADD_DEFINITIONS("-DFACTORYFS=\"$ENV{FACTORYFS}\"")
ADD_DEFINITIONS("-DLIBPATH=\"${LIB_INSTALL_DIR}\"")
-ADD_DEFINITIONS("-DENABLE_DEVICED_DLOG")
-ADD_DEFINITIONS("-DENABLE_LIBDEVICED_DLOG")
+ADD_DEFINITIONS("-DENABLE_PASS_DLOG")
+ADD_DEFINITIONS("-DENABLE_LIBPASS_DLOG")
ADD_DEFINITIONS("-DENABLE_PM_LOG")
IF(ENGINEER_MODE STREQUAL on)
ADD_DEFINITIONS("-DENGINEER_MODE")
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} "-ldl" "-lm" shared)
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
-INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/deviced/ DESTINATION include/${PROJECT_NAME}
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/pass/ DESTINATION include/${PROJECT_NAME}
FILES_MATCHING
PATTERN "*_doc.h" EXCLUDE
PATTERN "*.h")
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/${PROJECT_NAME}.conf DESTINATION /etc/dbus-1/system.d)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/pass/pass.conf DESTINATION /etc/deviced)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/pass/pass-cluster0.conf DESTINATION /etc/deviced)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/pass/pass-cluster1.conf DESTINATION /etc/deviced)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/pmqos/pmqos.conf DESTINATION /etc/deviced)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/pass/pass.conf DESTINATION /etc/pass)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/pass/pass-cluster0.conf DESTINATION /etc/pass)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/pass/pass-cluster1.conf DESTINATION /etc/pass)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/pmqos/pmqos.conf DESTINATION /etc/pass)
CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
-Thanks to the follow people for contributing to deviced by reporting
+Thanks to the follow people for contributing to PASS by reporting
bugs, providing fixes, providing information, providing resources or
porting to new systems:
Names taken from sources and from version control system.
ChanWoo Choi <cw00.choi@samsung.com>
-Byung-Soo Kim <bs1770.kim@samsung.com>
-Taeyoung Kim <ty317.kim@samsung.com>
-Gi-Yeol Ok <giyeol.ok@samsung.com>
-Kyungmin Park <kyungmin.park@samsung.com>
-SeungHun Pi <sh.pi@samsung.com>
-Juho Son <juho80.son@samsung.com>
-Jiyoung Yun <jy910.yun@samsung.com>
+Wook Song <wook16.song@samsung.com>
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_"/>
+ </request>
+</manifest>
-#These options are DEACTIVATED by default.
-%bcond_with x
-%bcond_with wayland
-%bcond_with emulator
-
%define _unpackaged_files_terminate_build 0
%define daemon_name pass
-%define libdaemon_name lib%{daemon_name}
-
-# display, extcon, power, usb are always enable
-
-# Support two pattern combination vibration
-%define standard_mix off
-%define pass_module on
-%define pmqos_module on
%if "%{?profile}" == "mobile"
%endif
%endif
Name: %{daemon_name}
-Summary: PASS
+Summary: Power Aware System Service
Version: 0.0.1
Release: 1
-Group: System/Management
+Group: System/Kernel
License: Apache-2.0
Source0: %{name}-%{version}.tar.gz
Source1: %{name}.manifest
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(eventsystem)
BuildRequires: pkgconfig(libtzplatform-config)
-BuildRequires: pkgconfig(hwcommon)
-#Requires: %{name}-tools = %{version}-%{release}
-%{?systemd_requires}
-Requires(post): /usr/bin/vconftool
%description
PASS (Power-Aware System Service)
%define ARCH_BIT 64
%endif
-%define DPMS none
-%if %{with x}
-%define DPMS x
-%endif
-%if %{with wayland}
-%define DPMS wayland
-%endif
-
%if 0%{?tizen_build_devel_mode} == 1
%define engineer_mode on
%else
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
-DARCH=%{ARCH} \
-DARCH_BIT=%{ARCH_BIT} \
- -DDPMS=%{DPMS} \
-DENGINEER_MODE=%{engineer_mode} \
-DPROFILE=%{profile} \
- -DSTANDARD_MIX=%{standard_mix} \
- -DPASS_MODULE=%{pass_module} \
- -DPMQOS_MODULE=%{pmqos_module} \
#eol
%build
%install_service sockets.target.wants %{daemon_name}.socket
%post
-#memory type vconf key init
-users_gid=$(getent group %{TZ_SYS_USER_GROUP} | cut -f3 -d':')
systemctl daemon-reload
if [ "$1" == "1" ]; then
%files -n %{daemon_name}
%manifest %{name}.manifest
%license LICENSE
-%config %{_sysconfdir}/dbus-1/system.d/%{daemon_name}.conf
-%config %{_sysconfdir}/deviced/pass.conf
-%config %{_sysconfdir}/deviced/pass-cluster0.conf
-%config %{_sysconfdir}/deviced/pass-cluster1.conf
-%config %{_sysconfdir}/deviced/pmqos.conf
+%config %{_sysconfdir}/pass/pass.conf
+%config %{_sysconfdir}/pass/pass-cluster0.conf
+%config %{_sysconfdir}/pass/pass-cluster1.conf
+%config %{_sysconfdir}/pass/pmqos.conf
%{_bindir}/%{daemon_name}
%{_unitdir}/multi-user.target.wants/%{daemon_name}.service
%{_unitdir}/sockets.target.wants/%{daemon_name}.socket
+++ /dev/null
-/*
- * deviced
- *
- * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdarg.h>
-#include "core/log.h"
-#include "core/common.h"
-#include "apps.h"
-#include "core/edbus-handler.h"
-
-#define POPUP_METHOD "PopupLaunch"
-
-static const struct app_dbus_match {
- const char *type;
- const char *bus;
- const char *path;
- const char *iface;
- const char *method;
-} app_match[] = {
- { APP_DEFAULT , POPUP_BUS_NAME, POPUP_PATH_SYSTEM , POPUP_INTERFACE_SYSTEM , POPUP_METHOD },
- { APP_POWERKEY, POPUP_BUS_NAME, POPUP_PATH_POWERKEY, POPUP_INTERFACE_POWERKEY, POPUP_METHOD },
-};
-
-int launch_system_app(char *type, int num, ...)
-{
- char *app_type;
- va_list args;
- int i, match, ret;
-
- if (type)
- app_type = type;
- else
- app_type = APP_DEFAULT;
-
- match = -1;
- for (i = 0 ; i < ARRAY_SIZE(app_match) ; i++) {
- if (strncmp(app_type, app_match[i].type, strlen(app_type)))
- continue;
- match = i;
- break;
- }
- if (match < 0) {
- _E("Failed to find app matched (%s)", app_type);
- return -EINVAL;
- }
-
- va_start(args, num);
-
- ret = dbus_method_sync_pairs(app_match[match].bus,
- app_match[match].path,
- app_match[match].iface,
- app_match[match].method,
- num, args);
-
- va_end(args);
-
- return ret;
-}
-
-int launch_message_post(char *type)
-{
- char *param[1];
-
- if (!type)
- return -EINVAL;
-
- param[0] = type;
-
- return dbus_method_sync(POPUP_BUS_NAME,
- POPUP_PATH_NOTI,
- POPUP_INTERFACE_NOTI,
- "MessagePostOn",
- "s", param);
-}
-
-int add_notification(char *type)
-{
- if (!type)
- return -EINVAL;
-
- return dbus_method_sync(POPUP_BUS_NAME,
- POPUP_PATH_NOTI,
- POPUP_INTERFACE_NOTI,
- type, NULL, NULL);
-}
-
-int remove_notification(char *type, int id)
-{
- char *param[1];
- char id_str[16];
-
- if (!type || id < 0)
- return -EINVAL;
-
- snprintf(id_str, sizeof(id_str), "%d", id);
- param[0] = id_str;
-
- return dbus_method_sync(POPUP_BUS_NAME,
- POPUP_PATH_NOTI,
- POPUP_INTERFACE_NOTI,
- type, "i", param);
-}
+++ /dev/null
-/*
- * deviced
- *
- * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __APPS_H__
-#define __APPS_H__
-
-
-#include "core/edbus-handler.h"
-#include "core/common.h"
-
-#define APP_POWERKEY "powerkey"
-#define APP_DEFAULT "system"
-#define APP_KEY_TYPE "_SYSPOPUP_CONTENT_"
-
-int launch_system_app(char *type, int num, ...);
-int launch_message_post(char *type);
-int add_notification(char *type);
-int remove_notification(char *type, int id);
-
-#endif /* __APPS_H__ */
+++ /dev/null
-/*
- * deviced
- *
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#include <stdio.h>
-#include <errno.h>
-#include <assert.h>
-#include <sys/types.h>
-#include <dd-control.h>
-
-#include "core/log.h"
-#include "core/common.h"
-#include "core/devices.h"
-#include "core/edbus-handler.h"
-
-#define CONTROL_HANDLER_NAME "control"
-#define CONTROL_GETTER_NAME "getcontrol"
-
-static const struct control_device {
- const int id;
- const char *name;
-} devices[] = {
- /* Add id & ops to provide start/stop control */
- { DEVICE_CONTROL_MMC, "mmc" },
- { DEVICE_CONTROL_USBCLIENT, "usbclient" },
- { DEVICE_CONTROL_BLOCK, "block" },
-};
-
-static int control_handler(int argc, char **argv)
-{
- int i;
- int pid;
- int device;
- bool enable;
- int ret;
- const struct device_ops *dev_ops = NULL;
-
- _I("argc : %d", argc);
- for (i = 0; i < argc; ++i)
- _I("[%2d] %s", i, argv[i]);
-
- if (argc > 5) {
- _E("Invalid argument");
- errno = EINVAL;
- return -1;
- }
-
- pid = atoi(argv[0]);
- device = atoi(argv[1]);
- enable = atoi(argv[2]);
- _I("pid : %d, device : %d, enable :%d", pid, device, enable);
-
- for (i = 0; i < ARRAY_SIZE(devices); i++)
- if (devices[i].id == device)
- break;
-
- if (i >= ARRAY_SIZE(devices))
- return -EINVAL;
- FIND_DEVICE_INT(dev_ops, devices[i].name);
- if (enable)
- ret = device_start(dev_ops);
- else
- ret = device_stop(dev_ops);
-
- return ret;
-}
-
-static int get_control_handler(int argc, char **argv)
-{
- int i;
- int pid;
- int device;
- const struct device_ops *dev_ops = NULL;
-
- _I("argc : %d", argc);
- for (i = 0; i < argc; ++i)
- _I("[%2d] %s", i, argv[i]);
-
- if (argc > 4) {
- _E("Invalid argument");
- errno = EINVAL;
- return -1;
- }
-
- pid = atoi(argv[0]);
- device = atoi(argv[1]);
- _I("pid : %d, device : %d", pid, device);
-
- for (i = 0; i < ARRAY_SIZE(devices); i++)
- if (devices[i].id == device)
- break;
-
- if (i >= ARRAY_SIZE(devices))
- return -EINVAL;
-
- FIND_DEVICE_INT(dev_ops, devices[i].name);
-
- return device_get_status(dev_ops);
-}
-
-
-static DBusMessage *dbus_control_handler(E_DBus_Object *obj, DBusMessage *msg)
-{
- DBusError err;
- DBusMessageIter iter;
- DBusMessage *reply;
- pid_t pid;
- int ret;
- int argc;
- char *type_str;
- char *argv[3];
-
- dbus_error_init(&err);
-
- if (!dbus_message_get_args(msg, &err,
- DBUS_TYPE_STRING, &type_str,
- DBUS_TYPE_INT32, &argc,
- DBUS_TYPE_STRING, &argv[0],
- DBUS_TYPE_STRING, &argv[1],
- DBUS_TYPE_STRING, &argv[2], DBUS_TYPE_INVALID)) {
- _E("there is no message");
- ret = -EINVAL;
- goto out;
- }
-
- if (argc < 0) {
- _E("message is invalid!");
- ret = -EINVAL;
- goto out;
- }
-
- pid = get_edbus_sender_pid(msg);
- if (kill(pid, 0) == -1) {
- _E("%d process does not exist, dbus ignored!", pid);
- ret = -ESRCH;
- goto out;
- }
-
- ret = control_handler(argc, (char **)&argv);
-out:
- reply = dbus_message_new_method_return(msg);
- dbus_message_iter_init_append(reply, &iter);
- dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &ret);
-
- return reply;
-}
-
-static DBusMessage *dbus_get_control_handler(E_DBus_Object *obj, DBusMessage *msg)
-{
- DBusError err;
- DBusMessageIter iter;
- DBusMessage *reply;
- pid_t pid;
- int ret;
- int argc;
- char *type_str;
- char *argv[2];
-
- dbus_error_init(&err);
-
- if (!dbus_message_get_args(msg, &err,
- DBUS_TYPE_STRING, &type_str,
- DBUS_TYPE_INT32, &argc,
- DBUS_TYPE_STRING, &argv[0],
- DBUS_TYPE_STRING, &argv[1], DBUS_TYPE_INVALID)) {
- _E("there is no message");
- ret = -EINVAL;
- goto out;
- }
-
- if (argc < 0) {
- _E("message is invalid!");
- ret = -EINVAL;
- goto out;
- }
-
- pid = get_edbus_sender_pid(msg);
- if (kill(pid, 0) == -1) {
- _E("%d process does not exist, dbus ignored!", pid);
- ret = -ESRCH;
- goto out;
- }
-
- ret = get_control_handler(argc, (char **)&argv);
-out:
- reply = dbus_message_new_method_return(msg);
- dbus_message_iter_init_append(reply, &iter);
- dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &ret);
-
- return reply;
-}
-
-static const struct edbus_method edbus_methods[] = {
- { CONTROL_HANDLER_NAME, "sisss", "i", dbus_control_handler },
- { CONTROL_GETTER_NAME , "siss", "i", dbus_get_control_handler },
-};
-
-static void control_init(void *data)
-{
- int ret;
-
- ret = register_edbus_method(DEVICED_PATH_SYSNOTI, edbus_methods, ARRAY_SIZE(edbus_methods));
- if (ret < 0)
- _E("fail to init edbus method(%d)", ret);
-}
-
-static const struct device_ops control_device_ops = {
- .name = "control",
- .init = control_init,
-};
-
-DEVICE_OPS_REGISTER(&control_device_ops)
/*
- * deviced
+ * PASS
*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
#include "core/device-notifier.h"
#include "core/common.h"
#include "core/edbus-handler.h"
-#include "shared/deviced-systemd.h"
+#include "shared/pass-systemd.h"
#define SIGNAL_BOOTING_DONE "BootingDone"
int ret;
size_t len;
- ret = deviced_systemd_get_manager_property_as_string(
+ ret = pass_systemd_get_manager_property_as_string(
SYSTEMD_DBUS_IFACE_MANAGER,
SYSTEMD_DBUS_METHOD_SYSTEM_STATE,
&state);
/*
- * deviced
+ * PASS
*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* limitations under the License.
*/
-#ifndef __DEVICED_BOOT_H__
-#define __DEVICED_BOOT_H__
+#ifndef __PASS_BOOT_H__
+#define __PASS_BOOT_H__
int booting_finished(void);
void add_booting_done_handler(void *data);
void remove_booting_done_handler(void *data);
-#endif /* __DEVICED_BOOT_H__ */
+#endif /* __PASS_BOOT_H__ */
/*
- * deviced
+ * PASS
*
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
#include "log.h"
#include "common.h"
-#define PERMANENT_DIR "/tmp/permanent"
-#define VIP_DIR "/tmp/vip"
-#define BUFF_MAX 255
-
-#define APP_ATTR_PATH "/proc/%d/attr/current"
-
-/**
- * Opens "/proc/$pid/oom_score_adj" file for w/r;
- * Return: FILE pointer or NULL
- */
-FILE *open_proc_oom_score_adj_file(int pid, const char *mode)
-{
- char buf[32];
- FILE *fp;
-
- snprintf(buf, sizeof(buf), "/proc/%d/oom_score_adj", pid);
- fp = fopen(buf, mode);
- return fp;
-}
-
-int get_exec_pid(const char *execpath)
-{
- DIR *dp;
- struct dirent entry;
- struct dirent *dentry;
- int pid = -1, fd;
- int ret;
- int len;
- char buf[PATH_MAX];
- char buf2[PATH_MAX];
-
- dp = opendir("/proc");
- if (!dp) {
- _E("FAIL: open /proc");
- return -1;
- }
-
- len = strlen(execpath) + 1;
- while (1) {
- ret = readdir_r(dp, &entry, &dentry);
- if (ret != 0 || dentry == NULL)
- break;
-
- if (!isdigit(dentry->d_name[0]))
- continue;
-
- pid = atoi(dentry->d_name);
-
- snprintf(buf, PATH_MAX, "/proc/%d/cmdline", pid);
- fd = open(buf, O_RDONLY);
- if (fd < 0)
- continue;
- ret = read(fd, buf2, PATH_MAX);
- close(fd);
-
- if (ret < 0 || ret >= PATH_MAX)
- continue;
-
- buf2[ret] = '\0';
-
- if (!strncmp(buf2, execpath, len)) {
- closedir(dp);
- return pid;
- }
- }
-
- errno = ESRCH;
- closedir(dp);
- return -1;
-}
+#define BUFF_MAX 255
int get_cmdline_name(pid_t pid, char *cmdline, size_t cmdline_size)
{
return 0;
}
-int is_vip(int pid)
-{
- if (pid < 1)
- return -1;
-
- char buf[PATH_MAX];
-
- snprintf(buf, PATH_MAX, "%s/%d", VIP_DIR, pid);
-
- if (access(buf, R_OK) == 0)
- return 1;
- else
- return 0;
-}
-
-static int remove_dir_internal(int fd)
-{
- DIR *dir;
- struct dirent entry;
- struct dirent *de;
- int subfd, ret = 0;
-
- dir = fdopendir(fd);
- if (!dir)
- return -1;
- while (1) {
- ret = readdir_r(dir, &entry, &de);
- if (ret != 0 || de == NULL)
- break;
- if (de->d_type == DT_DIR) {
- if (!strncmp(de->d_name, ".", 2) || !strncmp(de->d_name, "..", 3))
- continue;
- subfd = openat(fd, de->d_name, O_RDONLY | O_DIRECTORY);
- if (subfd < 0) {
- _SE("Couldn't openat %s: %d\n", de->d_name, errno);
- ret = -1;
- continue;
- }
- if (remove_dir_internal(subfd))
- ret = -1;
-
- close(subfd);
- if (unlinkat(fd, de->d_name, AT_REMOVEDIR) < 0) {
- _SE("Couldn't unlinkat %s: %d\n", de->d_name, errno);
- ret = -1;
- }
- } else {
- if (unlinkat(fd, de->d_name, 0) < 0) {
- _SE("Couldn't unlinkat %s: %d\n", de->d_name, errno);
- ret = -1;
- }
- }
- }
- closedir(dir);
- return ret;
-}
-
-int remove_dir(const char *path, int del_dir)
-{
- int fd, ret = 0;
-
- if (!path)
- return -1;
- fd = open(path, O_RDONLY | O_NONBLOCK | O_DIRECTORY | O_CLOEXEC | O_NOFOLLOW);
- if (fd < 0) {
- _SE("Couldn't opendir %s: %d\n", path, errno);
- return -errno;
- }
- ret = remove_dir_internal(fd);
- close(fd);
-
- if (del_dir) {
- if (rmdir(path)) {
- _SE("Couldn't rmdir %s: %d\n", path, errno);
- ret = -1;
- }
- }
- return ret;
-}
-
/*
* Helper function
* - Read from sysfs entry
return r;
}
-
-int terminate_process(const char *partition, bool force)
-{
- const char *argv[7] = {"/usr/bin/fuser", "-m", "-k", "-s", NULL, NULL, NULL};
- int argc;
-
- if (force)
- argv[4] = "-SIGKILL";
- else
- argv[4] = "-SIGTERM";
- argv[5] = partition;
- argc = sizeof(argv) / sizeof(argv[0]);
- return run_child(argc, argv);
-}
-
-int mount_check(const char *path)
-{
- int ret = false;
- struct mntent *mnt;
- const char *table = "/etc/mtab";
- FILE *fp;
- int len;
-
- fp = setmntent(table, "r");
- if (!fp)
- return ret;
-
- len = strlen(path) + 1;
- while (1) {
- mnt = getmntent(fp);
- if (mnt == NULL)
- break;
- if (!strncmp(mnt->mnt_dir, path, len)) {
- ret = true;
- break;
- }
- }
- endmntent(fp);
- return ret;
-}
-
-void print_time(const char *prefix)
-{
- struct timeval tv;
- struct tm tm;
- struct tm *ret;
- gettimeofday(&tv, NULL);
- ret = localtime_r(&(tv.tv_sec), &tm);
- if (ret)
- _D("%s --> %d:%02d:%02d %d",
- prefix, tm.tm_hour, tm.tm_min, tm.tm_sec, tv.tv_usec);
-}
-
-int get_privilege(pid_t pid, char *name, size_t len)
-{
- char path[PATH_MAX];
- char attr[BUFF_MAX];
- size_t attr_len;
- FILE *fp;
-
- snprintf(path, sizeof(path), APP_ATTR_PATH, pid);
-
- fp = fopen(path, "r");
- if (!fp)
- return -errno;
-
- attr_len = fread(attr, 1, sizeof(attr) - 1, fp);
- fclose(fp);
- if (attr_len == 0)
- return -ENOENT;
-
- attr[attr_len] = '\0';
-
- snprintf(name, len, "%s", attr);
- return 0;
-}
/*
- * deviced
+ * PASS
*
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
/*
- * deviced
+ * PASS
*
- * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
/*
- * deviced
+ * PASS
*
- * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
/*
- * deviced
+ * PASS
*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
/*
- * deviced
+ * PASS
*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * deviced
+ * PASS
*
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
/*
- * deviced
+ * PASS
*
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
enum device_notifier_type {
DEVICE_NOTIFIER_BOOTING_DONE,
- DEVICE_NOTIFIER_LCD,
- DEVICE_NOTIFIER_TA,
- DEVICE_NOTIFIER_LOWBAT,
- DEVICE_NOTIFIER_FULLBAT,
- DEVICE_NOTIFIER_TOUCH_HARDKEY,
- DEVICE_NOTIFIER_PROCESS_TERMINATED,
- DEVICE_NOTIFIER_POWER_SUPPLY,
- DEVICE_NOTIFIER_BATTERY_HEALTH,
- DEVICE_NOTIFIER_BATTERY_PRESENT,
- DEVICE_NOTIFIER_BATTERY_OVP,
- DEVICE_NOTIFIER_BATTERY_CHARGING,
- DEVICE_NOTIFIER_DISPLAY_LOCK,
- DEVICE_NOTIFIER_POWER_RESUME,
- DEVICE_NOTIFIER_POWEROFF,
- DEVICE_NOTIFIER_POWEROFF_HAPTIC,
- DEVICE_NOTIFIER_PMQOS_OOM,
DEVICE_NOTIFIER_PMQOS,
- DEVICE_NOTIFIER_PROCESS_BACKGROUND,
- DEVICE_NOTIFIER_PROCESS_FOREGROUND,
- DEVICE_NOTIFIER_USB_TETHERING_MODE,
+ DEVICE_NOTIFIER_POWEROFF,
DEVICE_NOTIFIER_MAX,
};
/*
- * deviced
+ * PASS (Power Aware System Service)
*
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
/*
- * deviced
+ * PASS
*
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
enum device_flags {
NORMAL_MODE = 0x00000001,
- CORE_LOGIC_MODE = 0x00010000,
- TOUCH_SCREEN_OFF_MODE = 0x00020000,
- LCD_PANEL_OFF_MODE = 0x00040000,
- LCD_PHASED_TRANSIT_MODE = 0x00080000,
- LCD_ON_BY_GESTURE = 0x00100000,
- LCD_ON_BY_POWER_KEY = 0x00200000,
- LCD_ON_BY_EVENT = 0x00400000,
- LCD_ON_BY_TOUCH = 0x00800000,
- LCD_OFF_BY_POWER_KEY = 0x01000000,
- LCD_OFF_BY_TIMEOUT = 0x02000000,
- LCD_OFF_BY_EVENT = 0x04000000,
- LCD_OFF_LATE_MODE = 0x08000000,
};
struct device_ops {
/*
- * deviced
+ * PASS
*
* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
*
E_DBus_Interface *iface;
} edbus_objects[] = {
{ DEVICED_PATH_CORE , DEVICED_INTERFACE_CORE , NULL, NULL },
- { DEVICED_PATH_DISPLAY, DEVICED_INTERFACE_DISPLAY, NULL, NULL },
- { DEVICED_PATH_POWER , DEVICED_INTERFACE_POWER , NULL, NULL },
- { DEVICED_PATH_STORAGE, DEVICED_INTERFACE_STORAGE, NULL, NULL },
- { DEVICED_PATH_PROCESS, DEVICED_INTERFACE_PROCESS, NULL, NULL },
- { DEVICED_PATH_KEY , DEVICED_INTERFACE_KEY , NULL, NULL },
{ DEVICED_PATH_SYSNOTI, DEVICED_INTERFACE_SYSNOTI, NULL, NULL },
- { DEVICED_PATH_USB , DEVICED_INTERFACE_USB , NULL, NULL },
{ DEVICED_PATH_PMQOS , DEVICED_INTERFACE_PMQOS , NULL, NULL },
/* Add new object & interface here*/
};
retry++;
} while (retry <= EDBUS_INIT_RETRY_COUNT);
- retry = 0;
- do {
- edbus_request_name = e_dbus_request_name(edbus_conn_block, STORAGE_BUS_NAME,
- DBUS_NAME_FLAG_REPLACE_EXISTING, request_name_cb, NULL);
- if (edbus_request_name)
- break;
- if (retry == EDBUS_INIT_RETRY_COUNT) {
- _E("fail to request edbus name");
- goto out3;
- }
- retry++;
- } while (retry <= EDBUS_INIT_RETRY_COUNT);
-
for (i = 0; i < ARRAY_SIZE(edbus_objects); i++) {
ret = register_edbus_interface(&edbus_objects[i]);
if (ret < 0) {
/*
- * deviced
+ * PASS
*
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
/*
- * deviced
+ * PASS
*
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
+++ /dev/null
-/*
- * deviced
- *
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <signal.h>
-#include <string.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <vconf.h>
-
-#include "log.h"
-#include "launch.h"
-#include "common.h"
-
-#define MAX_ARGS 255
-
-#define _S(str) ((str == NULL) ? "" : str)
-
-static int set_current_lang(void)
-{
- char *lang;
- int ret;
-
- lang = vconf_get_str(VCONFKEY_LANGSET);
- if (lang == NULL)
- return -1;
- ret = setenv("LANG", lang, 1);
- if (ret < 0)
- return -1;
- free(lang);
- return 0;
-}
-
-
-static void prepare_exec(void)
-{
- int i;
- int maxfd;
-
- maxfd = getdtablesize();
- for (i = 3; i < maxfd; i++)
- close(i);
-
- for (i = 0; i < _NSIG; i++)
- signal(i, SIG_DFL);
-}
-
-static int parse_cmd(const char *cmdline, char **argv, int max_args)
-{
- const char *p;
- char *buf, *bufp;
- int nargs = 0;
- int escape = 0, squote = 0, dquote = 0;
- int bufsize;
-
- if (cmdline == NULL || cmdline[0] == '\0')
- return -1;
- bufsize = strlen(cmdline)+1;
- bufp = buf = malloc(bufsize);
- if (bufp == NULL || buf == NULL)
- return -1;
- memset(buf, 0, bufsize);
- p = cmdline;
-
- while (*p) {
- if (escape) {
- *bufp++ = *p;
- escape = 0;
- } else {
- switch (*p) {
- case '\\':
- escape = 1;
- break;
- case '"':
- if (squote)
- *bufp++ = *p;
- else
- dquote = !dquote;
- break;
- case '\'':
- if (dquote)
- *bufp++ = *p;
- else
- squote = !squote;
- break;
- case ' ':
- if (!squote && !dquote) {
- *bufp = '\0';
- if (nargs < max_args)
- argv[nargs++] = strdup(buf);
- bufp = buf;
- break;
- }
- default:
- *bufp++ = *p;
- break;
- }
- }
- p++;
- }
-
- if (bufp != buf) {
- *bufp = '\0';
- if (nargs < max_args)
- argv[nargs++] = strdup(buf);
- }
-
- argv[nargs++] = NULL;
-
- free(buf);
- return nargs;
-}
-
-int launch_app_with_nice(const char *file, char *const argv[], pid_t *pid, int _nice)
-{
- int ret;
- int _pid;
-
- if (file == NULL || access(file, X_OK) != 0) {
- _E("launch app error: Invalid input");
- errno = EINVAL;
- return -1;
- }
-
- if (pid && (*pid > 0 && kill(*pid, 0) != -1))
- return *pid;
-
- _pid = fork();
-
- if (_pid == -1) {
- _E("fork error: %d", errno);
- /* keep errno */
- return -1;
- }
-
- if (_pid > 0) { /* parent */
- if (pid)
- *pid = _pid;
- return _pid;
- }
-
- /* child */
- prepare_exec();
-
- ret = nice(_nice);
-
- if (ret == -1 && errno != 0)
- _E("nice error: %d", errno);
-
- ret = execvp(file, argv);
-
- /* If failed... */
- _E("exec. error: %s", errno);
- return -2;
-}
-
-int launch_app_cmd_with_nice(const char *cmdline, int _nice)
-{
- int i;
- int nargs;
- int ret;
- char *argv[MAX_ARGS + 1];
-
- nargs = parse_cmd(cmdline, argv, MAX_ARGS + 1);
- if (nargs == -1) {
- _E("launch app error: Invalid input");
- errno = EINVAL;
- return -1;
- }
-
- ret = launch_app_with_nice(argv[0], argv, NULL, _nice);
-
- for (i = 0; i < nargs; i++)
- free(argv[i]);
-
- return ret;
-}
-
-int launch_app_cmd(const char *cmdline)
-{
- return launch_app_cmd_with_nice(cmdline, 0);
-}
-
-int launch_if_noexist(const char *execpath, const char *arg, ...)
-{
- char *buf;
- int pid;
- int nice_value = 0;
- int flag = 0;
- int buf_size = -1;
- va_list argptr;
-
- if (execpath == NULL) {
- errno = EINVAL;
- return -1;
- }
- pid = get_exec_pid(execpath);
- if (pid > 0)
- return pid;
-
- va_start(argptr, arg);
- flag = va_arg(argptr, int);
-
- if (flag & LAUNCH_NICE)
- nice_value = va_arg(argptr, int);
-
- va_end(argptr);
-
- set_current_lang();
- arg = _S(arg);
-
- buf_size = strlen(execpath) + strlen(arg) + 10;
- buf = malloc(buf_size);
- if (buf == NULL) {
- /* Do something for not enought memory error */
- _E("Malloc failed");
- return -1;
- }
-
- snprintf(buf, buf_size, "%s %s", execpath, arg);
- pid = launch_app_cmd_with_nice(buf, nice_value);
- if (pid == -2)
- exit(EXIT_FAILURE);
- free(buf);
-
- return pid;
-}
-
-int launch_evenif_exist(const char *execpath, const char *arg, ...)
-{
- char *buf;
- int pid;
- int nice_value = 0;
- int flag = 0;
- int buf_size = -1;
-
- va_list argptr;
-
- if (execpath == NULL) {
- errno = EINVAL;
- return -1;
- }
-
- va_start(argptr, arg);
- flag = va_arg(argptr, int);
-
- if (flag & LAUNCH_NICE)
- nice_value = va_arg(argptr, int);
-
- va_end(argptr);
-
- set_current_lang();
-
- arg = _S(arg);
-
- buf_size = strlen(execpath) + strlen(arg) + 10;
- buf = malloc(buf_size);
- if (buf == NULL) {
- _E("Malloc failed");
- return -1;
- }
-
- snprintf(buf, buf_size, "%s %s", execpath, arg);
- pid = launch_app_cmd_with_nice(buf, nice_value);
- if (pid == -2)
- exit(EXIT_FAILURE);
- free(buf);
-
- return pid;
-}
-
-int launch_after_kill_if_exist(const char *execpath, const char *arg, ...)
-{
- char *buf;
- int pid;
- int flag;
- int buf_size;
- int exist_pid;
- va_list argptr;
- int nice_value = 0;
-
- if (execpath == NULL) {
- errno = EINVAL;
- return -1;
- }
-
- exist_pid = get_exec_pid(execpath);
- if (exist_pid > 0)
- kill(exist_pid, SIGTERM);
-
- va_start(argptr, arg);
- flag = va_arg(argptr, int);
-
- if (flag & LAUNCH_NICE)
- nice_value = va_arg(argptr, int);
-
- va_end(argptr);
-
- set_current_lang();
-
- arg = _S(arg);
-
- buf_size = strlen(execpath) + strlen(arg) + 10;
- buf = malloc(buf_size);
- if (buf == NULL) {
- /* Do something for not enought memory error */
- _E("Malloc Failed");
- return -1;
- }
-
- snprintf(buf, buf_size, "%s %s", execpath, arg);
- pid = launch_app_cmd_with_nice(buf, nice_value);
- if (pid == -2) /* It means that the 'execvp' return -1 */
- exit(EXIT_FAILURE);
- free(buf);
-
- return pid;
-
-}
+++ /dev/null
-/*
- * deviced
- *
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#ifndef __LAUNCH_H__
-#define __LAUNCH_H__
-
-#define LAUNCH_NICE 0x0002
-
-int launch_if_noexist(const char *execpath, const char *arg, ...);
-int launch_evenif_exist(const char *execpath, const char *arg, ...);
-int launch_after_kill_if_exist(const char *execpath, const char *arg, ...);
-
-int launch_app_cmd(const char *cmdline);
-int launch_app_cmd_with_nice(const char *cmdline, int _nice);
-
-#endif /* __LAUNCH_H__ */
/*
- * deviced
+ * PASS
*
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * deviced
+ * PASS
*
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
/*
- * deviced
+ * PASS
*
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
#ifndef __LOG_H__
#define __LOG_H__
-#ifdef ENABLE_DEVICED_DLOG
+#ifdef ENABLE_PASS_DLOG
#define ENABLE_DLOG
#endif
/*
- * deviced
+ * PASS (Power Aware System Service)
*
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
#include "boot.h"
#include "device-notifier.h"
-#define PIDFILE_PATH "/var/run/.deviced.pid"
+#define PIDFILE_PATH "/var/run/.pass.pid"
static void writepid(char *pidpath)
{
static void sig_usr1(int signo)
{
- _D("received SIGUSR1 signal %d, deviced'll be finished!", signo);
+ _D("received SIGUSR1 signal %d, PASS'll be finished!", signo);
ecore_main_loop_quit();
}
-static int deviced_main(int argc, char **argv)
+static int pass_main(int argc, char **argv)
{
int ret;
{
writepid(PIDFILE_PATH);
ecore_init();
- return deviced_main(argc, argv);
+ return pass_main(argc, argv);
}
/*
- * deviced
+ * PASS
*
* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
*
/*
- * deviced
+ * PASS (Power Aware System Service)
*
- * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
/*
- * deviced
+ * PASS
*
- * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
#define UDEV_DEVPATH "DEVPATH"
#define UDEV_DEVTYPE "DEVTYPE"
-/* battery device */
-#define POWER_SUBSYSTEM "power_supply"
-#define POWER_PATH "/sys/class/power_supply/battery"
-#define POWER_SUPPLY_UEVENT POWER_PATH"/uevent"
-#define CAPACITY "POWER_SUPPLY_CAPACITY"
-#define CHARGE_HEALTH "POWER_SUPPLY_HEALTH"
-#define CHARGE_PRESENT "POWER_SUPPLY_PRESENT"
-#define CHARGE_NAME "POWER_SUPPLY_NAME"
-#define CHARGE_STATUS "POWER_SUPPLY_STATUS"
-#define CHARGE_ONLINE "POWER_SUPPLY_ONLINE"
-
-/* extcon */
-#define EXTCON_SUBSYSTEM "extcon"
-
-/* usb */
-#define USB_SUBSYSTEM "usb"
-#define USB_INTERFACE_DEVTYPE "usb_interface"
-#define USB_DEVICE_DEVTYPE "usb_device"
-
-/* block */
-#define BLOCK_SUBSYSTEM "block"
-#define BLOCK_DEVTYPE_DISK "disk"
-#define BLOCK_DEVTYPE_PARTITION "partition"
-
-/* power supply status */
-enum {
- POWER_SUPPLY_STATUS_UNKNOWN = 0,
- POWER_SUPPLY_STATUS_CHARGING,
- POWER_SUPPLY_STATUS_DISCHARGING,
- POWER_SUPPLY_STATUS_NOT_CHARGING,
- POWER_SUPPLY_STATUS_FULL,
-};
-
-enum {
- POWER_SUPPLY_TYPE_UNKNOWN = 0,
- POWER_SUPPLY_TYPE_BATTERY,
- POWER_SUPPLY_TYPE_UPS,
- POWER_SUPPLY_TYPE_MAINS,
- POWER_SUPPLY_TYPE_USB,
-};
-
-enum dock_type {
- DOCK_NONE = 0,
- DOCK_SOUND = 7,
-};
-
struct uevent_handler {
char *subsystem;
void (*uevent_func)(struct udev_device *dev);
+++ /dev/null
-/*
- * deviced
- *
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#ifndef __DD_COMMON_H__
-#define __DD_COMMON_H__
-
-/**
- * @file dd-common.h
- * @ingroup CAPI_SYSTEM_DEVICED
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef DEPRECATED
-#define DEPRECATED __attribute__((deprecated))
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __DD_COMMON_H__ */
+++ /dev/null
-/*
- * deviced
- *
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#ifndef __DD_CONTROL_H__
-#define __DD_CONTROL_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdbool.h>
-
-/**
- * @file dd-control.h
- * @defgroup CAPI_SYSTEM_DEVICED_CONTROL_MODULE Control
- * @ingroup CAPI_SYSTEM_DEVICED
- * @brief This file provides the API to enable/disable devices
- * @section CAPI_SYSTEM_DEVICED_CONTROL_MODULE_HEADER Required Header
- * \#include <dd-control.h>
- */
-
-/**
- * @addtogroup CAPI_SYSTEM_DEVICED_CONTROL_MODULE
- * @{
- */
-
-/**
- * @par Description
- * Control Device type
- */
-enum control_device_type {
-/* Add device define here */
- DEVICE_CONTROL_MMC,
- DEVICE_CONTROL_USBCLIENT,
- DEVICE_CONTROL_BLOCK,
- DEVICE_CONTROL_MAX,
-};
-
-/**
- * @par Description:
- * This API is used to enable/disable mmc device.\n
- * @param[in] enable enable/disable mmc device
- * @return 0 on success, -1 if failed
- * @par Example
- * @code
- * ...
- * if( deviced_mmc_control(1) < 0 )
- * printf("Enable mmc device failed\n");
- * ...
- * @endcode
- */
-int deviced_mmc_control(bool enable);
-
-/**
- * @par Description:
- * This API is used to enable/disable usb device.\n
- * @param[in] enable enable/disable usb device
- * @return 0 on success, -1 if failed
- * @par Example
- * @code
- * ...
- * if( deviced_usb_control(1) < 0 )
- * printf("Enable usb device failed\n");
- * ...
- * @endcode
- */
-int deviced_usb_control(bool enable);
-
-/* Only USB-manager will use the api */
-/**
- * @par Description:
- * @return
- * @par Example
- * @code
- * @endcode
- * @todo describe function
- */
-int deviced_get_usb_control(void);
-
-/**
- * @} // end of CAPI_SYSTEM_DEVICED_CONTROL_MODULE
- */
-
-#ifdef __cplusplus
-}
-#endif
-#endif
+++ /dev/null
-/*
- * deviced
- *
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#ifndef __DD_DEVICED_MANAGED_H__
-#define __DD_DEVICED_MANAGED_H__
-
-#include <sys/time.h>
-#include "dd-mmc.h"
-
-/**
- * @file dd-deviced-managed.h
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup CAPI_SYSTEM_DEVICED
- * @{
- */
-
-/**
- * @fn int deviced_get_pid(const char *execpath)
- * @brief This API is used to get the pid of the process which has the specified execpath.\n
- * Internally, this API searches /proc/{pid}/cmdline and compares the parameter execpath with 1st argument of cmdline. \n
- * If there is no process that has same execpath in /proc/{pid}/cmdline, it will return -1.
- * @param[in] execpath program path which you want to know whether it is run or not
- * @return pid when the program is running, -1 if it is not.
- */
-int deviced_get_pid(const char *execpath);
-
-/**
- * @fn int deviced_set_datetime(time_t timet)
- * @brief This API is used to set date time.\n
- * Internally, this API call predefined action API. That is send a notify message. \n
- * @param[in] timet type of time which you want to set.
- * @return pid when the program is running, -1 if param is less than 0 or when failed set datetime.
- */
-int deviced_set_datetime(time_t timet);
-
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __DD_DEVICED_MANAGED_H__ */
+++ /dev/null
-/*
- * deviced
- *
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#ifndef __DD_DEVICED__
-#define __DD_DEVICED__
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include "dd-deviced-managed.h"
-
-/**
- * @file dd-deviced.h
- * @defgroup CAPI_SYSTEM_DEVICED_UTIL_MODULE Util
- * @ingroup CAPI_SYSTEM_DEVICED
- * @section CAPI_SYSTEM_DEVICED_UTIL_MODULE_HEADER Required Header
- * \#include <dd-deviced.h>
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup CAPI_SYSTEM_DEVICED_UTIL_MODULE
- * @{
- */
-
-/**
- * @brief Policy for low memory
- */
-enum mem_policy {
- OOM_LIKELY, /**< For miscellaneous applications */
- OOM_IGNORE /**< For daemons */
-};
-
-/* deviced_util */
-
-/**
- * @fn int deviced_get_cmdline_name(pid_t pid, char *cmdline, size_t cmdline_size)
- * @brief This API is used to get the file name of command line of the process from the proc fs.
- * Caller process MUST allocate enough memory for the cmdline parameter. \n
- * Its size should be assigned to cmdline_size. \n
- * Internally it reads the 1st argument of /proc/{pid}/cmdline and copies it to cmdline.
- * @param[in] pid pid of the process that you want to get the file name of command line
- * @param[out] cmdline command line of the process that you want to get the file name <br>
- * Callers should allocate memory to this parameter before calling this function.
- * The allocated memory size must be large enough to store the file name.
- * The result will include the terminating null byte('\0') at the end of the string.
- * @param[in] cmdline_size
- * @return 0 on success, negative value if failed.\n
- * If the size of cmdline is smaller than the result, it will return -75 and \n
- * errno will be set as EOVERFLOW. \n
- * If the function cannot open /proc/%d/cmdline file then it will return -3 and \n
- * errno will be set as ESRCH.
- */
-int deviced_get_cmdline_name(pid_t pid, char *cmdline,
- size_t cmdline_size);
-
-/**
- * @fn int deviced_get_apppath(pid_t pid, char *app_path, size_t app_path_size)
- * @brief This API is used to get the execution path of the process specified by the pid parameter.\n
- * Caller process MUST allocate enough memory for the app_path parameter. \n
- * Its size should be assigned to app_path_size. \n
- * Internally it reads a link of /proc/{pid}/exe and copies the path to app_path.
- * @param[in] pid pid of the process that you want to get the executed path
- * @param[out] app_path the executed file path of the process <br>
- * Callers should allocate memory to this parameter before calling this function.
- * The allocated memory size must be large enough to store the executed file path.
- * The result will include the terminating null byte('\0') at the end of the string.
- * @param[in] app_path_size allocated memory size of char *app_path
- * @return 0 on success, -1 if failed. \n
- * If the size of app_path is smaller than the result, it will return -1 and \n
- * errno will be set as EOVERFLOW.
- */
-int deviced_get_apppath(pid_t pid, char *app_path, size_t app_path_size);
-
-/* sysconf */
-
-/**
- * @fn int deviced_conf_set_mempolicy(enum mem_policy mempol)
- * @brief This API is used to set the policy of the current process when the phone has low available memory.
- * @param[in] mempol oom adjust value which you want to set
- * @return 0 on success, -1 if failed.
- * @see deviced_conf_set_mempolicy_bypid()
- * @retval -1 operation error
- * @retval -EBADMSG - dbus error (in case of any error on the bus)
- * @retval -EINVAL no mandatory parameters
- * @retval -ESRCH incorrect sender process id
- */
-int deviced_conf_set_mempolicy(enum mem_policy mempol);
-
-/**
- * @fn int deviced_conf_set_mempolicy_bypid(pid_t pid, enum mem_policy mempol)
- * @brief This API is used to set the policy of the given process when the phone has low available memory.
- * @param[in] pid process id which you want to set
- * @param[in] mempol oom adjust value which you want to set
- * @return 0 on success, -1 if failed.
- * @retval -1 operation error
- * @retval -EBADMSG - dbus error (in case of any error on the bus)
- * @retval -EINVAL no mandatory parameters
- * @retval -ESRCH incorrect sender process id
- */
-int deviced_conf_set_mempolicy_bypid(pid_t pid, enum mem_policy mempol);
-
-/**
- * @fn int deviced_conf_set_permanent(void)
- * @brief This API is used to set itself as a permanent process.\n
- * If the permanent process is dead, system server will relaunch the process automatically.
- * @return 0 on success, -1 if failed.
- * @see deviced_conf_set_permanent_bypid()
- * @par Example
- * @code
- * ...
- * ret = deviced_conf_set_permanent();
- * if( ret < 0 )
- * printf("Fail to set a process as permanent\n");
- * ...
- * @endcode
- */
-int deviced_conf_set_permanent(void);
-
-/**
- * @fn int deviced_conf_set_permanent_bypid(pid_t pid)
- * @brief This API is used to set a given process as permanent.\n
- * If the permanent process is dead, system server will relaunch the process automatically.
- * @param[in] pid proces id
- * @return 0 on success, -1 if failed.
- * @see deviced_set_permanent()
- * @par Example
- * @code
- * ...
- * ret = deviced_conf_set_permanent_bypid(pid);
- * if( ret < 0 )
- * printf("Fail to set a process(%d) as permanent\n",pid);
- * ...
- * @endcode
- */
-int deviced_conf_set_permanent_bypid(pid_t pid);
-
-/**
- * @fn int deviced_conf_set_vip(pid_t pid)
- * @brief This API is used to set a process which has pid as Very Important Process(VIP) .\n
- * If the VIP process is dead, restarter program will be run. \n
- * Restarter program may kill almost processes and run rc.local scripts again.
- * @param[in] pid process id to be vip
- * @return 0 on success, -1 if failed.
- * @see sysconf_is_vip
- * @par Example
- * @code
- * ...
- * ret = deviced_conf_set_vip(pid);
- * if( ret < 0 )
- * printf("Fail to set a process(%d) as VIP\n",pid);
- * ...
- * @endcode
- */
-int deviced_conf_set_vip(pid_t pid);
-
-/**
- * @fn int deviced_conf_is_vip(pid_t pid)
- * @brief This API is used to verify that process which has pid is Very Important Process(VIP) or not.
- * @param[in] pid process id to be vip
- * @return 1 if given process if vip process, otherwise 0 is returned.
- * @see deviced_conf_set_vip
- * @par Example
- * @code
- * ...
- * ret = deviced_conf_is_vip(pid);
- * if(ret)
- * printf("process(%d) is Very Important Process\n",pid);
- * ...
- * @endcode
- */
-int deviced_conf_is_vip(pid_t pid);
-
-/**
- * @fn int deviced_set_timezone(char *tzpath_str)
- * @brief This API sets system timezone.
- * @param[in] tzpath_str path to timezone definition file
- * @return 0 on success, negative value if failed.
- * @retval -1 operation error
- * @retval -EBADMSG dbus error (in case of any error on the bus)
- * @retval -EINVAL no mandatory parameters
- * @retval -ESRCH incorrect sender process id
- */
-int deviced_set_timezone(char *tzpath_str);
-
-/**
- * @fn int deviced_call_predef_action(const char *type, int num, ...)
- * @brief This API calls predefined systemd action.
- * Internally it send message through SYSTEM_NOTI_SOCKET_PATH (/tmp/sn) UNIX socket to systemd.
- * @param[in] type systemd action type name
- * @param[in] num input parameters count. num cannot exceed SYSTEM_NOTI_MAXARG (16).
- * @param[in] ... action input parameters. List of the parameters depends on action type.
- * @return 0 on success, -1 if failed.
- * If the action type is not set (is blank) or num > SYSTEM_NOTI_MAXARG it will return -1
- * and errno will be set as EINVAL.
- */
-int deviced_call_predef_action(const char *type, int num, ...);
-
-/**
- * @fn int deviced_change_flightmode(int mode)
- * @brief This API call notifies about flight mode.
- * @return 0 or positive value on success and negative value if failed.
- * @retval -1 operation error
- * @retval -EBADMSG dbus error (in case of any error on the bus)
- * @retval -EINVAL no mandatory parameters
- * @retval -ESRCH incorrect sender process id
- */
-int deviced_change_flightmode(int mode);
-
-/**
- * @fn int deviced_inform_foregrd(void)
- * @brief This API call notifies that current process is running in foreground.
- * @return 0 or positive value on success and negative value if failed.
- * @retval -1 operation error
- * @retval -EBADMSG dbus error (in case of any error on the bus)
- * @retval -EINVAL no mandatory parameters
- * @retval -ESRCH incorrect sender process id
- */
-int deviced_inform_foregrd(void);
-
-/**
- * @fn int deviced_inform_backgrd(void)
- * @brief This API call notifies that current process is running in background.
- * @return 0 or positive value on success and negative value if failed.
- * @retval -1 operation error
- * @retval -EBADMSG dbus error (in case of any error on the bus)
- * @retval -EINVAL no mandatory parameters
- * @retval -ESRCH incorrect sender process id
- */
-int deviced_inform_backgrd(void);
-
-/**
- * @fn int deviced_inform_active(pid_t pid)
- * @brief This API call notifies deviced daemon that given process (pid) is active.
- * @param[in] pid process pid
- * @return 0 or positive value on success and negative value if failed.
- * @retval -1 operation error
- * @retval -EBADMSG dbus error (in case of any error on the bus)
- * @retval -EINVAL no mandatory parameters
- * @retval -ESRCH incorrect sender process id
- */
-int deviced_inform_active(pid_t pid);
-
-/**
- * @fn int deviced_inform_active(pid_t pid)
- * @brief This API call notifies deviced daemon that given process (pid) is inactive.
- * @param[in] pid process pid
- * @return 0 or positive value on success and negative value if failed.
- * @retval -1 operation error
- * @retval -EBADMSG dbus error (in case of any error on the bus)
- * @retval -EINVAL no mandatory parameters
- * @retval -ESRCH incorrect sender process id
- */
-int deviced_inform_inactive(pid_t pid);
-
-/**
- * @fn int deviced_request_poweroff(void)
- * @brief This API call requests deviced daemon to launch "system poweroff popup".
- * @return 0 or positive value on success and negative value if failed.
- * @retval -1 operation error
- * @retval -EBADMSG dbus error (in case of any error on the bus)
- * @retval -EINVAL no mandatory parameters
- * @retval -ESRCH incorrect sender process id
- */
-int deviced_request_poweroff(void);
-
-/**
- * @fn deviced_request_entersleep(void)
- * @brief This API call requests deviced daemon to enter system into sleep mode.
- * @return 0 or positive value on success and negative value if failed.
- * @retval -EBADMSG dbus error (in case of any error on the bus)
- * @retval -EINVAL no mandatory parameters
- * @retval -ESRCH incorrect sender process id
- */
-int deviced_request_entersleep(void);
-
-/**
- * @fn int deviced_request_leavesleep(void)
- * @brief This API calls requests deviced daemon to leave by system "sleep" mode and enter into "normal" mode.
- * @return 0 or positive value on success and negative value if failed.
- * @retval -EBADMSG dbus error (in case of any error on the bus)
- * @retval -EINVAL no mandatory parameters
- * @retval -ESRCH incorrect sender process id
- */
-int deviced_request_leavesleep(void);
-
-/**
- * @fn int deviced_request_reboot(void)
- * @brief This API call requests deviced daemon to initiate system reboot.
- * @return 0 on success and negative value if failed.
- * @retval -EBADMSG dbus error (in case of any error on the bus)
- * @retval -EINVAL no mandatory parameters
- * @retval -ESRCH incorrect sender process id
- */
-int deviced_request_reboot(void);
-
-/**
- * @fn int deviced_request_set_cpu_max_frequency(int val)
- * @brief This API call requests deviced daemon to set maximum CPU frequency.
- * @param[in] val maximum CPU frequency to be set.
- * @return 0 or positive value on success and negative value if failed.
- * @retval -1 operation error
- * @retval -EBADMSG - dbus error (in case of any error on the bus)
- */
-int deviced_request_set_cpu_max_frequency(int val);
-
-/**
- * @fn int deviced_request_set_cpu_min_frequency(int val)
- * @brief This API call requests deviced daemon to set minimum CPU frequency.
- * @param[in] val minimum CPU frequency to be set
- * @return 0 or positive value on success and negative value if failed.
- * @retval -1 operation error
- * @retval -EBADMSG dbus error (in case of any error on the bus)
- */
-int deviced_request_set_cpu_min_frequency(int val);
-
-/**
- * @fn int deviced_release_cpu_max_frequency(void)
- * @brief This API call releases limit of maximum CPU frequency set by deviced_request_set_cpu_max_frequency() API.
- * @return 0 or positive value on success and negative value if failed.
- * @retval -1 operation error
- * @retval -EBADMSG dbus error (in case of any error on the bus)
- */
-int deviced_release_cpu_max_frequency(void);
-
-/**
- * @fn int deviced_release_cpu_min_frequency(void)
- * @brief This API calls releases limit of minimum CPU frequency set by deviced_request_set_cpu_min_frequency() API.
- * @return 0 or positive value on success and negative value if failed.
- * @retval -1 operation error
- * @retval -EBADMSG dbus error (in case of any error on the bus)
- */
-int deviced_release_cpu_min_frequency(void);
-
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __DD_DEVICED__ */
+++ /dev/null
-/*
- * deviced
- *
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#ifndef __TIZEN_SYSTEM_DEVICED_DOC_H__
-#define __TIZEN_SYSTEM_DEVICED_DOC_H__
-
-/**
- * @defgroup CAPI_SYSTEM_DEVICED deviced
- * @brief The deviced APIs provide functions to control devices.
- * @ingroup CAPI_SYSTEM_FRAMEWORK
- * @section CAPI_SYSTEM_DEVICED_HEADER Required Header
- * \#include <dd-deviced-managed.h>
- *
- * @section CAPI_SYSTEM_SYSTEM_DEVICED_OVERVIEW Overview
- * Provides access to a set of device like battery, display, haptic, LED, etc.
- * The state of the device is changed or obtained by using APIs provided.
- *
- * - battery percentage, full charging state, etc.
- * - brightness control, enhance mode setting, display lock/unlock, etc.
- * - haptic play
- * - service led control
- * - other devices
- *
- */
-
-#endif /* __TIZEN_SYSTEM_DEVICED_DOC_H__ */
/*
- * deviced
+ * PASS (Power Aware System Service)
*
- * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2012 - 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
#define PASS_CPU_STATS_MAX_COUNT 20
/*
- * FIXME: Current notifier of deviced didn't pass separate user_data parameter
+ * FIXME: Current notifier of PASS didn't pass separate user_data parameter
* on callback function. So, PASS must need global pass_policy instance. This
- * code must be modified after changing deviced's notifier feature.
+ * code must be modified after changing PASS's notifier feature.
*/
static struct pass_policy *policy_pmqos[PASS_CLUSTER_MAX];
static int num_policy_pmqos = 0;
pass_notifier_booting_done);
/*
- * FIXME: Current notifier of deviced didn't pass separate user_data
+ * FIXME: Current notifier of PASS didn't pass separate user_data
* parameter on callback function. So, PASS must need global pass_policy
- * instance. This code must be modified after changing deviced's
+ * instance. This code must be modified after changing PASS's
* notifier feature.
*/
policy_pmqos[num_policy_pmqos++] = policy;
/*
- * deviced
+ * PASS (Power Aware System Service)
*
- * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2012 - 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
/*
- * deviced
+ * PASS (Power Aware Systerm Service)
*
- * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2012 - 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
/*
- * deviced
+ * PASS (Power Aware System Service)
*
- * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2012 - 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
/*
- * deviced
+ * PASS (Power Aware System Service)
*
- * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2012 - 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
/*
- * deviced
+ * PASS (Power Aware System Service)
*
- * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2012 - 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
/*
- * deviced
+ * PASS (Power Aware System Service)
*
- * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2012 - 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
/*
- * deviced
+ * PASS (Power Aware System Service)
*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
/*
- * deviced
+ * PASS (Power Aware System Service)
*
* Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
/*
- * deviced
+ * PASS (Power Aware System Service)
*
- * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2012 - 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
/*
* Initialize pass cluster data by parsing pass.conf
*/
- ret = get_pass_cluster(&cluster, "/etc/deviced/pass.conf");
+ ret = get_pass_cluster(&cluster, "/etc/pass/pass.conf");
if (ret < 0) {
- _E("cannot parse /etc/deviced/pass.conf\n");
+ _E("cannot parse /etc/pass/pass.conf\n");
return;
}
[CpuCluster0]
pass_cpu_cluster_id=0
pass_cpu_cluster_first_cpu=0
-pass_cpu_cluster_path_conf_file=/etc/deviced/pass-cluster0.conf
+pass_cpu_cluster_path_conf_file=/etc/pass/pass-cluster0.conf
pass_cpu_cluster_path_load_table=/sys/kernel/debug/cpufreq/cpu0/load_table
[CpuCluster1]
pass_cpu_cluster_id=1
pass_cpu_cluster_first_cpu=4
-pass_cpu_cluster_path_conf_file=/etc/deviced/pass-cluster1.conf
+pass_cpu_cluster_path_conf_file=/etc/pass/pass-cluster1.conf
pass_cpu_cluster_path_load_table=/sys/kernel/debug/cpufreq/cpu4/load_table
/*
- * deviced
+ * PASS (Power Aware System Service)
*
- * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2012 - 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
/*
- * PASS
+ * PASS (Power Aware System Service)
*
* Copyright (c) 2012 - 2017 Samsung Electronics Co., Ltd.
*
/*
- * deviced
+ * PASS (Power Aware System Service)
*
* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
*
#define DEFAULT_PMQOS_TIMER 3000
-#define PMQOS_CONF_PATH "/etc/deviced/pmqos.conf"
+#define PMQOS_CONF_PATH "/etc/pass/pmqos.conf"
#define MILLISECONDS(tv) ((tv.tv_sec)*1000 + (tv.tv_nsec)/1000000)
#define DELTA(a, b) (MILLISECONDS(a) - MILLISECONDS(b))
_I("booting done");
/* register edbus methods */
- ret = register_edbus_method(DEVICED_PATH_PMQOS, edbus_methods, ARRAY_SIZE(edbus_methods));
+ ret = register_edbus_method(DEVICED_PATH_PMQOS, edbus_methods,
+ ARRAY_SIZE(edbus_methods));
if (ret < 0)
_E("fail to init edbus method(%d)", ret);
/*
- * deviced
+ * PASS (Power Aware System Service)
*
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
+++ /dev/null
-/*
- * deviced
- *
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#include <fcntl.h>
-
-#include "core/log.h"
-#include "core/devices.h"
-#include "core/edbus-handler.h"
-#include "core/common.h"
-
-#define METHOD_GET_REVISION "GetRevision"
-#define PATH_NAME "/proc/cpuinfo"
-#define REVISION_NAME "Revision"
-#define TOK_DELIMITER ":"
-#define END_DELIMITER " \n"
-
-#define CONVERT_TYPE 10
-#define REVISION_SIZE 4
-#define FILE_BUFF_MAX 1024
-#define NOT_INITIALIZED (-1)
-
-static int read_from_file(const char *path, char *buf, size_t size)
-{
- int fd;
- size_t count;
-
- if (!path)
- return -1;
-
- fd = open(path, O_RDONLY, 0);
- if (fd == -1) {
- _E("Could not open '%s'", path);
- return -1;
- }
-
- count = read(fd, buf, size);
-
- if ((int)count != -1 && count > 0) {
- count = (count < size) ? count : size - 1;
- while (count > 0 && buf[count - 1] == '\n')
- count--;
- buf[count] = '\0';
- } else {
- buf[0] = '\0';
- }
-
- close(fd);
-
- return 0;
-}
-
-static int get_revision(char *rev, int len)
-{
- char buf[FILE_BUFF_MAX];
- char *tag;
- char *start, *ptr;
- char *saveptr;
- long rev_num;
- const int radix = 16;
-
- if (rev == NULL || len <= 0) {
- _E("Invalid argument !\n");
- return -1;
- }
-
- if (read_from_file(PATH_NAME, buf, FILE_BUFF_MAX) < 0) {
- _E("fail to read %s\n", PATH_NAME);
- return -1;
- }
-
- tag = strstr(buf, REVISION_NAME);
- if (tag == NULL) {
- _E("cannot find Hardware in %s\n", PATH_NAME);
- return -1;
- }
-
- start = strstr(tag, TOK_DELIMITER);
- if (start == NULL) {
- _E("cannot find Hardware in %s\n", PATH_NAME);
- return -1;
- }
-
- start++;
- ptr = strtok_r(start, END_DELIMITER, &saveptr);
- if (!ptr) {
- _E("fail to extract tokens");
- return -1;
- }
- ptr += strlen(ptr);
- ptr -= 2;
-
- memset(rev, 0x00, REVISION_SIZE);
- rev_num = strtol(ptr, NULL, radix);
- snprintf(rev, len, "%ld", rev_num);
-
- return 0;
-}
-
-static DBusMessage *dbus_revision_handler(E_DBus_Object *obj, DBusMessage *msg)
-{
- DBusMessageIter iter;
- DBusMessage *reply;
- char rev[FILE_BUFF_MAX];
- char *ptr;
- static int ret = NOT_INITIALIZED;
-
- if (ret != NOT_INITIALIZED)
- goto out;
- ret = get_revision(rev, sizeof(rev));
- if (ret == 0)
- ret = strtol(rev, &ptr, CONVERT_TYPE);
-out:
- _D("rev : %d", ret);
-
- reply = dbus_message_new_method_return(msg);
- dbus_message_iter_init_append(reply, &iter);
- dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &ret);
- return reply;
-}
-
-static const struct edbus_method edbus_methods[] = {
- { METHOD_GET_REVISION, NULL, "i", dbus_revision_handler },
-};
-
-static void cpu_info_init(void *data)
-{
- int ret;
-
- ret = register_edbus_method(DEVICED_PATH_SYSNOTI, edbus_methods, ARRAY_SIZE(edbus_methods));
- if (ret < 0)
- _E("fail to init edbus method(%d)", ret);
-}
-
-static const struct device_ops cpu_info_device_ops = {
- .name = "cpu_info",
- .init = cpu_info_init,
-};
-
-DEVICE_OPS_REGISTER(&cpu_info_device_ops)
+++ /dev/null
-/*
- * deviced
- *
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#include <stdio.h>
-#include <unistd.h>
-//#include <dirent.h>
-//#include <sys/types.h>
-//#include <device-node.h>
-//#include <sys/un.h>
-//#include <stdarg.h>
-#include <errno.h>
-#include <vconf.h>
-//#include <fcntl.h>
-
-#include "core/log.h"
-#include "core/common.h"
-#include "core/devices.h"
-#include "core/device-notifier.h"
-#include "core/edbus-handler.h"
-#include "shared/score-defines.h"
-
-#define OOMADJ_SET "oomadj_set"
-#define OOM_PMQOS_TIME 2000 /* ms */
-#define SIGNAL_PROC_STATUS "ProcStatus"
-
-enum proc_status_type {
- PROC_STATUS_LAUNCH,
- PROC_STATUS_RESUME,
- PROC_STATUS_TERMINATE,
- PROC_STATUS_FOREGROUND,
- PROC_STATUS_BACKGROUND,
-};
-
-static void memcg_move_group(int pid, int oom_score_adj)
-{
- char buf[100];
- FILE *f;
- int size;
- char exe_name[PATH_MAX];
-
- if (get_cmdline_name(pid, exe_name, PATH_MAX) != 0) {
- _E("fail to get process name(%d)", pid);
- return;
- }
-
- _SD("memcg_move_group : %s, pid = %d", exe_name, pid);
- if (oom_score_adj >= OOMADJ_BACKGRD_LOCKED)
- snprintf(buf, sizeof(buf), "/sys/fs/cgroup/memory/background/cgroup.procs");
- else if (oom_score_adj >= OOMADJ_FOREGRD_LOCKED && oom_score_adj < OOMADJ_BACKGRD_LOCKED)
- snprintf(buf, sizeof(buf), "/sys/fs/cgroup/memory/foreground/cgroup.procs");
- else
- return;
-
- f = fopen(buf, "w");
- if (f == NULL)
- return;
- size = snprintf(buf, sizeof(buf), "%d", pid);
- if (fwrite(buf, size, 1, f) != 1)
- _E("fwrite cgroup tasks : %d", pid);
- fclose(f);
-}
-
-int set_oom_score_adj_action(int argc, char **argv)
-{
- FILE *fp;
- int pid = -1;
- int new_oom_score_adj = 0;
-
- if (argc < 2)
- return -1;
- pid = atoi(argv[0]);
- new_oom_score_adj = atoi(argv[1]);
- if (pid < 0 || new_oom_score_adj <= -20)
- return -1;
-
- _I("OOMADJ_SET : pid %d, new_oom_score_adj %d", pid, new_oom_score_adj);
-
- fp = open_proc_oom_score_adj_file(pid, "w");
- if (fp == NULL)
- return -1;
- if (new_oom_score_adj < OOMADJ_SU)
- new_oom_score_adj = OOMADJ_SU;
- fprintf(fp, "%d", new_oom_score_adj);
- fclose(fp);
-
- memcg_move_group(pid, new_oom_score_adj);
- return 0;
-}
-
-static DBusMessage *dbus_oom_handler(E_DBus_Object *obj, DBusMessage *msg)
-{
- DBusError err;
- DBusMessageIter iter;
- DBusMessage *reply;
- pid_t pid;
- int ret;
- int argc;
- char *type_str;
- char *argv[2];
-
- dbus_error_init(&err);
-
- if (!dbus_message_get_args(msg, &err,
- DBUS_TYPE_STRING, &type_str,
- DBUS_TYPE_INT32, &argc,
- DBUS_TYPE_STRING, &argv[0],
- DBUS_TYPE_STRING, &argv[1], DBUS_TYPE_INVALID)) {
- _E("there is no message");
- ret = -EINVAL;
- goto out;
- }
-
- if (argc < 0) {
- _E("message is invalid!");
- ret = -EINVAL;
- goto out;
- }
-
- pid = get_edbus_sender_pid(msg);
- if (kill(pid, 0) == -1) {
- _E("%d process does not exist, dbus ignored!", pid);
- ret = -ESRCH;
- goto out;
- }
-
- if (strncmp(type_str, OOMADJ_SET, strlen(OOMADJ_SET)) == 0)
- ret = set_oom_score_adj_action(argc, (char **)&argv);
- else
- ret = -EINVAL;
-
-out:
- reply = dbus_message_new_method_return(msg);
- dbus_message_iter_init_append(reply, &iter);
- dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &ret);
-
- return reply;
-}
-
-static void proc_signal_handler(void *data, DBusMessage *msg)
-{
- DBusError err;
- int ret, type;
- pid_t pid;
-
- ret = dbus_message_is_signal(msg, RESOURCED_INTERFACE_PROCESS,
- SIGNAL_PROC_STATUS);
- if (!ret) {
- _E("It's not active signal!");
- return;
- }
-
- dbus_error_init(&err);
-
- if (dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &type,
- DBUS_TYPE_INT32, &pid, DBUS_TYPE_INVALID) == 0) {
- _E("There's no arguments!");
- return;
- }
-
- if (type == PROC_STATUS_BACKGROUND)
- device_notify(DEVICE_NOTIFIER_PROCESS_BACKGROUND, &pid);
- if (type == PROC_STATUS_FOREGROUND)
- device_notify(DEVICE_NOTIFIER_PROCESS_FOREGROUND, &pid);
-}
-
-static const struct edbus_method edbus_methods[] = {
- { OOMADJ_SET, "siss", "i", dbus_oom_handler },
-};
-
-static void proc_change_lowmemory(keynode_t *key, void *data)
-{
- int state = 0;
-
- if (vconf_get_int(VCONFKEY_SYSMAN_LOW_MEMORY, &state))
- return;
-
- if (state == VCONFKEY_SYSMAN_LOW_MEMORY_HARD_WARNING)
- device_notify(DEVICE_NOTIFIER_PMQOS_OOM, (void *)OOM_PMQOS_TIME);
-}
-
-static void process_init(void *data)
-{
- int ret;
-
- register_edbus_signal_handler(RESOURCED_PATH_PROCESS,
- RESOURCED_INTERFACE_PROCESS, SIGNAL_PROC_STATUS, proc_signal_handler);
-
- ret = register_edbus_method(DEVICED_PATH_PROCESS, edbus_methods, ARRAY_SIZE(edbus_methods));
- if (ret < 0)
- _E("fail to init edbus method(%d)", ret);
-
- vconf_notify_key_changed(VCONFKEY_SYSMAN_LOW_MEMORY,
- proc_change_lowmemory, NULL);
-}
-
-static const struct device_ops process_device_ops = {
- .name = "process",
- .init = process_init,
-};
-
-DEVICE_OPS_REGISTER(&process_device_ops)
SET(SHARED_SRCS
dbus.c
- deviced-systemd.c
)
INCLUDE(FindPkgConfig)
/*
- * deviced
+ * PASS (Power Aware System Service)
*
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * deviced
+ * PASS (Power Aware System Service)
*
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
_E("no message : [%s:%s]", err.name, err.message);
if (data->func) {
- dbus_set_error(&err, "org.tizen.system.deviced.NoReply",
+ dbus_set_error(&err, "org.tizen.system.pass.NoReply",
"There was no reply to this method call");
data->func(data->data, NULL, &err);
dbus_error_free(&err);
/*
- * deviced
+ * PASS
*
* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
*
/*
* Device daemon
*/
-#define DEVICED_BUS_NAME "org.tizen.system.pass"
-#define DEVICED_OBJECT_PATH "/Org/Tizen/System/Pass"
+#define DEVICED_BUS_NAME "org.tizen.system.deviced"
+#define DEVICED_OBJECT_PATH "/Org/Tizen/System/Deviced"
#define DEVICED_INTERFACE_NAME DEVICED_BUS_NAME
/* Core service: get/set device status operations about device */
#define DEVICED_PATH_CORE DEVICED_OBJECT_PATH"/Core"
#define DEVICED_INTERFACE_CORE DEVICED_INTERFACE_NAME".core"
-/* Display service: start/stop display(pm), get/set brightness operations about display */
-#define DEVICED_PATH_DISPLAY DEVICED_OBJECT_PATH"/Display"
-#define DEVICED_INTERFACE_DISPLAY DEVICED_INTERFACE_NAME".display"
-/* Pass service: start/stop pass operations about pass */
+/* PASS service: start/stop pass operations about pass */
#define DEVICED_PATH_PASS DEVICED_OBJECT_PATH"/Pass"
#define DEVICED_INTERFACE_PASS DEVICED_INTERFACE_NAME".pass"
-/* Hall service: get hall status operations about hall */
-#define DEVICED_PATH_HALL DEVICED_OBJECT_PATH"/Hall"
-#define DEVICED_INTERFACE_HALL DEVICED_INTERFACE_NAME".hall"
-/* Power service: set resetkey disable operations about power */
-#define DEVICED_PATH_POWER DEVICED_OBJECT_PATH"/Power"
-#define DEVICED_INTERFACE_POWER DEVICED_INTERFACE_NAME".power"
-/* Storage service: get storage size operatioins about storage */
-#define DEVICED_PATH_STORAGE DEVICED_OBJECT_PATH"/Storage"
-#define DEVICED_INTERFACE_STORAGE DEVICED_INTERFACE_NAME".storage"
-/* ODE service: request ode popup result operatioins about storage */
-#define DEVICED_PATH_ODE DEVICED_OBJECT_PATH"/Ode"
-#define DEVICED_INTERFACE_ODE DEVICED_INTERFACE_NAME".ode"
-/* Lowmem service: get critical low status operations about Lowmem */
-#define DEVICED_PATH_LOWMEM DEVICED_OBJECT_PATH"/Lowmem"
-#define DEVICED_INTERFACE_LOWMEM DEVICED_INTERFACE_NAME".lowmem"
-/* Poweroff service: get power off status operations about Poweroff */
-#define DEVICED_PATH_POWEROFF DEVICED_OBJECT_PATH"/PowerOff"
-#define DEVICED_INTERFACE_POWEROFF DEVICED_INTERFACE_NAME".PowerOff"
-/* Led service: play/stop led operations about led */
-#define DEVICED_PATH_LED DEVICED_OBJECT_PATH"/Led"
-#define DEVICED_INTERFACE_LED DEVICED_INTERFACE_NAME".Led"
-/* Block service: manage block device */
-#define STORAGE_BUS_NAME "org.tizen.system.storage"
-#define STORAGE_OBJECT_PATH "/Org/Tizen/System/Storage"
-#define STORAGE_INTERFACE_NAME STORAGE_BUS_NAME
-#define DEVICED_PATH_BLOCK STORAGE_OBJECT_PATH"/Block"
-#define DEVICED_PATH_BLOCK_MANAGER DEVICED_PATH_BLOCK"/Manager"
-#define DEVICED_INTERFACE_BLOCK_MANAGER STORAGE_INTERFACE_NAME".BlockManager"
-/* MMC service: mount/unmount/format mmc operations about mmc */
-#define DEVICED_PATH_MMC DEVICED_OBJECT_PATH"/Mmc"
-#define DEVICED_INTERFACE_MMC DEVICED_INTERFACE_NAME".Mmc"
-/* Process service: operations about process */
-#define DEVICED_PATH_PROCESS DEVICED_OBJECT_PATH"/Process"
-#define DEVICED_INTERFACE_PROCESS DEVICED_INTERFACE_NAME".Process"
-/* Key service: operations about key */
-#define DEVICED_PATH_KEY DEVICED_OBJECT_PATH"/Key"
-#define DEVICED_INTERFACE_KEY DEVICED_INTERFACE_NAME".Key"
-/* USB client service: change usb connection mode */
-#define DEVICED_PATH_USB DEVICED_OBJECT_PATH"/Usb"
-#define DEVICED_INTERFACE_USB DEVICED_INTERFACE_NAME".Usb"
-/* USB start/stop service: operations about usb start/stop */
-#define DEVICED_PATH_USB_CONTROL DEVICED_OBJECT_PATH"/UsbControl"
-#define DEVICED_INTERFACE_USB_CONTROL DEVICED_INTERFACE_NAME".UsbControl"
-/* USB host service: operations about usb start/stop */
-#define DEVICED_PATH_USBHOST DEVICED_OBJECT_PATH"/Usbhost"
-#define DEVICED_INTERFACE_USBHOST DEVICED_INTERFACE_NAME".Usbhost"
-/* Cpu service: operations about cpu */
+
#define DEVICED_PATH_CPU DEVICED_OBJECT_PATH"/Cpu"
#define DEVICED_INTERFACE_CPU DEVICED_INTERFACE_NAME".Cpu"
/* PmQos service: operations about pmqos */
/* Sysnoti service */
#define DEVICED_PATH_SYSNOTI DEVICED_OBJECT_PATH"/SysNoti"
#define DEVICED_INTERFACE_SYSNOTI DEVICED_INTERFACE_NAME".SysNoti"
-/* ExtCon service */
-#define DEVICED_PATH_EXTCON DEVICED_OBJECT_PATH"/ExtCon"
-#define DEVICED_INTERFACE_EXTCON DEVICED_INTERFACE_NAME".ExtCon"
-/* Battery service */
-#define DEVICED_PATH_BATTERY DEVICED_OBJECT_PATH"/Battery"
-#define DEVICED_INTERFACE_BATTERY DEVICED_INTERFACE_NAME".Battery"
-/* Time service */
-#define DEVICED_PATH_TIME DEVICED_OBJECT_PATH"/Time"
-#define DEVICED_INTERFACE_TIME DEVICED_INTERFACE_NAME".Time"
-/* IR service */
-#define DEVICED_PATH_IR DEVICED_OBJECT_PATH"/Ir"
-#define DEVICED_INTERFACE_IR DEVICED_INTERFACE_NAME".ir"
-/* USB_HOST_TEST service */
-#define DEVICED_PATH_USB_HOST_TEST DEVICED_OBJECT_PATH"/UsbHostTest"
-#define DEVICED_INTERFACE_USB_HOST_TEST DEVICED_INTERFACE_NAME".UsbHostTest"
-
-/* Apps service */
-#define DEVICED_PATH_APPS DEVICED_OBJECT_PATH"/Apps"
-#define DEVICED_INTERFACE_APPS DEVICED_INTERFACE_NAME".Apps"
-
-/* GPIO service: status check about gpio */
-#define DEVICED_PATH_GPIO DEVICED_OBJECT_PATH"/Gpio"
-#define DEVICED_INTERFACE_GPIO DEVICED_INTERFACE_NAME".Gpio"
-
-/* HDMICEC service: status check about gpio */
-#define DEVICED_PATH_HDMICEC DEVICED_OBJECT_PATH"/HdmiCec"
-#define DEVICED_INTERFACE_HDMICEC DEVICED_INTERFACE_NAME".HdmiCec"
-
-/* Tzip service: Archive file system */
-#define DEVICED_PATH_TZIP DEVICED_OBJECT_PATH"/Tzip"
-#define DEVICED_INTERFACE_TZIP DEVICED_INTERFACE_NAME".Tzip"
-
-/*
- * Vibrator daemon
- */
-#define VIBRATOR_BUS_NAME "org.tizen.system.vibrator"
-#define VIBRATOR_OBJECT_PATH "/Org/Tizen/System/Vibrator"
-#define VIBRATOR_INTERFACE_NAME VIBRATOR_BUS_NAME
-/* Core service: get/set device status operations about device */
-#define VIBRATOR_PATH_CORE VIBRATOR_OBJECT_PATH"/Core"
-#define VIBRATOR_INTERFACE_CORE VIBRATOR_INTERFACE_NAME".core"
-
-#define VIBRATOR_PATH_HAPTIC VIBRATOR_OBJECT_PATH"/Haptic"
-#define VIBRATOR_INTERFACE_HAPTIC VIBRATOR_INTERFACE_NAME".haptic"
-
-/*
- * Resource daemon
- */
-#define RESOURCED_BUS_NAME "org.tizen.resourced"
-#define RESOURCED_OBJECT_PATH "/Org/Tizen/ResourceD"
-#define RESOURCED_INTERFACE_NAME RESOURCED_BUS_NAME
-
-#define RESOURCED_PATH_PROCESS RESOURCED_OBJECT_PATH"/Process"
-#define RESOURCED_INTERFACE_PROCESS RESOURCED_INTERFACE_NAME".process"
-#define RESOURCED_METHOD_ACTIVE "Active"
-
-/*
- * Popup launcher
- */
-#define POPUP_BUS_NAME "org.tizen.system.popup"
-#define POPUP_OBJECT_PATH "/Org/Tizen/System/Popup"
-#define POPUP_INTERFACE_NAME POPUP_BUS_NAME
-/* LED */
-#define POPUP_PATH_LED POPUP_OBJECT_PATH"/Led"
-#define POPUP_INTERFACE_LED POPUP_INTERFACE_NAME".Led"
-/* Notification */
-#define POPUP_PATH_NOTI POPUP_OBJECT_PATH"/Noti"
-#define POPUP_INTERFACE_NOTI POPUP_INTERFACE_NAME".Noti"
-/* Power key longpress */
-#define POPUP_PATH_POWERKEY POPUP_OBJECT_PATH"/Powerkey"
-#define POPUP_INTERFACE_POWERKEY POPUP_INTERFACE_NAME".Powerkey"
-/* Low battery */
-#define POPUP_PATH_LOWBAT POPUP_OBJECT_PATH"/Lowbat"
-#define POPUP_INTERFACE_LOWBAT POPUP_INTERFACE_NAME".Lowbat"
-/* Low memory */
-#define POPUP_PATH_LOWMEM POPUP_OBJECT_PATH"/Lowmem"
-#define POPUP_INTERFACE_LOWMEM POPUP_INTERFACE_NAME".Lowmem"
-/* MMC */
-#define POPUP_PATH_MMC POPUP_OBJECT_PATH"/Mmc"
-#define POPUP_INTERFACE_MMC POPUP_INTERFACE_NAME".Mmc"
-/* USB */
-#define POPUP_PATH_USB POPUP_OBJECT_PATH"/Usb"
-#define POPUP_INTERFACE_USB POPUP_INTERFACE_NAME".Usb"
-/* USB otg */
-#define POPUP_PATH_USBOTG POPUP_OBJECT_PATH"/Usbotg"
-#define POPUP_INTERFACE_USBOTG POPUP_INTERFACE_NAME".Usbotg"
-/* USB host */
-#define POPUP_PATH_USBHOST POPUP_OBJECT_PATH"/Usbhost"
-#define POPUP_INTERFACE_USBHOST POPUP_INTERFACE_NAME".Usbhost"
-/* System */
-#define POPUP_PATH_SYSTEM POPUP_OBJECT_PATH"/System"
-#define POPUP_INTERFACE_SYSTEM POPUP_INTERFACE_NAME".System"
-/* Crash */
-#define POPUP_PATH_CRASH POPUP_OBJECT_PATH"/Crash"
-#define POPUP_INTERFACE_CRASH POPUP_INTERFACE_NAME".Crash"
-/* ODE */
-#define POPUP_PATH_ODE POPUP_OBJECT_PATH"/Ode"
-#define POPUP_INTERFACE_ODE POPUP_INTERFACE_NAME".Ode"
-/* Servant */
-#define POPUP_PATH_SERVANT POPUP_OBJECT_PATH"/Servant"
-#define POPUP_IFACE_SERVANT POPUP_INTERFACE_NAME".Servant"
-
-#define POPUP_PATH_APP POPUP_OBJECT_PATH"/Apps"
-#define POPUP_IFACE_APP POPUP_BUS_NAME".Apps"
-
-#define POPUP_METHOD_LAUNCH "PopupLaunch"
-#define POPUP_METHOD_TERMINATE "AppTerminateByPid"
-#define POPUP_KEY_CONTENT "_SYSPOPUP_CONTENT_"
-
-/*
- * Crash daemon
- */
-#define CRASHD_BUS_NAME "org.tizen.system.crashd"
-#define CRASHD_OBJECT_PATH "/Org/Tizen/System/CrashD"
-#define CRASHD_INTERFACE_NAME CRASHD_BUS_NAME
-
-#define CRASHD_PATH_CRASH CRASHD_OBJECT_PATH"/Crash"
-#define CRASHD_INTERFACE_CRASH CRASHD_INTERFACE_NAME".Crash"
struct dbus_byte {
const unsigned char *data;
+++ /dev/null
-/*
- * deviced
- *
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#ifndef ___DEVICED_INTERNAL___
-#define ___DEVICED_INTERNAL___
-#include <sys/types.h>
-#include "dd-deviced.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* This file will be removed */
-
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* ___DEVICED_INTERNAL___ */
/*
- * deviced
+ * PASS (Power Aware System Service)
*
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
+++ /dev/null
-/*
- * deviced
- *
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#ifndef __DEVICED_SYSTEMD_H__
-#define __DEVICED_SYSTEMD_H__
-
-#include <dbus/dbus.h>
-#include <gio/gio.h>
-
-#define DBUS_IFACE_DBUS_PROPERTIES DBUS_SERVICE_DBUS ".Properties"
-
-#define SYSTEMD_DBUS_DEST "org.freedesktop.systemd1"
-#define SYSTEMD_DBUS_IFACE_MANAGER SYSTEMD_DBUS_DEST ".Manager"
-#define SYSTEMD_DBUS_IFACE_UNIT SYSTEMD_DBUS_DEST ".Unit"
-#define SYSTEMD_DBUS_IFACE_SERVICE SYSTEMD_DBUS_DEST ".Service"
-#define SYSTEMD_DBUS_IFACE_TARGET SYSTEMD_DBUS_DEST ".Target"
-
-#define SYSTEMD_DBUS_PATH "/org/freedesktop/systemd1"
-#define SYSTEMD_DBUS_UNIT_PATH SYSTEMD_DBUS_PATH "/unit/"
-
-int deviced_systemd_start_unit(char *name);
-int deviced_systemd_stop_unit(char *name);
-
-int deviced_systemd_get_manager_property(const char *iface, const char *property, GVariant **variant);
-int deviced_systemd_get_unit_property(const char *unit, const char *property, GVariant **variant);
-int deviced_systemd_get_service_property(const char* unit, const char* property, GVariant **variant);
-
-int deviced_systemd_get_manager_property_as_int32(const char *iface, const char *property, int *result);
-int deviced_systemd_get_manager_property_as_uint32(const char *iface, const char *property, unsigned int *result);
-int deviced_systemd_get_manager_property_as_int64(const char *iface, const char *property, long long *result);
-int deviced_systemd_get_manager_property_as_uint64(const char *iface, const char *property, unsigned long long *result);
-int deviced_systemd_get_manager_property_as_string(const char *iface, const char *property, char **result);
-int deviced_systemd_get_unit_property_as_int32(const char *unit, const char *property, int *result);
-int deviced_systemd_get_unit_property_as_uint32(const char *unit, const char *property, unsigned int *result);
-int deviced_systemd_get_unit_property_as_int64(const char *unit, const char *property, long long *result);
-int deviced_systemd_get_unit_property_as_uint64(const char *unit, const char *property, unsigned long long *result);
-int deviced_systemd_get_unit_property_as_string(const char *unit, const char *property, char **result);
-int deviced_systemd_get_service_property_as_int32(const char *unit, const char *property, int *result);
-int deviced_systemd_get_service_property_as_uint32(const char *unit, const char *property, unsigned int *result);
-int deviced_systemd_get_service_property_as_int64(const char *unit, const char *property, long long *result);
-int deviced_systemd_get_service_property_as_uint64(const char *unit, const char *property, unsigned long long *result);
-int deviced_systemd_get_service_property_as_string(const char *unit, const char *property, char **result);
-
-int deviced_systemd_instance_new_from_template(const char *template, const char *instance, const char **name);
-
-#endif
/*
- * deviced
+ * PASS (Power Aware System Service)
*
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
/*
- * deviced
+ * PASS (Power Aware System Service)
*
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
#ifndef __LOG_H__
#define __LOG_H__
-#ifdef ENABLE_LIBDEVICED_DLOG
+#ifdef ENABLE_LIBPASS_DLOG
#define ENABLE_DLOG
#endif
-#define LOG_TAG "DEVICED"
+#define LOG_TAG "PASS"
#include "shared/log-macro.h"
#endif
/*
- * deviced
+ * PASS
*
* Copyright (c) 2014 Samsung Electronics Co., Ltd.
*
#include "common.h"
#include "dbus.h"
-#include "deviced-systemd.h"
+#include "pass-systemd.h"
#include "core/log.h"
#define g_variant_get_function_string(v) g_variant_dup_string(v, NULL)
-static int deviced_systemd_proxy_call_sync(const char *name,
+static int pass_systemd_proxy_call_sync(const char *name,
const char *path,
const char *iface,
const char *method,
return 0;
}
-static int deviced_systemd_start_or_stop_unit(char *method, char *name)
+static int pass_systemd_start_or_stop_unit(char *method, char *name)
{
int ret;
GVariant *reply = NULL;
_I("Starting: %s %s", method, name);
- ret = deviced_systemd_proxy_call_sync(SYSTEMD_DBUS_DEST,
+ ret = pass_systemd_proxy_call_sync(SYSTEMD_DBUS_DEST,
SYSTEMD_DBUS_PATH,
SYSTEMD_DBUS_IFACE_MANAGER,
method,
return ret;
}
-int deviced_systemd_start_unit(char *name)
+int pass_systemd_start_unit(char *name)
{
assert(name);
- return deviced_systemd_start_or_stop_unit("StartUnit", name);
+ return pass_systemd_start_or_stop_unit("StartUnit", name);
}
-int deviced_systemd_stop_unit(char *name)
+int pass_systemd_stop_unit(char *name)
{
assert(name);
- return deviced_systemd_start_or_stop_unit("StopUnit", name);
+ return pass_systemd_start_or_stop_unit("StopUnit", name);
}
-static char *deviced_systemd_get_unit_dbus_path(const char *unit)
+static char *pass_systemd_get_unit_dbus_path(const char *unit)
{
char *path = NULL;
int i;
return path;
}
-static int deviced_systemd_get_property(const char *name,
+static int pass_systemd_get_property(const char *name,
const char *path,
const char *iface,
const char *method,
interface,
property);
- ret = deviced_systemd_proxy_call_sync(name,
+ ret = pass_systemd_proxy_call_sync(name,
path,
iface,
method,
return ret;
}
-int deviced_systemd_get_manager_property(const char *iface,
+int pass_systemd_get_manager_property(const char *iface,
const char *property,
GVariant **variant)
{
assert(iface);
assert(property);
- return deviced_systemd_get_property(SYSTEMD_DBUS_DEST,
+ return pass_systemd_get_property(SYSTEMD_DBUS_DEST,
SYSTEMD_DBUS_PATH,
DBUS_IFACE_DBUS_PROPERTIES,
"Get",
variant);
}
-int deviced_systemd_get_unit_property(const char *unit,
+int pass_systemd_get_unit_property(const char *unit,
const char *property,
GVariant **variant)
{
assert(unit);
assert(property);
- escaped = deviced_systemd_get_unit_dbus_path(unit);
+ escaped = pass_systemd_get_unit_dbus_path(unit);
- r = deviced_systemd_get_property(SYSTEMD_DBUS_DEST,
+ r = pass_systemd_get_property(SYSTEMD_DBUS_DEST,
escaped,
DBUS_IFACE_DBUS_PROPERTIES,
"Get",
return r;
}
-int deviced_systemd_get_service_property(const char *unit,
+int pass_systemd_get_service_property(const char *unit,
const char *property,
GVariant **variant)
{
assert(unit);
assert(property);
- escaped = deviced_systemd_get_unit_dbus_path(unit);
+ escaped = pass_systemd_get_unit_dbus_path(unit);
- ret = deviced_systemd_get_property(SYSTEMD_DBUS_DEST,
+ ret = pass_systemd_get_property(SYSTEMD_DBUS_DEST,
escaped,
DBUS_IFACE_DBUS_PROPERTIES,
"Get",
}
#define DEFINE_SYSTEMD_GET_PROPERTY(iface, type, value) \
- int deviced_systemd_get_##iface##_property_as_##type( \
+ int pass_systemd_get_##iface##_property_as_##type( \
const char *target, \
const char *property, \
value*result) \
GVariant *inner; \
int r; \
\
- r = deviced_systemd_get_##iface##_property(target, \
+ r = pass_systemd_get_##iface##_property(target, \
property, \
&var); \
if (r < 0) { \
return 0; \
}
-/* int deviced_systemd_get_manager_property_as_int32(const char *iface, const char *property, int *result); */
+/* int pass_systemd_get_manager_property_as_int32(const char *iface, const char *property, int *result); */
DEFINE_SYSTEMD_GET_PROPERTY(manager, int32, int)
-/* int deviced_systemd_get_manager_property_as_uint32(const char *iface, const char *property, unsigned int *result); */
+/* int pass_systemd_get_manager_property_as_uint32(const char *iface, const char *property, unsigned int *result); */
DEFINE_SYSTEMD_GET_PROPERTY(manager, uint32, uint)
-/* int deviced_systemd_get_manager_property_as_int64(const char *iface, const char *property, long long *result); */
+/* int pass_systemd_get_manager_property_as_int64(const char *iface, const char *property, long long *result); */
DEFINE_SYSTEMD_GET_PROPERTY(manager, int64, long long)
-/* int deviced_systemd_get_manager_property_as_uint64(const char *iface, const char *property, unsigned long long *result); */
+/* int pass_systemd_get_manager_property_as_uint64(const char *iface, const char *property, unsigned long long *result); */
DEFINE_SYSTEMD_GET_PROPERTY(manager, uint64, unsigned long long)
-/* int deviced_systemd_get_manager_property_as_string(const char *iface, const char *property, char **result); */
+/* int pass_systemd_get_manager_property_as_string(const char *iface, const char *property, char **result); */
DEFINE_SYSTEMD_GET_PROPERTY(manager, string, char*)
-/* int deviced_systemd_get_unit_property_as_int32(const char *unit, const char *property, int *result); */
+/* int pass_systemd_get_unit_property_as_int32(const char *unit, const char *property, int *result); */
DEFINE_SYSTEMD_GET_PROPERTY(unit, int32, int)
-/* int deviced_systemd_get_unit_property_as_uint32(const char *unit, const char *property, unsigned int *result); */
+/* int pass_systemd_get_unit_property_as_uint32(const char *unit, const char *property, unsigned int *result); */
DEFINE_SYSTEMD_GET_PROPERTY(unit, uint32, uint)
-/* int deviced_systemd_get_unit_property_as_int64(const char *unit, const char *property, long long *result); */
+/* int pass_systemd_get_unit_property_as_int64(const char *unit, const char *property, long long *result); */
DEFINE_SYSTEMD_GET_PROPERTY(unit, int64, long long)
-/* int deviced_systemd_get_unit_property_as_uint64(const char *unit, const char *property, unsigned long long *result); */
+/* int pass_systemd_get_unit_property_as_uint64(const char *unit, const char *property, unsigned long long *result); */
DEFINE_SYSTEMD_GET_PROPERTY(unit, uint64, unsigned long long)
-/* int deviced_systemd_get_unit_property_as_string(const char *unit, const char *property, char **result); */
+/* int pass_systemd_get_unit_property_as_string(const char *unit, const char *property, char **result); */
DEFINE_SYSTEMD_GET_PROPERTY(unit, string, char*)
-/* int deviced_systemd_get_service_property_as_int32(const char *unit, const char *property, int *result); */
+/* int pass_systemd_get_service_property_as_int32(const char *unit, const char *property, int *result); */
DEFINE_SYSTEMD_GET_PROPERTY(service, int32, int)
-/* int deviced_systemd_get_service_property_as_uint32(const char *unit, const char *property, unsigned int *result); */
+/* int pass_systemd_get_service_property_as_uint32(const char *unit, const char *property, unsigned int *result); */
DEFINE_SYSTEMD_GET_PROPERTY(service, uint32, uint)
-/* int deviced_systemd_get_service_property_as_int64(const char *unit, const char *property, long long *result); */
+/* int pass_systemd_get_service_property_as_int64(const char *unit, const char *property, long long *result); */
DEFINE_SYSTEMD_GET_PROPERTY(service, int64, long long)
-/* int deviced_systemd_get_service_property_as_uint64(const char *unit, const char *property, unsigned long long *result); */
+/* int pass_systemd_get_service_property_as_uint64(const char *unit, const char *property, unsigned long long *result); */
DEFINE_SYSTEMD_GET_PROPERTY(service, uint64, unsigned long long)
-/* int deviced_systemd_get_service_property_as_string(const char *unit, const char *property, char **result); */
+/* int pass_systemd_get_service_property_as_string(const char *unit, const char *property, char **result); */
DEFINE_SYSTEMD_GET_PROPERTY(service, string, char*)
-int deviced_systemd_instance_new_from_template(const char *template,
+int pass_systemd_instance_new_from_template(const char *template,
const char *instance,
const char **name)
{
--- /dev/null
+/*
+ * PASS
+ *
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __PASS_SYSTEMD_H__
+#define __PASS_SYSTEMD_H__
+
+#include <dbus/dbus.h>
+#include <gio/gio.h>
+
+#define DBUS_IFACE_DBUS_PROPERTIES DBUS_SERVICE_DBUS ".Properties"
+
+#define SYSTEMD_DBUS_DEST "org.freedesktop.systemd1"
+#define SYSTEMD_DBUS_IFACE_MANAGER SYSTEMD_DBUS_DEST ".Manager"
+#define SYSTEMD_DBUS_IFACE_UNIT SYSTEMD_DBUS_DEST ".Unit"
+#define SYSTEMD_DBUS_IFACE_SERVICE SYSTEMD_DBUS_DEST ".Service"
+#define SYSTEMD_DBUS_IFACE_TARGET SYSTEMD_DBUS_DEST ".Target"
+
+#define SYSTEMD_DBUS_PATH "/org/freedesktop/systemd1"
+#define SYSTEMD_DBUS_UNIT_PATH SYSTEMD_DBUS_PATH "/unit/"
+
+int pass_systemd_start_unit(char *name);
+int pass_systemd_stop_unit(char *name);
+
+int pass_systemd_get_manager_property(const char *iface, const char *property, GVariant **variant);
+int pass_systemd_get_unit_property(const char *unit, const char *property, GVariant **variant);
+int pass_systemd_get_service_property(const char* unit, const char* property, GVariant **variant);
+
+int pass_systemd_get_manager_property_as_int32(const char *iface, const char *property, int *result);
+int pass_systemd_get_manager_property_as_uint32(const char *iface, const char *property, unsigned int *result);
+int pass_systemd_get_manager_property_as_int64(const char *iface, const char *property, long long *result);
+int pass_systemd_get_manager_property_as_uint64(const char *iface, const char *property, unsigned long long *result);
+int pass_systemd_get_manager_property_as_string(const char *iface, const char *property, char **result);
+int pass_systemd_get_unit_property_as_int32(const char *unit, const char *property, int *result);
+int pass_systemd_get_unit_property_as_uint32(const char *unit, const char *property, unsigned int *result);
+int pass_systemd_get_unit_property_as_int64(const char *unit, const char *property, long long *result);
+int pass_systemd_get_unit_property_as_uint64(const char *unit, const char *property, unsigned long long *result);
+int pass_systemd_get_unit_property_as_string(const char *unit, const char *property, char **result);
+int pass_systemd_get_service_property_as_int32(const char *unit, const char *property, int *result);
+int pass_systemd_get_service_property_as_uint32(const char *unit, const char *property, unsigned int *result);
+int pass_systemd_get_service_property_as_int64(const char *unit, const char *property, long long *result);
+int pass_systemd_get_service_property_as_uint64(const char *unit, const char *property, unsigned long long *result);
+int pass_systemd_get_service_property_as_string(const char *unit, const char *property, char **result);
+
+int pass_systemd_instance_new_from_template(const char *template, const char *instance, const char **name);
+
+#endif
/*
- * deviced
+ * PASS (Power Aware System Service)
*
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.