#include "ambient-mode.h"
#include "util.h"
#include "core.h"
+#include "poll.h"
#include "lock-detector.h"
#include "display-ops.h"
#include "shared/devices.h"
#include "power/power-suspend.h"
#include "power/power-boot.h"
#include "power/power-doze.h"
+#include "display-plugin.h"
#include "display-dpms.h"
#include "display-signal.h"
#include "display-lock.h"
#define PALM_STR "palm"
#define UNKNOWN_STR "unknown"
-extern void init_pm_internal();
extern void init_save_userlock(void);
static struct display_plugin *disp_plgn;
return ret;
/* display_plugin instance initialization */
- init_pm_internal();
+ init_pm_internal(data);
disp_plgn->device_flags_to_string = __device_flags_to_string;
if (battery_plgn->handle) {
#include "ambient-mode.h"
#include "util.h"
#include "core.h"
+#include "poll.h"
#include "lock-detector.h"
#include "display-ops.h"
#include "shared/devices.h"
#include "power/power-suspend.h"
#include "power/power-boot.h"
#include "power/power-doze.h"
+#include "display-plugin.h"
#include "display-dpms.h"
#include "proximity.h"
#include "display-info.h"
#define PALM_STR "palm"
#define UNKNOWN_STR "unknown"
-extern void init_pm_internal();
extern void init_save_userlock(void);
static struct display_plugin *disp_plgn;
return ret;
/* display_plugin instance initialization */
- init_pm_internal();
+ init_pm_internal(data);
disp_plgn->device_flags_to_string = __device_flags_to_string;
if (battery_plgn->handle) {
#include "ambient-mode.h"
#include "util.h"
#include "core.h"
+#include "poll.h"
#include "lock-detector.h"
#include "display-ops.h"
#include "shared/devices.h"
#include "power/power-suspend.h"
#include "power/power-boot.h"
#include "power/power-doze.h"
+#include "display-plugin.h"
#include "display-dpms.h"
#include "display-signal.h"
#include "display-lock.h"
#define PALM_STR "palm"
#define UNKNOWN_STR "unknown"
-extern void init_pm_internal();
extern void init_save_userlock(void);
static struct display_plugin *disp_plgn;
return ret;
/* display_plugin instance initialization */
- init_pm_internal();
+ init_pm_internal(data);
disp_plgn->device_flags_to_string = __device_flags_to_string;
if (battery_plgn->handle) {
#include "ambient-mode.h"
#include "util.h"
#include "core.h"
+#include "poll.h"
#include "lock-detector.h"
#include "display-ops.h"
#include "shared/devices.h"
#include "power/power-suspend.h"
#include "power/power-boot.h"
#include "power/power-doze.h"
+#include "display-plugin.h"
#include "display-dpms.h"
#include "display-info.h"
#include "battery-monitor.h"
#define DISPLAY_DETACH_STR "display_detach"
#define UNKNOWN_STR "unknown"
-extern void init_pm_internal();
extern void init_save_userlock(void);
static struct display_plugin *disp_plgn;
return ret;
/* display_plugin instance initialization */
- init_pm_internal();
+ init_pm_internal(data);
disp_plgn->device_flags_to_string = __device_flags_to_string;
if (battery_plgn->handle) {
#include "shared/devices.h"
#include "core/log.h"
#include "display-ops.h"
+#include "display-plugin.h"
#include "power-supply.h"
#include "shared/plugin.h"
A_END = 2
};
-static struct display_plugin *disp_plgn;
-
static guint timeout_id;
static struct Batt_node *batt_head[B_END];
int capacity = 0;
int estimated_time = 0;
int tmp = 0;
+ bool system_wakeup_flag;
struct battery_status *battery;
battery = get_var_battery_status();
update_time(A_TIMETOFULL, estimated_time);
} else {
del_all_batt_node(B_CHARGING);
- if (disp_plgn->system_wakeup_flag == true) {
+ display_plugin_get_system_wakeup_flag(&system_wakeup_flag);
+ if (system_wakeup_flag == true) {
del_all_batt_node(B_UNCHARGING);
- disp_plgn->system_wakeup_flag = false;
+ display_plugin_set_system_wakeup_flag(false);
}
if (batt_head[B_UNCHARGING] == NULL) {
add_batt_node(B_UNCHARGING, clock, capacity);
};
DEVICE_OPS_REGISTER(&battery_time_device_ops)
-
-static void __CONSTRUCTOR__ initialize(void)
-{
- disp_plgn = get_var_display_plugin();
- if (!disp_plgn)
- _E("Failed to get display plugin variable.");
-}
#include "setting.h"
#include "poll.h"
#include "display-ops.h"
+#include "display-plugin.h"
#include "power/power.h"
#include "power/power-off.h"
#include "power-supply.h"
int (*func) (void *data);
};
-static struct display_plugin *disp_plgn;
static struct battery_plugin *battery_plgn;
static struct battery_status *battery;
if (lowbat_popup_option == BAT_OPT_ERR_TEMP_LOW ||
lowbat_popup_option == BAT_OPT_ERR_TEMP_HIGH ||
lowbat_popup_option == BAT_OPT_ERR_CF_OPEN) {
- if (disp_plgn->pm_change_internal)
- disp_plgn->pm_change_internal(INTERNAL_LOCK_LOWBAT, LCD_DIM);
+ display_plugin_pm_change_internal(INTERNAL_LOCK_LOWBAT, LCD_DIM);
} else {
- if (disp_plgn->pm_change_internal)
- disp_plgn->pm_change_internal(INTERNAL_LOCK_LOWBAT, LCD_NORMAL);
+ display_plugin_pm_change_internal(INTERNAL_LOCK_LOWBAT, LCD_NORMAL);
}
if (lowbat_popup_option == BAT_OPT_ERR_TEMP_LOW ||
lowbat_popup_option == BAT_OPT_ERR_TEMP_HIGH ||
int battery_charge_err_low_act(void *data)
{
- if (disp_plgn->pm_lock_internal)
- disp_plgn->pm_lock_internal(INTERNAL_LOCK_OVERCOOL, LCD_OFF, STAY_CUR_STATE, 60000);
+ display_plugin_pm_lock_internal(INTERNAL_LOCK_OVERCOOL, LCD_OFF, STAY_CUR_STATE, 60000);
+
return lowbat_popup(BAT_OPT_ERR_TEMP_LOW);
}
int battery_charge_err_high_act(void *data)
{
- if (disp_plgn->pm_lock_internal)
- disp_plgn->pm_lock_internal(INTERNAL_LOCK_OVERHEAT, LCD_OFF, STAY_CUR_STATE, 60000);
+ display_plugin_pm_lock_internal(INTERNAL_LOCK_OVERHEAT, LCD_OFF, STAY_CUR_STATE, 60000);
+
return lowbat_popup(BAT_OPT_ERR_TEMP_HIGH);
}
if (status != -1) {
result = status;
- if (disp_plgn->update_pm_setting)
- disp_plgn->update_pm_setting(SETTING_LOW_BATT, status);
+ display_plugin_update_pm_setting(SETTING_LOW_BATT, status);
} else
result = vconf_state;
static void __CONSTRUCTOR__ initialize(void)
{
- disp_plgn = get_var_display_plugin();
- if (!disp_plgn)
- _E("Failed to get display plugin variable.");
-
battery_plgn = get_var_battery_plugin();
if (!battery_plgn)
_E("Failed to get battery plugin variable.");
#define BATTERY_CHECK_TIMER_INTERVAL 500 /* 0.5 second */
#define LCD_DIM_TIME_IN_BATTERY_HEALTH 10000 /* ms */
-static struct display_plugin *disp_plgn;
static struct battery_plugin *battery_plgn;
static struct battery_status battery;
static void check_power_supply(int state)
{
pm_check_and_change(state);
- if (disp_plgn->update_pm_setting)
- disp_plgn->update_pm_setting(SETTING_CHARGING, state);
+ display_plugin_update_pm_setting(SETTING_CHARGING, state);
}
static void charger_state_send_system_event(int state)
if (status == DEVICE_NOTI_ON) {
battery_pm_change_internal(INTERNAL_LOCK_POPUP, LCD_DIM);
device_notify(DEVICE_NOTIFIER_BATTERY_PRESENT, (void *)&battery.present);
- if (disp_plgn->pm_lock_internal)
- disp_plgn->pm_lock_internal(INTERNAL_LOCK_POPUP, LCD_DIM, STAY_CUR_STATE, 0);
+ display_plugin_pm_lock_internal(INTERNAL_LOCK_POPUP, LCD_DIM, STAY_CUR_STATE, 0);
} else {
battery_pm_change_internal(INTERNAL_LOCK_POPUP, LCD_NORMAL);
device_notify(DEVICE_NOTIFIER_BATTERY_PRESENT, (void *)&battery.present);
- if (disp_plgn->pm_unlock_internal)
- disp_plgn->pm_unlock_internal(INTERNAL_LOCK_POPUP, LCD_DIM, PM_SLEEP_MARGIN);
+ display_plugin_pm_unlock_internal(INTERNAL_LOCK_POPUP, LCD_DIM, PM_SLEEP_MARGIN);
}
if (battery_plgn->changed_battery_cf)
battery_plgn->changed_battery_cf(battery.present);
device_notify(DEVICE_NOTIFIER_BATTERY_HEALTH, (void *)&battery.health);
battery_pm_change_internal(INTERNAL_LOCK_POPUP, LCD_NORMAL);
battery_pm_change_internal(INTERNAL_LOCK_POPUP, LCD_DIM);
- if (disp_plgn->pm_unlock_internal)
- disp_plgn->pm_unlock_internal(INTERNAL_LOCK_POPUP, LCD_OFF, PM_SLEEP_MARGIN);
- if (disp_plgn->pm_lock_internal)
- disp_plgn->pm_lock_internal(INTERNAL_LOCK_POPUP, LCD_DIM, STAY_CUR_STATE, LCD_DIM_TIME_IN_BATTERY_HEALTH);
+ display_plugin_pm_unlock_internal(INTERNAL_LOCK_POPUP, LCD_OFF, PM_SLEEP_MARGIN);
+ display_plugin_pm_lock_internal(INTERNAL_LOCK_POPUP, LCD_DIM, STAY_CUR_STATE, LCD_DIM_TIME_IN_BATTERY_HEALTH);
if (battery.health == HEALTH_LOW)
battery_charge_err_low_act(NULL);
else if (battery.health == HEALTH_HIGH)
} else {
battery_pm_change_internal(INTERNAL_LOCK_POPUP, LCD_NORMAL);
device_notify(DEVICE_NOTIFIER_BATTERY_HEALTH, (void *)&battery.health);
- if (disp_plgn->pm_unlock_internal) {
- disp_plgn->pm_unlock_internal(INTERNAL_LOCK_POPUP, LCD_DIM, PM_SLEEP_MARGIN);
- disp_plgn->pm_unlock_internal(INTERNAL_LOCK_POPUP, LCD_OFF, PM_SLEEP_MARGIN);
- }
+ display_plugin_pm_unlock_internal(INTERNAL_LOCK_POPUP, LCD_DIM, PM_SLEEP_MARGIN);
+ display_plugin_pm_unlock_internal(INTERNAL_LOCK_POPUP, LCD_OFF, PM_SLEEP_MARGIN);
health_status_broadcast();
if (abnormal_health_popup_timer) {
CRITICAL_LOG("Battery health returned to normal. Stop abnormal popup.");
if (abnormal_health_popup_timer)
g_source_remove(abnormal_health_popup_timer);
- if (disp_plgn->pm_unlock_internal)
- disp_plgn->pm_unlock_internal(INTERNAL_LOCK_POPUP, LCD_OFF, PM_SLEEP_MARGIN);
- if (disp_plgn->pm_lock_internal)
- disp_plgn->pm_lock_internal(INTERNAL_LOCK_POPUP, LCD_DIM, STAY_CUR_STATE, LCD_DIM_TIME_IN_BATTERY_HEALTH);
+ display_plugin_pm_unlock_internal(INTERNAL_LOCK_POPUP, LCD_OFF, PM_SLEEP_MARGIN);
+ display_plugin_pm_lock_internal(INTERNAL_LOCK_POPUP, LCD_DIM, STAY_CUR_STATE, LCD_DIM_TIME_IN_BATTERY_HEALTH);
if (battery.health == HEALTH_LOW)
battery_charge_err_low_act(NULL);
else if (battery.health == HEALTH_HIGH)
int ret_lock = -1;
int ret_val;
- if (disp_plgn->pm_lock_internal)
- ret_lock = disp_plgn->pm_lock_internal(INTERNAL_LOCK_BATTERY, LCD_OFF, STAY_CUR_STATE, 0);
+ ret_lock = display_plugin_pm_lock_internal(INTERNAL_LOCK_BATTERY, LCD_OFF, STAY_CUR_STATE, 0);
if (old_battery.charge_now != battery.charge_now || battery.charge_now == CHARGER_ABNORMAL) {
ret_val = vconf_set_int(VCONFKEY_SYSMAN_BATTERY_CHARGE_NOW, battery.charge_now);
old_battery.charge_now = battery.charge_now;
}
- if (disp_plgn->pm_unlock_internal) {
- if (ret_lock == 0) {
- disp_plgn->pm_unlock_internal(INTERNAL_LOCK_BATTERY, LCD_OFF, PM_SLEEP_MARGIN);
- }
+ if (ret_lock == 0) {
+ display_plugin_pm_unlock_internal(INTERNAL_LOCK_BATTERY, LCD_OFF, PM_SLEEP_MARGIN);
}
}
if (battery_do_not_disturb())
return 0;
- if (disp_plgn->pm_change_internal)
- disp_plgn->pm_change_internal(pid, s_bits);
+ display_plugin_pm_change_internal(pid, s_bits);
return 0;
}
static void __CONSTRUCTOR__ initialize(void)
{
- disp_plgn = get_var_display_plugin();
- if (!disp_plgn)
- _E("Failed to get display plugin variable.");
-
battery_plgn = get_var_battery_plugin();
if (!battery_plgn)
_E("Failed to get battery plugin variable.");
--- /dev/null
+/*
+ * deviced
+ *
+ * Copyright (c) 2023 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 "display-plugin.h"
+
+struct display_plugin g_display_plugin;
+
+void* display_plugin_handle(void)
+{
+ return g_display_plugin.handle;
+}
+
+int display_plugin_pm_lock_internal(pid_t pid, int s_bits, int flags, int timeout)
+{
+ if (g_display_plugin.pm_lock_internal)
+ return g_display_plugin.pm_lock_internal(pid, s_bits, flags, timeout);
+
+ return 0;
+}
+
+int display_plugin_pm_unlock_internal(pid_t pid, int s_bits, int flags)
+{
+ if (g_display_plugin.pm_unlock_internal)
+ return g_display_plugin.pm_unlock_internal(pid, s_bits, flags);
+
+ return 0;
+}
+
+int display_plugin_pm_change_internal(pid_t pid, int s_bits)
+{
+ if (g_display_plugin.pm_change_internal)
+ return g_display_plugin.pm_change_internal(pid, s_bits);
+
+ return 0;
+}
+
+int display_plugin_update_pm_setting(int key_idx, int val)
+{
+ if (g_display_plugin.update_pm_setting)
+ return g_display_plugin.update_pm_setting(key_idx, val);
+
+ return 0;
+}
+
+int display_plugin_get_lock_screen_state(void)
+{
+ if (g_display_plugin.get_lock_screen_state)
+ return g_display_plugin.get_lock_screen_state();
+
+ return 0;
+}
+
+int display_plugin_get_system_wakeup_flag(bool *flag)
+{
+ *flag = g_display_plugin.system_wakeup_flag;
+
+ return 0;
+}
+
+int display_plugin_set_system_wakeup_flag(bool flag)
+{
+ g_display_plugin.system_wakeup_flag = flag;
+
+ return 0;
+}
+
+const char* display_plugin_device_flags_to_string(enum device_flags flags)
+{
+ if (g_display_plugin.device_flags_to_string)
+ return g_display_plugin.device_flags_to_string(flags);
+
+ return NULL;
+}
+
+int display_plugin_auto_brightness_control(enum brightness_request_e request, int set_brightness)
+{
+ if (g_display_plugin.auto_brightness_control)
+ return g_display_plugin.auto_brightness_control(request, set_brightness);
+
+ return 0;
+}
--- /dev/null
+/*
+ * deviced
+ *
+ * Copyright (c) 2023 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 __DISPLAY_PLUGIN_H__
+#define __DISPLAY_PLUGIN_H__
+
+#include <unistd.h>
+#include <sys/types.h>
+
+#include "shared/devices.h"
+
+/* FIXME: Currently because of display_plugin.auto_brightness_control(),
+ * it is here. Please relocate it to proper place later. */
+enum brightness_request_e {
+ BR_MIN = 0,
+ /* entering request */
+ BR_LBM_ON,
+ BR_HBM_ON,
+ BR_HOLD_BRIGHTNESS,
+ BR_LOWDIM_ON, /* low battery dim */
+
+ /* exiting request */
+ BR_LBM_OFF,
+ BR_HBM_OFF,
+ BR_RELEASE_BRIGHTNESS,
+ BR_LOWDIM_OFF, /* low battery dim off */
+
+ /* special */
+ BR_SET_BRIGHTNESS,
+
+ BR_MAX,
+};
+
+/* request for brightness that managed internally.
+ * BR_HOLD_BRIGHTNESS and BR_SET_BRIGHTNESS does not use this implicit brightness
+ * for request, but explicitly request for a brightness value */
+#define BR_IMPLICIT (-1)
+
+struct display_plugin {
+ void *handle;
+ int (*pm_lock_internal) (pid_t pid, int s_bits, int flag, int timeout);
+ int (*pm_unlock_internal) (pid_t pid, int s_bits, int flag);
+ int (*pm_change_internal) (pid_t pid, int s_bits);
+ int (*update_pm_setting) (int key_idx, int val);
+ int (*get_lock_screen_state) (void);
+ bool system_wakeup_flag;
+ const char* (*device_flags_to_string) (enum device_flags flags);
+ int (*auto_brightness_control) (enum brightness_request_e request, int set_brightness);
+};
+
+void* display_plugin_handle(void);
+int display_plugin_pm_lock_internal(pid_t pid, int s_bits, int flags, int timeout);
+int display_plugin_pm_unlock_internal(pid_t pid, int s_bits, int flags);
+int display_plugin_pm_change_internal(pid_t pid, int s_bits);
+int display_plugin_update_pm_setting(int key_idx, int val);
+int display_plugin_get_lock_screen_state(void);
+int display_plugin_get_system_wakeup_flag(bool *flag);
+int display_plugin_set_system_wakeup_flag(bool flag);
+const char* display_plugin_device_flags_to_string(enum device_flags flags);
+int display_plugin_auto_brightness_control(enum brightness_request_e request, int set_brightness);
+
+#endif //__DISPLAY_PLUGIN_H__
#include <libsyscommon/list.h>
#include <shared/devices.h>
+#include "display-plugin.h"
#include "display/display.h"
#include "shared/log.h"
static const struct device_ops *display_plugin_device_ops;
+extern struct display_plugin g_display_plugin;
static int pm_cur_state;
static int pm_old_state;
static unsigned int pm_status_flag;
if (!display_plugin_device_ops || !display_plugin_device_ops->probe)
return 0;
- return display_plugin_device_ops->probe(data);
+ return display_plugin_device_ops->probe(&g_display_plugin);
}
static void display_init(void *data)
#define __DISPLAY_OPS_H__
#include <errno.h>
+#include "display-plugin.h"
#include "shared/common.h"
#include "shared/devices.h"
//#include "display.h"
#define DISPLAY_FUNC(a, b) (((a) << 16) | (b))
-enum brightness_request_e {
- BR_MIN = 0,
- /* entering request */
- BR_LBM_ON,
- BR_HBM_ON,
- BR_HOLD_BRIGHTNESS,
- BR_LOWDIM_ON, /* low battery dim */
-
- /* exiting request */
- BR_LBM_OFF,
- BR_HBM_OFF,
- BR_RELEASE_BRIGHTNESS,
- BR_LOWDIM_OFF, /* low battery dim off */
-
- /* special */
- BR_SET_BRIGHTNESS,
-
- BR_MAX,
-};
-
-/* request for brightness that managed internally.
- * BR_HOLD_BRIGHTNESS and BR_SET_BRIGHTNESS does not use this implicit brightness
- * for request, but explicitly request for a brightness value */
-#define BR_IMPLICIT (-1)
-
-struct display_plugin {
- void *handle;
- int (*pm_lock_internal) (pid_t pid, int s_bits, int flag, int timeout);
- int (*pm_unlock_internal) (pid_t pid, int s_bits, int flag);
- int (*pm_change_internal) (pid_t pid, int s_bits);
- int (*update_pm_setting) (int key_idx, int val);
- int (*get_lock_screen_state) ();
- bool system_wakeup_flag;
- const char* (*device_flags_to_string) (enum device_flags flags);
- int (*auto_brightness_control) (enum brightness_request_e request, int set_brightness);
-};
-
#endif
#include "core.h"
#include "poll.h"
#include "display-ops.h"
+#include "display-plugin.h"
#include "shared/plugin.h"
#define SHIFT_UNLOCK 4
#define __HOLDKEY_BLOCK_BIT 0x1
#define HOLDKEY_BLOCK_BIT (__HOLDKEY_BLOCK_BIT << LOCK_FLAG_SHIFT)
-static struct display_plugin *disp_plgn;
static PMMsg recv_data;
int check_dimstay(int next_state, int flag)
return 0;
}
-void init_pm_internal()
+void init_pm_internal(void *data)
{
- disp_plgn->pm_lock_internal = __pm_lock_internal;
- disp_plgn->pm_unlock_internal = __pm_unlock_internal;
- disp_plgn->pm_change_internal = __pm_change_internal;
-}
+ struct display_plugin *dp = (struct display_plugin *) data;
-static void __CONSTRUCTOR__ initialize(void)
-{
- disp_plgn = get_var_display_plugin();
- if (!disp_plgn)
- _E("Failed to get display plugin variable.");
+ dp->pm_lock_internal = __pm_lock_internal;
+ dp->pm_unlock_internal = __pm_unlock_internal;
+ dp->pm_change_internal = __pm_change_internal;
}
#define RESET_TIMER_STR "resettimer"
#define KEEP_TIMER_STR "keeptimer"
+void init_pm_internal(void *data);
+
/**
* @}
*/
#include "core/udev.h"
#include "core.h"
#include "display-ops.h"
+#include "display-plugin.h"
#include "extcon/extcon.h"
#include "shared/plugin.h"
#define METHOD_GET_CRADLE "GetCradle"
#define SIGNAL_CRADLE_STATE "ChangedCradle"
-static struct display_plugin *disp_plgn;
static struct extcon_ops cradle_extcon_ops;
static void cradle_send_broadcast(int status)
int ret;
_I("Cradle changed. status=%d", status);
- if (disp_plgn->pm_change_internal)
- disp_plgn->pm_change_internal(INTERNAL_LOCK_CRADLE, LCD_NORMAL);
+ display_plugin_pm_change_internal(INTERNAL_LOCK_CRADLE, LCD_NORMAL);
cradle_send_broadcast(status);
ret = vconf_set_int(VCONFKEY_SYSMAN_CRADLE_STATUS, status);
if (ret < 0) {
}
if (status == DOCK_SOUND) {
- if (disp_plgn->pm_lock_internal)
- disp_plgn->pm_lock_internal(INTERNAL_LOCK_CRADLE, LCD_DIM, STAY_CUR_STATE, 0);
+ display_plugin_pm_lock_internal(INTERNAL_LOCK_CRADLE, LCD_DIM, STAY_CUR_STATE, 0);
} else if (status == DOCK_NONE) {
- if (disp_plgn->pm_unlock_internal)
- disp_plgn->pm_unlock_internal(INTERNAL_LOCK_CRADLE, LCD_DIM, PM_SLEEP_MARGIN);
+ display_plugin_pm_unlock_internal(INTERNAL_LOCK_CRADLE, LCD_DIM, PM_SLEEP_MARGIN);
}
return 0;
cradle = cradle_extcon_ops.status;
if (cradle == DOCK_SOUND) {
- if (disp_plgn->pm_lock_internal)
- disp_plgn->pm_lock_internal(INTERNAL_LOCK_CRADLE, LCD_DIM, STAY_CUR_STATE, 0);
+ display_plugin_pm_lock_internal(INTERNAL_LOCK_CRADLE, LCD_DIM, STAY_CUR_STATE, 0);
_I("Sound dock is connected. Dim lock is on.");
}
};
EXTCON_OPS_REGISTER(cradle_extcon_ops)
-
-static void __CONSTRUCTOR__ initialize(void)
-{
- disp_plgn = get_var_display_plugin();
- if (!disp_plgn)
- _E("Failed to get display plugin variable.");
-}
#include "core/log.h"
#include "poll.h"
#include "display-ops.h"
+#include "display-plugin.h"
#include "extcon/extcon.h"
#include "shared/plugin.h"
#define SIGNAL_EARJACK_STATE "ChangedEarjack"
#define GET_EARJACK_STATE "Earjack"
-static struct display_plugin *disp_plgn;
static void earjack_send_broadcast(int status)
{
static int old = 0;
earjack_send_broadcast(status);
earjack_send_system_event(status);
if (status != EARJACK_DICONNECTED) {
- if (disp_plgn->pm_change_internal)
- disp_plgn->pm_change_internal(INTERNAL_LOCK_EARJACK, LCD_NORMAL);
+ display_plugin_pm_change_internal(INTERNAL_LOCK_EARJACK, LCD_NORMAL);
}
return 0;
};
EXTCON_OPS_REGISTER(earjack_extcon_ops)
-
-static void __CONSTRUCTOR__ initialize(void)
-{
- disp_plgn = get_var_display_plugin();
- if (!disp_plgn)
- _E("Failed to get display plugin variable.");
-}
#include "core.h"
#include "setting.h"
#include "display-ops.h"
+#include "display-plugin.h"
#include "touch-key.h"
#include "shared/plugin.h"
#define GET_BRIGHTNESS(val) (((val) >> 24) & 0xFF)
#define SET_BRIGHTNESS(val) (((val) & 0xFF) << 24)
-static struct display_plugin *disp_plgn;
static bool touchkey_dev_available = false;
static guint hardkey_timeout_id;
static int hardkey_duration;
touchled_set_state(true);
/* do not create turnoff timer in case of idle lock state */
- if (disp_plgn->get_lock_screen_state && disp_plgn->get_lock_screen_state() == VCONFKEY_IDLE_LOCK)
+ if (display_plugin_get_lock_screen_state() == VCONFKEY_IDLE_LOCK)
return;
/* start timer */
};
DEVICE_OPS_REGISTER(&touchled_device_ops)
-
-static void __CONSTRUCTOR__ initialize(void)
-{
- disp_plgn = get_var_display_plugin();
- if (!disp_plgn)
- _E("Failed to get display plugin variable.");
-}
#include "core/log.h"
#include "shared/common.h"
#include "apps.h"
-#include "shared/plugin.h"
+#include "display-plugin.h"
#include "shared/bitmap.h"
#define POPUP_METHOD "PopupLaunch"
#define BUFF_MAX 255
-static struct display_plugin *disp_plgn;
static struct dd_bitmap *bm_background;
static int pid_max;
va_end(args);
- if (disp_plgn->pm_change_internal)
- disp_plgn->pm_change_internal(INTERNAL_LOCK_POPUP, LCD_NORMAL);
+ display_plugin_pm_change_internal(INTERNAL_LOCK_POPUP, LCD_NORMAL);
return ret;
}
g_variant_new("(s)", type),
__cb, -1, NULL);
- if (disp_plgn->pm_change_internal)
- disp_plgn->pm_change_internal(INTERNAL_LOCK_POPUP, LCD_NORMAL);
+ display_plugin_pm_change_internal(INTERNAL_LOCK_POPUP, LCD_NORMAL);
+
return ret;
}
static void __CONSTRUCTOR__ initialize(void)
{
- disp_plgn = get_var_display_plugin();
- if (!disp_plgn)
- _E("Failed to get display plugin variable.");
-
init_bm_background();
}
#include "plugin.h"
#include "common.h"
+#include "display-plugin.h"
#include "core/log.h"
#ifndef LIBPATH
#endif
#define MODULE_PATH LIBPATH"/deviced/"
-static struct display_plugin disp_plgn;
+extern struct display_plugin g_display_plugin;
static struct battery_plugin battery_plgn;
static GList *plgn_list;
inline struct display_plugin *get_var_display_plugin(void)
{
- return &disp_plgn;
+ return &g_display_plugin;
}
inline struct battery_plugin *get_var_battery_plugin(void)
_I("Plugin(%s) is loaded. handle=%#x", ent->d_name, (unsigned int)((intptr_t)handle));
plgn_list = g_list_append(plgn_list, handle);
if (!strcmp(ent->d_name, "display.so"))
- disp_plgn.handle = handle;
+ g_display_plugin.handle = handle;
else if (!strcmp(ent->d_name, "battery.so"))
battery_plgn.handle = handle;
}
#include "poll.h"
#include "core.h"
#include "display-ops.h"
+#include "display-plugin.h"
#include "shared/common.h"
#include "shared/device-notifier.h"
#include "shared/plugin.h"
#define TIME_CHANGE_SIGNAL "STimeChanged"
-static struct display_plugin *disp_plgn;
static const time_t default_time = 2147483645; /* max(32bit) -3sec */
static guint tfdh; /* tfd change noti */
static int tfd = -1;
else
pm_state = 0x4;
- if (disp_plgn->pm_lock_internal)
- disp_plgn->pm_lock_internal(INTERNAL_LOCK_TIME, pm_state, STAY_CUR_STATE, 0);
+ display_plugin_pm_lock_internal(INTERNAL_LOCK_TIME, pm_state, STAY_CUR_STATE, 0);
ret = handle_date(argv[0]);
- if (disp_plgn->pm_unlock_internal)
- disp_plgn->pm_unlock_internal(INTERNAL_LOCK_TIME, pm_state, STAY_CUR_STATE);
+ display_plugin_pm_unlock_internal(INTERNAL_LOCK_TIME, pm_state, STAY_CUR_STATE);
return ret;
}
else
pm_state = 0x4;
- if (disp_plgn->pm_lock_internal)
- disp_plgn->pm_lock_internal(INTERNAL_LOCK_TIME, pm_state, STAY_CUR_STATE, 0);
+ display_plugin_pm_lock_internal(INTERNAL_LOCK_TIME, pm_state, STAY_CUR_STATE, 0);
ret = handle_timezone(argv[0]);
- if (disp_plgn->pm_unlock_internal)
- disp_plgn->pm_unlock_internal(INTERNAL_LOCK_TIME, pm_state, STAY_CUR_STATE);
+ display_plugin_pm_unlock_internal(INTERNAL_LOCK_TIME, pm_state, STAY_CUR_STATE);
return ret;
}
_E("Failed system time change detector init.");
register_notifier(DEVICE_NOTIFIER_LCD, time_lcd_changed_cb);
- get_cond_head = dlsym(disp_plgn->handle, "get_cond_head");
+ get_cond_head = dlsym(display_plugin_handle(), "get_cond_head");
if (!get_cond_head)
_E("Failed to load symbol get_cond_head(), %s.", dlerror());
}
};
DEVICE_OPS_REGISTER(&time_device_ops)
-
-static void __CONSTRUCTOR__ initialize(void)
-{
- disp_plgn = get_var_display_plugin();
- if (!disp_plgn)
- _E("Failed to get display plugin variable.");
-}
#include "battery/power-supply.h"
#include "core.h"
#include "display-ops.h"
+#include "display-plugin.h"
#include "power/power-boot.h"
#include "shared/plugin.h"
POWERSAVING_ON,
};
-static struct display_plugin *disp_plgn;
static struct battery_plugin *battery_plgn;
static bool touchscreen_dev_available = false;
static int touchscreen_enable = DEVICE_OPS_STATUS_START;
static void touchscreen_init(void *data)
{
int ret, val;
+ void *handle = display_plugin_handle();
- fp_get_var_display_config = dlsym(disp_plgn->handle, "get_var_display_config");
+ fp_get_var_display_config = dlsym(handle, "get_var_display_config");
if (fp_get_var_display_config) {
display_conf = fp_get_var_display_config();
if (!display_conf)
* So it fails that fetching symbol directly with name 'backlight_ops'.
* To avoid this, fetches getter function 'get_var_backlight_ops' instead, and
* retrieve the 'backlight_ops' by using it */
- fp_get_var_backlight_ops = dlsym(disp_plgn->handle, "get_var_backlight_ops");
+ fp_get_var_backlight_ops = dlsym(handle, "get_var_backlight_ops");
if (fp_get_var_backlight_ops) {
backlight_ops = fp_get_var_backlight_ops();
if (!backlight_ops)
static void __CONSTRUCTOR__ initialize(void)
{
- disp_plgn = get_var_display_plugin();
- if (!disp_plgn)
- _E("Failed to get display plugin variable.");
-
battery_plgn = get_var_battery_plugin();
if (!battery_plgn)
_E("Failed to get battery plugin variable.");
#include "core/udev.h"
#include "poll.h"
#include "display-ops.h"
+#include "display-plugin.h"
#include "shared/plugin.h"
#include "usb-gadget.h"
static int usb_change_gadget(unsigned mode);
-static struct display_plugin *disp_plgn;
-
static int usb_config_init(void)
{
unsigned int mode = usb_state_get_selected_mode();
int ret;
unsigned int mode = usb_state_get_selected_mode();
- if (disp_plgn->pm_lock_internal)
- disp_plgn->pm_lock_internal(INTERNAL_LOCK_USB, LCD_OFF, STAY_CUR_STATE, 0);
+ display_plugin_pm_lock_internal(INTERNAL_LOCK_USB, LCD_OFF, STAY_CUR_STATE, 0);
usb_state_set_connection(USB_CONNECTED);
send_usb_state_changed_event(VCONFKEY_SYSMAN_USB_CONNECTED);
ret = usb_disable();
if(ret < 0) {
_E("Failed to disable USB gadget: %d", ret);
- /* Important: You have to keep going to unlock disp_plgn->pm_unlock_internal */
+ /* Important: You have to keep going to unlock display_plugin_pm_unlock_internal */
}
- if (disp_plgn->pm_unlock_internal)
- disp_plgn->pm_unlock_internal(INTERNAL_LOCK_USB, LCD_OFF, STAY_CUR_STATE);
+ display_plugin_pm_unlock_internal(INTERNAL_LOCK_USB, LCD_OFF, STAY_CUR_STATE);
return ret;
}
};
EXTCON_OPS_REGISTER(extcon_usb_ops)
-
-static void __CONSTRUCTOR__ initialize(void)
-{
- disp_plgn = get_var_display_plugin();
- if (!disp_plgn)
- _E("Failed to get display plugin variable.");
-}
#include "core/udev.h"
#include "extcon/extcon.h"
#include "display-ops.h"
+#include "display-plugin.h"
#include "core.h"
#include "dd-usbhost.h"
#include "shared/plugin.h"
#define ROOTPATH tzplatform_getenv(TZ_SYS_VAR)
#define POLICY_FILENAME "usbhost-policy"
-static struct display_plugin *disp_plgn;
static struct display_config *disp_conf;
static struct display_config* (*fp_get_var_display_config)(void);
static bool display_on_usb_conn_changed = true;
broadcast_usbhost_signal(USB_HOST_ADDED, usbhost);
- if (display_on_usb_conn_changed && disp_plgn->pm_change_internal)
- disp_plgn->pm_change_internal(INTERNAL_LOCK_USB_HOST, LCD_NORMAL);
+ if (display_on_usb_conn_changed)
+ display_plugin_pm_change_internal(INTERNAL_LOCK_USB_HOST, LCD_NORMAL);
/* for debugging */
_I("USB HOST Added.");
broadcast_usbhost_signal(USB_HOST_REMOVED, usbhost);
- if (display_on_usb_conn_changed && disp_plgn->pm_change_internal)
- disp_plgn->pm_change_internal(INTERNAL_LOCK_USB_HOST, LCD_NORMAL);
+ if (display_on_usb_conn_changed)
+ display_plugin_pm_change_internal(INTERNAL_LOCK_USB_HOST, LCD_NORMAL);
/* for debugging */
_I("USB HOST Removed.");
{
int ret;
- fp_get_var_display_config = dlsym(disp_plgn->handle, "get_var_display_config");
+ fp_get_var_display_config = dlsym(display_plugin_handle(), "get_var_display_config");
if (fp_get_var_display_config) {
disp_conf = fp_get_var_display_config();
if (!disp_conf)
};
EXTCON_OPS_REGISTER(extcon_usbhost_ops)
-
-static void __CONSTRUCTOR__ initialize(void)
-{
- disp_plgn = get_var_display_plugin();
- if (!disp_plgn)
- _E("Failed to get display plugin variable.");
-}
SET(WRAP_FLAGS "-Wl,--wrap=dlopen")
SET(WRAP_FLAGS "${WRAP_FLAGS} -Wl,--wrap=access")
+SET(WRAP_FLAGS "${WRAP_FLAGS} -Wl,--wrap=display_plugin_pm_change_internal")
FILE(GLOB ORIG_SRCS "${CMAKE_SOURCE_DIR}/src/shared/*.c")
ADD_LIBRARY(test-shared SHARED ${ORIG_SRCS})
#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+/* FIXME: This would be replaced to plugin-api-deviced */
+#include "display-plugin.h"
#include "test-main.h"
#include "test-mock.h"
+struct display_plugin g_display_plugin;
+
int __wrap_access(const char *pathname, int mode)
{
return mock_type(int);
return ret;
}
+
+int __wrap_display_plugin_pm_change_internal(pid_t pid, int s_bits)
+{
+ return 0;
+}