#include <system/syscommon-plugin-deviced-power-interface.h>
#include <linux/input.h>
-#include "display-actor.h"
#include "display-config.h"
#include "display-misc.h"
#include <libsyscommon/log.h>
_E("Failed to launch power off popup.");
}
-static void longkey_pressed(void)
+static int check_actor_caps(int actor_id, unsigned int caps)
{
- unsigned int caps;
+ int ret = 0;
+ u_int64_t capability = 0;
- _I("Power key long pressed!");
- cancel_lcdoff = 1;
+ ret = syscommon_resman_get_resource_attr_uint64_with_2_user_data(
+ SYSCOMMON_RESOURCE_ID(DEVICED_RESOURCE_TYPE_DISPLAY),
+ DEVICED_DISPLAY_ATTR_UINT64_GET_ACTOR_CAPABILITY,
+ (u_int64_t *) &actor_id,
+ (u_int64_t *) &caps,
+ &capability);
- caps = display_get_caps(DISPLAY_ACTOR_POWER_KEY);
+ if (ret < 0)
+ return 0; /* no capability */
+
+ return capability;
+}
- if (display_has_caps(caps, DISPLAY_CAPA_LCDON)) {
+static void longkey_pressed(void)
+{
+ _I("Power key long pressed!");
+ cancel_lcdoff = 1;
+ if (check_actor_caps(SYSCOMMON_DEVICED_DISPLAY_ACTOR_POWER_KEY, SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDON)) {
/* change state - LCD on */
syscommon_resman_set_resource_attr_uint64_2(SYSCOMMON_RESOURCE_ID(DEVICED_RESOURCE_TYPE_DISPLAY),
DEVICED_DISPLAY_ATTR_TUPLE2_SET_CURRENT_STATE,
SYSCOMMON_DEVICED_DISPLAY_STATE_ON, DEVICED_EVENT_INPUT_POWERKEY);
}
- if (!display_has_caps(caps, DISPLAY_CAPA_LCDOFF)) {
+ if (!check_actor_caps(SYSCOMMON_DEVICED_DISPLAY_ACTOR_POWER_KEY, SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDOFF)) {
_D("No poweroff capability!");
return;
}
static int process_menu_key(struct input_event *pinput)
{
- int caps;
-
- caps = display_get_caps(DISPLAY_ACTOR_MENU_KEY);
-
- if (!display_has_caps(caps, DISPLAY_CAPA_LCDON)) {
+ if (!check_actor_caps(SYSCOMMON_DEVICED_DISPLAY_ACTOR_MENU_KEY, SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDON)) {
if (current_state_in_on())
return false;
_D("No lcd-on capability!");
{
int ignore = true;
static int value = KEY_RELEASED;
- unsigned int caps;
const struct syscommon_deviced_display_config *display_conf = get_var_display_config();
if (!display_conf) {
_E("Failed to get display configuration variable.");
return ignore;
}
- caps = display_get_caps(DISPLAY_ACTOR_POWER_KEY);
-
switch (pinput->value) {
case KEY_RELEASED:
check_key_pair(pinput->code, pinput->value, &value);
if (!display_conf->powerkey_doublepress) {
- if (display_has_caps(caps, DISPLAY_CAPA_LCDOFF))
+ if (check_actor_caps(SYSCOMMON_DEVICED_DISPLAY_ACTOR_POWER_KEY, SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDOFF))
lcdoff_powerkey();
else
_D("No lcdoff capability!");
} else if (skip_lcd_off)
ignore = false;
- if (!display_has_caps(caps, DISPLAY_CAPA_LCDON))
+ if (!check_actor_caps(SYSCOMMON_DEVICED_DISPLAY_ACTOR_POWER_KEY, SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDON))
ignore = true;
if (longkey_timeout_id > 0) {
break;
case KEY_PRESSED:
- if (display_has_caps(caps, DISPLAY_CAPA_LCDON)) {
+ if (check_actor_caps(SYSCOMMON_DEVICED_DISPLAY_ACTOR_POWER_KEY, SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDON)) {
skip_lcd_off = switch_on_lcd(LCD_ON_BY_POWER_KEY);
} else {
_D("No lcdon capability!");
return 0;
}
-/*
- * Default capability
- * powerkey := LCDON | LCDOFF | POWEROFF
- * homekey := LCDON
- */
-static struct display_actor_ops display_powerkey_actor = {
- .id = DISPLAY_ACTOR_POWER_KEY,
- .caps = DISPLAY_CAPA_LCDON |
- DISPLAY_CAPA_LCDOFF |
- DISPLAY_CAPA_POWEROFF,
-};
-
-static struct display_actor_ops display_menukey_actor = {
- .id = DISPLAY_ACTOR_MENU_KEY,
- .caps = DISPLAY_CAPA_LCDON,
-};
-
static void __CONSTRUCTOR__ initialize(void)
{
- display_add_actor(&display_powerkey_actor);
- display_add_actor(&display_menukey_actor);
+ /*
+ * Default capability
+ * powerkey := LCDON | LCDOFF | POWEROFF
+ * homekey := LCDON
+ */
+ syscommon_resman_set_resource_attr_uint64_3(SYSCOMMON_RESOURCE_ID(DEVICED_RESOURCE_TYPE_DISPLAY),
+ DEVICED_DISPLAY_ATTR_TUPLE3_SET_ACTOR_CAPABILITY,
+ SYSCOMMON_DEVICED_DISPLAY_ACTOR_POWER_KEY,
+ (SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDON | SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDOFF | SYSCOMMON_DEVICED_DISPLAY_CAPA_POWEROFF),
+ 1);
+ syscommon_resman_set_resource_attr_uint64_3(SYSCOMMON_RESOURCE_ID(DEVICED_RESOURCE_TYPE_DISPLAY),
+ DEVICED_DISPLAY_ATTR_TUPLE3_SET_ACTOR_CAPABILITY,
+ SYSCOMMON_DEVICED_DISPLAY_ACTOR_MENU_KEY,
+ SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDON,
+ 1);
syscommon_notifier_subscribe_notify(DEVICED_NOTIFIER_DELAYED_INIT, delayed_init_done);
syscommon_notifier_subscribe_notify(DEVICED_NOTIFIER_BEZEL_WAKEUP, bezel_wakeup_cb);
_I("Power key long pressed!");
cancel_lcdoff = 1;
- caps = display_get_caps(DISPLAY_ACTOR_POWER_KEY);
+ caps = display_get_caps(SYSCOMMON_DEVICED_DISPLAY_ACTOR_POWER_KEY);
- if (display_has_caps(caps, DISPLAY_CAPA_LCDON)) {
+ if (display_has_caps(caps, SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDON)) {
/* change state - LCD on */
syscommon_resman_set_resource_attr_uint64_2(SYSCOMMON_RESOURCE_ID(DEVICED_RESOURCE_TYPE_DISPLAY),
DEVICED_DISPLAY_ATTR_TUPLE2_SET_CURRENT_STATE,
SYSCOMMON_DEVICED_DISPLAY_STATE_ON, DEVICED_EVENT_INPUT_POWERKEY);
}
- if (!display_has_caps(caps, DISPLAY_CAPA_LCDOFF)) {
+ if (!display_has_caps(caps, SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDOFF)) {
_D("No poweroff capability!");
return;
}
{
int caps;
- caps = display_get_caps(DISPLAY_ACTOR_MENU_KEY);
+ caps = display_get_caps(SYSCOMMON_DEVICED_DISPLAY_ACTOR_MENU_KEY);
- if (!display_has_caps(caps, DISPLAY_CAPA_LCDON)) {
+ if (!display_has_caps(caps, SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDON)) {
if (current_state_in_on())
return false;
_D("No lcd-on capability!");
return ignore;
}
- caps = display_get_caps(DISPLAY_ACTOR_POWER_KEY);
+ caps = display_get_caps(SYSCOMMON_DEVICED_DISPLAY_ACTOR_POWER_KEY);
switch (pinput->value) {
case KEY_RELEASED:
check_key_pair(pinput->code, pinput->value, &value);
if (!display_conf->powerkey_doublepress) {
- if (display_has_caps(caps, DISPLAY_CAPA_LCDOFF))
+ if (display_has_caps(caps, SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDOFF))
lcdoff_powerkey();
else
_D("No lcdoff capability!");
} else if (skip_lcd_off)
ignore = false;
- if (!display_has_caps(caps, DISPLAY_CAPA_LCDON))
+ if (!display_has_caps(caps, SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDON))
ignore = true;
if (longkey_timeout_id > 0) {
break;
case KEY_PRESSED:
- if (display_has_caps(caps, DISPLAY_CAPA_LCDON)) {
+ if (display_has_caps(caps, SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDON)) {
/*
* LCD does not turn on immediately at mobile.
* It will be turned on after 0.1 second because of torch concept.
* powerkey := LCDON | LCDOFF | POWEROFF
* homekey := LCDON
*/
-static struct display_actor_ops display_powerkey_actor = {
- .id = DISPLAY_ACTOR_POWER_KEY,
- .caps = DISPLAY_CAPA_LCDON |
- DISPLAY_CAPA_LCDOFF |
- DISPLAY_CAPA_POWEROFF,
+static struct syscommon_deviced_display_actor_ops display_powerkey_actor = {
+ .id = SYSCOMMON_DEVICED_DISPLAY_ACTOR_POWER_KEY,
+ .caps = SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDON |
+ SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDOFF |
+ SYSCOMMON_DEVICED_DISPLAY_CAPA_POWEROFF,
};
-static struct display_actor_ops display_menukey_actor = {
- .id = DISPLAY_ACTOR_MENU_KEY,
- .caps = DISPLAY_CAPA_LCDON,
+static struct syscommon_deviced_display_actor_ops display_menukey_actor = {
+ .id = SYSCOMMON_DEVICED_DISPLAY_ACTOR_MENU_KEY,
+ .caps = SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDON,
};
static void __CONSTRUCTOR__ initialize(void)
_I("Power key long pressed!");
cancel_lcdoff = 1;
- caps = display_get_caps(DISPLAY_ACTOR_POWER_KEY);
+ caps = display_get_caps(SYSCOMMON_DEVICED_DISPLAY_ACTOR_POWER_KEY);
- if (display_has_caps(caps, DISPLAY_CAPA_LCDON)) {
+ if (display_has_caps(caps, SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDON)) {
/* change state - LCD on */
syscommon_resman_set_resource_attr_uint64_2(SYSCOMMON_RESOURCE_ID(DEVICED_RESOURCE_TYPE_DISPLAY),
DEVICED_DISPLAY_ATTR_TUPLE2_SET_CURRENT_STATE,
SYSCOMMON_DEVICED_DISPLAY_STATE_ON, DEVICED_EVENT_INPUT_POWERKEY);
}
- if (!display_has_caps(caps, DISPLAY_CAPA_LCDOFF)) {
+ if (!display_has_caps(caps, SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDOFF)) {
_D("No poweroff capability!");
return;
}
{
int caps;
- caps = display_get_caps(DISPLAY_ACTOR_MENU_KEY);
+ caps = display_get_caps(SYSCOMMON_DEVICED_DISPLAY_ACTOR_MENU_KEY);
- if (!display_has_caps(caps, DISPLAY_CAPA_LCDON)) {
+ if (!display_has_caps(caps, SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDON)) {
if (current_state_in_on())
return false;
_D("No lcd-on capability!");
return ignore;
}
- caps = display_get_caps(DISPLAY_ACTOR_POWER_KEY);
+ caps = display_get_caps(SYSCOMMON_DEVICED_DISPLAY_ACTOR_POWER_KEY);
switch (pinput->value) {
case KEY_RELEASED:
check_key_pair(pinput->code, pinput->value, &value);
if (!display_conf->powerkey_doublepress) {
- if (display_has_caps(caps, DISPLAY_CAPA_LCDOFF))
+ if (display_has_caps(caps, SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDOFF))
lcdoff_powerkey();
else
_D("No lcdoff capability!");
} else if (skip_lcd_off)
ignore = false;
- if (!display_has_caps(caps, DISPLAY_CAPA_LCDON))
+ if (!display_has_caps(caps, SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDON))
ignore = true;
if (longkey_timeout_id > 0) {
break;
case KEY_PRESSED:
- if (display_has_caps(caps, DISPLAY_CAPA_LCDON)) {
+ if (display_has_caps(caps, SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDON)) {
skip_lcd_off = switch_on_lcd(LCD_ON_BY_POWER_KEY);
} else {
_D("No lcdon capability!");
* powerkey := LCDON | LCDOFF | POWEROFF
* homekey := LCDON
*/
-static struct display_actor_ops display_powerkey_actor = {
- .id = DISPLAY_ACTOR_POWER_KEY,
- .caps = DISPLAY_CAPA_LCDON |
- DISPLAY_CAPA_LCDOFF |
- DISPLAY_CAPA_POWEROFF,
+static struct syscommon_deviced_display_actor_ops display_powerkey_actor = {
+ .id = SYSCOMMON_DEVICED_DISPLAY_ACTOR_POWER_KEY,
+ .caps = SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDON |
+ SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDOFF |
+ SYSCOMMON_DEVICED_DISPLAY_CAPA_POWEROFF,
};
-static struct display_actor_ops display_menukey_actor = {
- .id = DISPLAY_ACTOR_MENU_KEY,
- .caps = DISPLAY_CAPA_LCDON,
+static struct syscommon_deviced_display_actor_ops display_menukey_actor = {
+ .id = SYSCOMMON_DEVICED_DISPLAY_ACTOR_MENU_KEY,
+ .caps = SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDON,
};
static void __CONSTRUCTOR__ initialize(void)
_I("Power key long pressed!");
cancel_lcdoff = 1;
- caps = display_get_caps(DISPLAY_ACTOR_POWER_KEY);
+ caps = display_get_caps(SYSCOMMON_DEVICED_DISPLAY_ACTOR_POWER_KEY);
- if (display_has_caps(caps, DISPLAY_CAPA_LCDON)) {
+ if (display_has_caps(caps, SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDON)) {
/* change state - LCD on */
display_state_transition_request_state_transition_with_option(DEVICED_EVENT_INPUT_POWERKEY, LCD_NORMAL);
display_state_transition_do_state_transition_by_input_poll_event();
}
- if (!display_has_caps(caps, DISPLAY_CAPA_LCDOFF)) {
+ if (!display_has_caps(caps, SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDOFF)) {
_D("No poweroff capability!");
return;
}
{
int caps;
- caps = display_get_caps(DISPLAY_ACTOR_MENU_KEY);
+ caps = display_get_caps(SYSCOMMON_DEVICED_DISPLAY_ACTOR_MENU_KEY);
- if (!display_has_caps(caps, DISPLAY_CAPA_LCDON)) {
+ if (!display_has_caps(caps, SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDON)) {
if (current_state_in_on())
return false;
_D("No lcd-on capability!");
return ignore;
}
- caps = display_get_caps(DISPLAY_ACTOR_POWER_KEY);
+ caps = display_get_caps(SYSCOMMON_DEVICED_DISPLAY_ACTOR_POWER_KEY);
switch (pinput->value) {
case KEY_RELEASED:
check_key_pair(pinput->code, pinput->value, &value);
if (!display_conf->powerkey_doublepress) {
- if (display_has_caps(caps, DISPLAY_CAPA_LCDOFF))
+ if (display_has_caps(caps, SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDOFF))
lcdoff_powerkey();
else
_D("No lcdoff capability!");
} else if (skip_lcd_off)
ignore = false;
- if (!display_has_caps(caps, DISPLAY_CAPA_LCDON))
+ if (!display_has_caps(caps, SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDON))
ignore = true;
if (longkey_timeout_id > 0) {
break;
case KEY_PRESSED:
- if (display_has_caps(caps, DISPLAY_CAPA_LCDON)) {
+ if (display_has_caps(caps, SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDON)) {
skip_lcd_off = switch_on_lcd(LCD_ON_BY_POWER_KEY);
} else {
_D("No lcdon capability!");
* powerkey := LCDON | LCDOFF | POWEROFF
* homekey := LCDON
*/
-static struct display_actor_ops display_powerkey_actor = {
- .id = DISPLAY_ACTOR_POWER_KEY,
- .caps = DISPLAY_CAPA_LCDON |
- DISPLAY_CAPA_LCDOFF |
- DISPLAY_CAPA_POWEROFF,
+static struct syscommon_deviced_display_actor_ops display_powerkey_actor = {
+ .id = SYSCOMMON_DEVICED_DISPLAY_ACTOR_POWER_KEY,
+ .caps = SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDON |
+ SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDOFF |
+ SYSCOMMON_DEVICED_DISPLAY_CAPA_POWEROFF,
};
-static struct display_actor_ops display_menukey_actor = {
- .id = DISPLAY_ACTOR_MENU_KEY,
- .caps = DISPLAY_CAPA_LCDON,
+static struct syscommon_deviced_display_actor_ops display_menukey_actor = {
+ .id = SYSCOMMON_DEVICED_DISPLAY_ACTOR_MENU_KEY,
+ .caps = SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDON,
};
static void __CONSTRUCTOR__ initialize(void)
static GList *actor_head;
-void display_add_actor(struct display_actor_ops *actor)
+void display_add_actor(struct syscommon_deviced_display_actor_ops *actor)
{
SYS_G_LIST_APPEND(actor_head, actor);
}
-static struct display_actor_ops *display_find_actor(enum display_actor_id id)
+struct syscommon_deviced_display_actor_ops *display_find_actor(enum syscommon_deviced_display_actor_id id)
{
GList *elem;
- struct display_actor_ops *actor;
+ struct syscommon_deviced_display_actor_ops *actor;
SYS_G_LIST_FOREACH(actor_head, elem, actor) {
if (actor->id == id)
return NULL;
}
-int display_set_caps(enum display_actor_id id, unsigned int caps)
+int display_set_caps(enum syscommon_deviced_display_actor_id id, unsigned int caps)
{
- struct display_actor_ops *actor;
+ struct syscommon_deviced_display_actor_ops *actor;
if (id <= 0 || !caps)
return -EINVAL;
return 0;
}
-int display_reset_caps(enum display_actor_id id, unsigned int caps)
+int display_reset_caps(enum syscommon_deviced_display_actor_id id, unsigned int caps)
{
- struct display_actor_ops *actor;
+ struct syscommon_deviced_display_actor_ops *actor;
if (id <= 0 || !caps)
return -EINVAL;
return 0;
}
-unsigned int display_get_caps(enum display_actor_id id)
+unsigned int display_get_caps(enum syscommon_deviced_display_actor_id id)
{
- struct display_actor_ops *actor;
+ struct syscommon_deviced_display_actor_ops *actor;
if (id <= 0)
return 0;
#define __DISPLAY_ACTOR_H__
#include <errno.h>
+#include <system/syscommon-plugin-deviced-display-interface.h>
#include "shared/common.h"
-enum display_actor_id {
- DISPLAY_ACTOR_POWER_KEY = 1,
- DISPLAY_ACTOR_MENU_KEY,
- DISPLAY_ACTOR_API,
- DISPLAY_ACTOR_GESTURE,
-};
-
-struct display_actor_ops {
- enum display_actor_id id;
- unsigned int caps;
-};
-
-enum display_capability {
- DISPLAY_CAPA_BRIGHTNESS = 1 << 0,
- DISPLAY_CAPA_LCDON = 1 << 1,
- DISPLAY_CAPA_LCDOFF = 1 << 2,
- DISPLAY_CAPA_POWEROFF = 1 << 3,
-};
-
-void display_add_actor(struct display_actor_ops *actor);
-int display_set_caps(enum display_actor_id id, unsigned int caps);
-int display_reset_caps(enum display_actor_id id, unsigned int caps);
-unsigned int display_get_caps(enum display_actor_id id);
+struct syscommon_deviced_display_actor_ops *display_find_actor(enum syscommon_deviced_display_actor_id id);
+void display_add_actor(struct syscommon_deviced_display_actor_ops *actor);
+int display_set_caps(enum syscommon_deviced_display_actor_id id, unsigned int caps);
+int display_reset_caps(enum syscommon_deviced_display_actor_id id, unsigned int caps);
+unsigned int display_get_caps(enum syscommon_deviced_display_actor_id id);
int display_has_caps(unsigned int total_caps, unsigned int caps);
#endif
}
if (flag & GOTO_STATE_NOW) {
- caps = display_get_caps(DISPLAY_ACTOR_API);
+ caps = display_get_caps(SYSCOMMON_DEVICED_DISPLAY_ACTOR_API);
- if (!display_has_caps(caps, DISPLAY_CAPA_LCDON) &&
+ if (!display_has_caps(caps, SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDON) &&
state == LCD_NORMAL) {
_D("No lcdon capability!");
ret = -EPERM;
goto out;
}
- if (!display_has_caps(caps, DISPLAY_CAPA_LCDOFF) &&
+ if (!display_has_caps(caps, SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDOFF) &&
state == LCD_OFF) {
_D("No lcdoff capability!");
ret = -EPERM;
goto out;
}
- caps = display_get_caps(DISPLAY_ACTOR_API);
+ caps = display_get_caps(SYSCOMMON_DEVICED_DISPLAY_ACTOR_API);
- if (!display_has_caps(caps, DISPLAY_CAPA_LCDON) &&
+ if (!display_has_caps(caps, SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDON) &&
state == LCD_NORMAL) {
_D("No lcdon capability!");
ret = -EPERM;
goto out;
}
- if (!display_has_caps(caps, DISPLAY_CAPA_LCDOFF) &&
+ if (!display_has_caps(caps, SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDOFF) &&
state == LCD_OFF) {
_D("No lcdoff capability!");
ret = -EPERM;
int state, brt, autobrt, ret = 0, caps;
pid_t pid;
- caps = display_get_caps(DISPLAY_ACTOR_API);
+ caps = display_get_caps(SYSCOMMON_DEVICED_DISPLAY_ACTOR_API);
- if (!display_has_caps(caps, DISPLAY_CAPA_BRIGHTNESS)) {
+ if (!display_has_caps(caps, SYSCOMMON_DEVICED_DISPLAY_CAPA_BRIGHTNESS)) {
_D("No brightness changing capability!");
ret = -EPERM;
goto error;
int brt, autobrt, ret, caps;
pid_t pid;
- caps = display_get_caps(DISPLAY_ACTOR_API);
+ caps = display_get_caps(SYSCOMMON_DEVICED_DISPLAY_ACTOR_API);
- if (!display_has_caps(caps, DISPLAY_CAPA_BRIGHTNESS)) {
+ if (!display_has_caps(caps, SYSCOMMON_DEVICED_DISPLAY_CAPA_BRIGHTNESS)) {
_D("No brightness changing capability!");
ret = -EPERM;
goto error;
* api := LCDON | LCDOFF | BRIGHTNESS
* gesture := LCDON
*/
-static struct display_actor_ops display_api_actor = {
- .id = DISPLAY_ACTOR_API,
- .caps = DISPLAY_CAPA_LCDON |
- DISPLAY_CAPA_LCDOFF |
- DISPLAY_CAPA_BRIGHTNESS,
+static struct syscommon_deviced_display_actor_ops display_api_actor = {
+ .id = SYSCOMMON_DEVICED_DISPLAY_ACTOR_API,
+ .caps = SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDON |
+ SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDOFF |
+ SYSCOMMON_DEVICED_DISPLAY_CAPA_BRIGHTNESS,
};
-static struct display_actor_ops display_gesture_actor = {
- .id = DISPLAY_ACTOR_GESTURE,
- .caps = DISPLAY_CAPA_LCDON,
+static struct syscommon_deviced_display_actor_ops display_gesture_actor = {
+ .id = SYSCOMMON_DEVICED_DISPLAY_ACTOR_GESTURE,
+ .caps = SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDON,
};
int init_pm_dbus(void)
#include "shared/common.h"
#include "display-state-transition.h"
#include "display-backlight.h"
+#include "display-actor.h"
#include "device-interface.h"
typedef union {
return 0;
}
break;
+ }
+
+ return 0;
+}
+
+static int set_tuple3_display_attr_data(int resource_id,
+ const struct syscommon_resman_resource_attribute *attr,
+ const void *data1, const void *data2, const void *data3, int count1, int count2, int count3)
+{
+ if (!data1 || !data2 || !data3)
+ return -EINVAL;
+
+ switch (attr->id) {
+ case DEVICED_DISPLAY_ATTR_TUPLE3_SET_ACTOR_CAPABILITY:
+ {
+ enum syscommon_deviced_display_actor_id id = *(enum syscommon_deviced_display_actor_id *) data1;
+ unsigned int caps = *(unsigned int *) data2;
+ int set = *(int *) data3;
+
+ struct syscommon_deviced_display_actor_ops *actor;
+
+ actor = display_find_actor(id);
+ if (!actor) {
+ actor = calloc(1, sizeof(struct syscommon_deviced_display_actor_ops));
+ if (!actor)
+ return -ENOMEM;
+ display_add_actor(actor);
+ }
+
+ if (set)
+ actor->caps |= caps;
+ else
+ actor->caps &= ~caps;
+ }
+ break;
default:
return -EINVAL;
}
return 0;
}
+static int get_display_attr_data_with_2_user_data(int resource_id,
+ const struct syscommon_resman_resource_attribute *attr,
+ void *user_data1, void *user_data2, int user_count1, int user_count2, void *data)
+{
+ int ret = 0;
+ resource_attr_data_t attr_data = { 0, };
+
+ if (!data)
+ return -EINVAL;
+
+ switch (attr->id) {
+ case DEVICED_DISPLAY_ATTR_UINT64_GET_ACTOR_CAPABILITY:
+ {
+ enum syscommon_deviced_display_actor_id id;
+ unsigned int caps;
+ struct syscommon_deviced_display_actor_ops *actor;
+
+ if (!user_data1 || !user_data2)
+ return -EINVAL;
+
+ id = *(enum syscommon_deviced_display_actor_id *) user_data1;
+ caps = *(unsigned int *) user_data2;
+
+ actor = display_find_actor(id);
+ if (!actor)
+ return -EINVAL;
+
+ attr_data.u64 = display_has_caps(actor->caps, caps);
+ }
+ break;
+ default:
+ ret = -EINVAL;
+ break;
+ }
+
+ if (ret < 0)
+ return ret;
+
+ switch (attr->type) {
+ case SYSCOMMON_RESMAN_DATA_TYPE_INT:
+ *(int32_t *) data = attr_data.i32;
+ break;
+ case SYSCOMMON_RESMAN_DATA_TYPE_INT64:
+ *(int64_t *) data = attr_data.i64;
+ break;
+ case SYSCOMMON_RESMAN_DATA_TYPE_UINT:
+ *(uint32_t *) data = attr_data.u32;
+ break;
+ case SYSCOMMON_RESMAN_DATA_TYPE_UINT64:
+ *(uint64_t *) data = attr_data.u64;
+ break;
+ case SYSCOMMON_RESMAN_DATA_TYPE_DOUBLE:
+ *(double *) data = attr_data.d;
+ break;
+ case SYSCOMMON_RESMAN_DATA_TYPE_PTR:
+ *(void **) data = attr_data.p;
+ break;
+ case SYSCOMMON_RESMAN_DATA_TYPE_BOOLEAN:
+ *(bool *) data = attr_data.b;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
static const struct syscommon_resman_resource_attribute display_attrs[] = {
{
.name = "DEVICED_DISPLAY_ATTR_INT_GET_MAX_BRIGHTNESS",
.get = get_display_attr_data,
.is_supported = syscommon_resman_resource_attr_supported_always,
},
+ }, {
+ .name = "DEVICED_DISPLAY_ATTR_UINT64_GET_ACTOR_CAPABILITY",
+ .id = DEVICED_DISPLAY_ATTR_UINT64_GET_ACTOR_CAPABILITY,
+ .type = SYSCOMMON_RESMAN_DATA_TYPE_UINT64_WITH_2_USER_DATA,
+ .flag = SYSCOMMON_RESMAN_RESOURCE_FLAG_PUBLIC,
+ .ops = {
+ .get_with_2_user_data = get_display_attr_data_with_2_user_data,
+ .is_supported = syscommon_resman_resource_attr_supported_always,
+ },
+ }, {
+ .name = "DEVICED_DISPLAY_ATTR_TUPLE3_SET_ACTOR_CAPABILITY",
+ .id = DEVICED_DISPLAY_ATTR_TUPLE3_SET_ACTOR_CAPABILITY,
+ .type = SYSCOMMON_RESMAN_DATA_TYPE_UINT64_UINT64_UINT64,
+ .flag = SYSCOMMON_RESMAN_RESOURCE_FLAG_PUBLIC,
+ .ops = {
+ .set_3_tuple = set_tuple3_display_attr_data,
+ .is_supported = syscommon_resman_resource_attr_supported_always,
+ },
}
};