#define SHIFT_CHANGE_STATE 7
#define CHANGE_STATE_BIT 0xF00 /* 1111 0000 0000 */
#define LOCK_SCREEN_TIMEOUT 10
-#define SHIFT_HOLD_KEY_BLOCK 16
+#define SHIFT_LOCK_FLAG 16
+#define HOLD_KEY_BLOCK_BIT 0x1
#define DEFAULT_NORMAL_TIMEOUT 30
#define DEFAULT_DIM_TIMEOUT 5
#define DEFAULT_OFF_TIMEOUT 5
-#define GET_HOLDKEY_BLOCK_STATE(x) ((x >> SHIFT_HOLD_KEY_BLOCK) & 0x1)
+#define GET_HOLDKEY_BLOCK_STATE(x) ((x >> SHIFT_LOCK_FLAG) & HOLD_KEY_BLOCK_BIT)
#define LOCK_SCREEN_WATING_TIME 50000 /* 50 ms */
#define LOCK_SCREEN_WATING_MAX_COUNT 14 /* 50 * 14 : 700 ms at worst */
#define MASK32 0xffffffff
#include <error.h>
#include <Ecore.h>
+#include <device-node.h>
#include "util.h"
#include "core.h"
-#include "device-node.h"
#include "core/common.h"
#include "core/devices.h"
-#define DISP_INDEX_BIT 4
-#define COMBINE_DISP_CMD(cmd, prop, index) (cmd = (prop | (index << DISP_INDEX_BIT)))
+#define DISP_INDEX_BIT 16
+#define DISP_CMD(prop, index) (prop | (index << DISP_INDEX_BIT))
static DBusMessage *e_dbus_start_cb(E_DBus_Object *obj, DBusMessage *msg)
{
int cmd;
int brightness = -1;
- COMBINE_DISP_CMD(cmd, PROP_DISPLAY_BRIGHTNESS, DEFAULT_DISPLAY);
+ cmd = DISP_CMD(PROP_DISPLAY_BRIGHTNESS, DEFAULT_DISPLAY);
ret = device_get_property(DEVICE_TYPE_DISPLAY, cmd, &brightness);
LOGINFO("get brightness %d, %d", brightness, ret);
dbus_message_iter_init(msg, &iter);
dbus_message_iter_get_basic(&iter, &brightness);
- COMBINE_DISP_CMD(cmd, PROP_DISPLAY_BRIGHTNESS, DEFAULT_DISPLAY);
+ cmd = DISP_CMD(PROP_DISPLAY_BRIGHTNESS, DEFAULT_DISPLAY);
ret = device_set_property(DEVICE_TYPE_DISPLAY, cmd, brightness);
LOGINFO("set brightness %d, %d", brightness, ret);
{ "unlockstate", "ss", "i", e_dbus_unlockstate_cb },
{ "changestate", "s", "i", e_dbus_changestate_cb },
{ "getbrightness", NULL, "i", e_dbus_getbrightness_cb },
- { "setbrightness", "i", "i", e_dbus_setbrightness_cb }
+ { "setbrightness", "i", "i", e_dbus_setbrightness_cb },
/* Add methods here */
};
_E("fail uevent control init");
return;
}
+
/* for simple noti change cb */
ss_noti_add("device_usb_chgdet", (void *)usb_chgdet_cb, data);
ss_noti_add("device_ta_chgdet", (void *)ta_chgdet_cb, data);
}
}
-int register_edbus_signal_handler(char *signal_name, E_DBus_Signal_Cb cb)
+int register_edbus_signal_handler(const char *path, const char *interface,
+ const char *name, E_DBus_Signal_Cb cb)
{
Eina_List *tmp;
struct edbus_list *entry;
E_DBus_Signal_Handler *handler;
EINA_LIST_FOREACH(edbus_handler_list, tmp, entry) {
- if (entry != NULL && strncmp(entry->signal_name, signal_name, strlen(signal_name)) == 0)
+ if (entry != NULL && strncmp(entry->signal_name, name, strlen(name)) == 0)
return -1;
}
- handler = e_dbus_signal_handler_add(edbus_conn, NULL, OBJECT_PATH,
- INTERFACE_NAME, signal_name, cb, NULL);
+ handler = e_dbus_signal_handler_add(edbus_conn, NULL, path,
+ interface, name, cb, NULL);
if (!handler) {
_D("fail to add edbus handler");
return -1;
}
- _D("add edbus service: %s", signal_name);
- PRT_TRACE_ERR("add edbus service: %s", signal_name);
+ _D("add edbus service: %s", name);
entry = malloc(sizeof(struct edbus_list));
return -1;
}
- entry->signal_name = strndup(signal_name, strlen(signal_name));
+ entry->signal_name = strndup(name, strlen(name));
if (!entry->signal_name) {
_D("Malloc failed");
return 0;
}
+int broadcast_edbus_signal(const char *path, const char *interface,
+ const char *name, int type, void *value)
+{
+ DBusMessage *signal;
+ DBusMessageIter iter;
+ DBusMessageIter val;
+ char sig[2] = {type, '\0'};
+
+ signal = dbus_message_new_signal(path, interface, name);
+ if (!signal) {
+ _D("fail to allocate new %s.%s signal", interface, name);
+ return -1;
+ }
+
+ dbus_message_append_args(signal, type, value, DBUS_TYPE_INVALID);
+
+ e_dbus_message_send(edbus_conn, signal, NULL, -1, NULL);
+
+ dbus_message_unref(signal);
+ return 0;
+}
+
static void edbus_init(void *data)
{
int retry = EDBUS_INIT_RETRY_COUNT;
#define DEVICED_PATH_DISPLAY OBJECT_PATH"/Display"
#define DEVICED_INTERFACE_DISPLAY INTERFACE_NAME".display"
-int register_edbus_signal_handler(char *signal_name, E_DBus_Signal_Cb cb);
+int register_edbus_signal_handler(const char *path, const char *interface,
+ const char *name, E_DBus_Signal_Cb cb);
E_DBus_Interface *get_edbus_interface(const char *path);
pid_t get_edbus_sender_pid(DBusMessage *msg);
+int broadcast_edbus_signal(const char *path, const char *interface,
+ const char *name, int type, void *value);
#endif /* __SS_EDBUS_HANDLE_H__ */
write(1, buf, strlen(buf));\
} while (0);
-#define SIGNAL_NAME_POWEROFF_POPUP "poweroffpopup"
-
static struct sigaction sig_child_old_act;
static struct sigaction sig_pipe_old_act;
sig_act.sa_flags = SA_SIGINFO;
sigemptyset(&sig_act.sa_mask);
sigaction(SIGPIPE, &sig_act, &sig_pipe_old_act);
- register_edbus_signal_handler(SIGNAL_NAME_LCD_CONTROL,
- (void *)lcd_control_edbus_signal_handler);
}
const struct device_ops signal_device_ops = {
* @brief This API is used to set a process which has pid 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 sysconf_set_permanent()
+ * @see deviced_set_permanent()
* @par Example
* @code
* ...
};
static const char *ext4_arg[] = {
- "/sbin/mkfs.ext4",
- NULL, NULL,
+ "/sbin/mkfs.ext4",
+ NULL, NULL,
};
static const char *vfat_check_arg[] = {
- "/sbin/fsck.vfat",
- "-a", NULL, NULL,
+ "/sbin/fsck.vfat",
+ "-a", NULL, NULL,
};
static const char *ext4_check_arg[] = {
- "/sbin/fsck.ext4",
- "-f", "-y", NULL, NULL,
+ "/sbin/fsck.ext4",
+ "-f", "-y", NULL, NULL,
};
#define POWEROFF_NOTI_NAME "power_off_start"
#define POWEROFF_DURATION 2
-#define POWEROFF_ANIMATION_PATH "/usr/bin/boot-animation"
#define MAX_RETRY 2
static struct timeval tv_start_poweroff;
PRT_TRACE_ERR("Vconf notify key chaneged failed: KEY(%s)", VCONFKEY_SYSMAN_POWER_OFF_STATUS);
}
- register_edbus_signal_handler(SIGNAL_NAME_POWEROFF_POPUP,
+ register_edbus_signal_handler(OBJECT_PATH, INTERFACE_NAME,
+ SIGNAL_NAME_POWEROFF_POPUP,
(void *)poweroff_popup_edbus_signal_handler);
+ register_edbus_signal_handler(OBJECT_PATH, INTERFACE_NAME,
+ SIGNAL_NAME_LCD_CONTROL,
+ (void *)lcd_control_edbus_signal_handler);
}
const struct device_ops power_device_ops = {
#endif
#define SYSTEM_NOTI_MAXARG 16
-#define SYSTEM_NOTI_MAXSTR 100
+#define SYSTEM_NOTI_MAXSTR 255
#define BUFF_MAX 255
struct sysnoti {
#define SHIFT_UNLOCK 4
#define SHIFT_UNLOCK_PARAMETER 12
#define SHIFT_CHANGE_STATE 8
-#define SHIFT_HOLD_KEY_BLOCK 16
#define TIMEOUT_RESET_BIT 0x80
-struct pwr_msg {
+struct disp_lock_msg {
pid_t pid;
unsigned int cond;
unsigned int timeout;
+ unsigned int timeout2;
};
API int display_get_count(void)
return 0;
}
-static int send_msg(unsigned int s_bits, unsigned int timeout)
+static int send_msg(unsigned int s_bits, unsigned int timeout, unsigned int timeout2)
{
int rc = 0;
int sock;
- struct pwr_msg p;
+ struct disp_lock_msg p;
struct sockaddr_un remote;
p.pid = getpid();
p.cond = s_bits;
p.timeout = timeout;
+ p.timeout2 = timeout2;
sock = socket(AF_UNIX, SOCK_DGRAM, 0);
if (sock == -1) {
default:
return -1;
}
- return send_msg(s_bits << SHIFT_CHANGE_STATE, 0);
+ return send_msg(s_bits << SHIFT_CHANGE_STATE, 0, 0);
}
API int display_lock_state(unsigned int s_bits, unsigned int flag,
if (flag & GOTO_STATE_NOW)
/* if the flag is true, go to the locking state directly */
s_bits = s_bits | (s_bits << SHIFT_CHANGE_STATE);
- if (flag & HOLD_KEY_BLOCK)
- s_bits = s_bits | (1 << SHIFT_HOLD_KEY_BLOCK);
- return send_msg(s_bits, timeout);
+ return send_msg(s_bits, timeout, 0);
}
API int display_unlock_state(unsigned int s_bits, unsigned int flag)
s_bits = (s_bits << SHIFT_UNLOCK);
s_bits = (s_bits | (flag << SHIFT_UNLOCK_PARAMETER));
- return send_msg(s_bits, 0);
+ return send_msg(s_bits, 0, 0);
}