From: Youngjae Cho Date: Wed, 12 Jun 2024 02:21:39 +0000 (+0900) Subject: display: Replace enum device_flags with deviced_event X-Git-Tag: accepted/tizen/8.0/unified/20240618.013352~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=50f1c27a7292c5284f99a29327fe20d7c66fec6f;p=platform%2Fcore%2Fsystem%2Fdeviced.git display: Replace enum device_flags with deviced_event The enum device_flags comprised two kind of semantics, one is 'mode' that controls devices in a specific way, and the other is 'event' that used to be used as a reason by which an operation of the deviced is triggered. Throughout the several previous patches, all the 'mode' flags except NORMAL_MODE has been removed. Therefore, flag becomes having no choice but NORMAL_MODE for 'mode', so the NORMAL_MODE can be remove as well. And the remaining 'event' related flags are replaced with enum deviced_event that come from the libsyscommon. Currently, the previous LCD_ON_BY_EVENT or LCD_OFF_BY_EVENT, which didn't specify a specific event but just event, have been replaced with DEVICED_EVENT_UNKOWN. Change-Id: Id9f267729ee8fddebde9ae19f8c263659534da61 Signed-off-by: Youngjae Cho --- diff --git a/plugins/mobile/display/core.c b/plugins/mobile/display/core.c index ce1f21d3..fcd55808 100644 --- a/plugins/mobile/display/core.c +++ b/plugins/mobile/display/core.c @@ -141,7 +141,7 @@ static int default_proc_change_state(unsigned int cond, pid_t pid) switch (next) { case SYSCOMMON_DEVICED_DISPLAY_STATE_ON: if (display_panel_get_dpms_cached_state() != SYSCOMMON_DEVICED_DPMS_ON) - display_panel_lcd_on_direct(LCD_ON_BY_EVENT); + display_panel_lcd_on_direct(DEVICED_EVENT_UNKNOWN); display_state_transition_update_lock_screen_timeout(LOCK_SCREEN_CONTROL_TIMEOUT); display_state_transition_do_proc_change_state_action(next, -1); break; @@ -151,9 +151,13 @@ static int default_proc_change_state(unsigned int cond, pid_t pid) case SYSCOMMON_DEVICED_DISPLAY_STATE_OFF: if (display_panel_get_dpms_cached_state() == SYSCOMMON_DEVICED_DPMS_ON) { if (get_proximity_state() == SENSOR_PROXIMITY_NEAR) - display_panel_lcd_off_procedure(LCD_OFF_BY_PROXIMITY); + display_panel_lcd_off_procedure(DEVICED_EVENT_MISC_PROXIMITY); else - display_panel_lcd_off_procedure(LCD_OFF_BY_EVENT); + /** + * FIXME: need to convey reason to this point + * from the top of this subroutine. + */ + display_panel_lcd_off_procedure(DEVICED_EVENT_UNKNOWN); } if (set_custom_lcdon_timeout(0)) display_state_transition_update_display_state_timeout_by_priority(); @@ -200,7 +204,6 @@ static int display_probe(void *data) dp->config = &display_conf; init_display_states(dp); setup_display_plugin_backlight_ops(dp); - dp->get_device_flags = NULL; dp->lcd_on_procedure = NULL; dp->lcd_off_procedure = NULL; dp->custom_lcd_on = NULL; diff --git a/plugins/mobile/display/key-filter.c b/plugins/mobile/display/key-filter.c index 137a34ba..a658fbb7 100644 --- a/plugins/mobile/display/key-filter.c +++ b/plugins/mobile/display/key-filter.c @@ -207,17 +207,17 @@ static inline void broadcast_lcdoff_by_powerkey(void) NULL); } -static inline bool switch_on_lcd(enum device_flags flags) +static inline bool switch_on_lcd(enum deviced_event reason) { if (current_state_in_on()) return false; - if (flags & LCD_ON_BY_POWER_KEY) + if (reason == DEVICED_EVENT_INPUT_POWERKEY) broadcast_lcdon_by_powerkey(); - else if (flags & LCD_ON_BY_TOUCH) + else if (reason == DEVICED_EVENT_TOUCHSCREEN) _I("Display on by Touch_wakeup event"); - display_panel_lcd_on_direct(flags); + display_panel_lcd_on_direct(reason); return true; } @@ -232,7 +232,7 @@ static inline void switch_off_lcd(void) broadcast_lcdoff_by_powerkey(); - display_panel_lcd_off_procedure(LCD_OFF_BY_POWER_KEY); + display_panel_lcd_off_procedure(DEVICED_EVENT_INPUT_POWERKEY); } static void check_key_combination(struct input_event *pinput) @@ -345,7 +345,7 @@ static int process_menu_key(struct input_event *pinput) _D("No lcd-on capability!"); return true; } else if (pinput->value == KEY_PRESSED) - switch_on_lcd(LCD_ON_BY_POWER_KEY); + switch_on_lcd(DEVICED_EVENT_INPUT_POWERKEY); return false; } @@ -427,7 +427,7 @@ static gboolean display_on_cb(void *data) if (display_panel_get_dpms_cached_state() != SYSCOMMON_DEVICED_DPMS_ON || current_state_in_on() == false) { broadcast_lcdon_by_powerkey(); - display_panel_lcd_on_direct(LCD_ON_BY_POWER_KEY); + display_panel_lcd_on_direct(DEVICED_EVENT_INPUT_POWERKEY); display_state_transition_do_state_transition_by_input_poll_event(); } @@ -439,7 +439,7 @@ static int process_back_key(struct input_event *pinput) int ignore = true; if (pinput->value == KEY_PRESSED) { - switch_on_lcd(LCD_ON_BY_BACK_KEY); + switch_on_lcd(DEVICED_EVENT_INPUT_BACKKEY); _I("back key pressed"); ignore = false; } @@ -728,7 +728,7 @@ static void check_key_filter(struct timeval time, unsigned short type, unsigned break; if (current == SYSCOMMON_DEVICED_DISPLAY_STATE_OFF && bezel_wakeup) { - switch_on_lcd(LCD_ON_BY_BEZEL); + switch_on_lcd(DEVICED_EVENT_INPUT_BEZEL); ignore = false; } else if (current != SYSCOMMON_DEVICED_DISPLAY_STATE_OFF) ignore = false; @@ -741,7 +741,7 @@ static void check_key_filter(struct timeval time, unsigned short type, unsigned update_vital_state(pinput); if (pinput->value == KEY_PRESSED) { - switch_on_lcd(LCD_ON_BY_TOUCH); + switch_on_lcd(DEVICED_EVENT_TOUCHSCREEN); ignore = false; } diff --git a/plugins/tv/display/core.c b/plugins/tv/display/core.c index f2d8b24e..2303cb9a 100644 --- a/plugins/tv/display/core.c +++ b/plugins/tv/display/core.c @@ -147,7 +147,6 @@ static int display_probe(void *data) dp->config = &display_conf; init_display_states(dp); setup_display_plugin_backlight_ops(dp); - dp->get_device_flags = NULL; dp->lcd_on_procedure = NULL; dp->lcd_off_procedure = NULL; dp->custom_lcd_on = NULL; diff --git a/plugins/tv/display/key-filter.c b/plugins/tv/display/key-filter.c index 332c3c48..383782d2 100644 --- a/plugins/tv/display/key-filter.c +++ b/plugins/tv/display/key-filter.c @@ -217,17 +217,17 @@ static inline void broadcast_lcdoff_by_powerkey(void) NULL); } -static inline bool switch_on_lcd(enum device_flags flags) +static inline bool switch_on_lcd(enum deviced_event reason) { if (current_state_in_on()) return false; - if (flags & LCD_ON_BY_POWER_KEY) + if (reason == DEVICED_EVENT_INPUT_POWERKEY) broadcast_lcdon_by_powerkey(); - else if (flags & LCD_ON_BY_TOUCH) + else if (reason == DEVICED_EVENT_TOUCHSCREEN) _I("Display on by Touch_wakeup event"); - display_panel_lcd_on_direct(flags); + display_panel_lcd_on_direct(reason); return true; } @@ -242,7 +242,7 @@ static inline void switch_off_lcd(void) broadcast_lcdoff_by_powerkey(); - display_panel_lcd_off_procedure(LCD_OFF_BY_POWER_KEY); + display_panel_lcd_off_procedure(DEVICED_EVENT_INPUT_POWERKEY); } static void check_key_combination(struct input_event *pinput) @@ -355,7 +355,7 @@ static int process_menu_key(struct input_event *pinput) _D("No lcd-on capability!"); return true; } else if (pinput->value == KEY_PRESSED) - switch_on_lcd(LCD_ON_BY_POWER_KEY); + switch_on_lcd(DEVICED_EVENT_INPUT_POWERKEY); return false; } @@ -420,7 +420,7 @@ static int process_back_key(struct input_event *pinput) int ignore = true; if (pinput->value == KEY_PRESSED) { - switch_on_lcd(LCD_ON_BY_BACK_KEY); + switch_on_lcd(DEVICED_EVENT_INPUT_BACKKEY); _I("back key pressed"); ignore = false; } @@ -469,7 +469,7 @@ static int process_power_key(struct input_event *pinput) break; case KEY_PRESSED: if (display_has_caps(caps, SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDON)) { - skip_lcd_off = switch_on_lcd(LCD_ON_BY_POWER_KEY); + skip_lcd_off = switch_on_lcd(DEVICED_EVENT_INPUT_POWERKEY); } else { _D("No lcdon capability!"); skip_lcd_off = false; @@ -696,7 +696,7 @@ static void check_key_filter(struct timeval time, unsigned short type, unsigned break; if (current == SYSCOMMON_DEVICED_DISPLAY_STATE_OFF && bezel_wakeup) { - switch_on_lcd(LCD_ON_BY_BEZEL); + switch_on_lcd(DEVICED_EVENT_INPUT_BEZEL); ignore = false; } else if (current != SYSCOMMON_DEVICED_DISPLAY_STATE_OFF) ignore = false; @@ -709,7 +709,7 @@ static void check_key_filter(struct timeval time, unsigned short type, unsigned update_vital_state(pinput); if (pinput->value == KEY_PRESSED) { - switch_on_lcd(LCD_ON_BY_TOUCH); + switch_on_lcd(DEVICED_EVENT_TOUCHSCREEN); ignore = false; } diff --git a/plugins/wearable/display/bezel.c b/plugins/wearable/display/bezel.c index 3f4abdbb..c67b2e19 100644 --- a/plugins/wearable/display/bezel.c +++ b/plugins/wearable/display/bezel.c @@ -258,7 +258,7 @@ static enum bezel_state bezel_wakeup_control(void) return BEZEL_TURNON; } -static int bezel_start(enum device_flags flags) +static int bezel_start(enum deviced_event reason) { if (!bezel_dev_available) return 0; @@ -269,7 +269,7 @@ static int bezel_start(enum device_flags flags) return 0; } -static int bezel_stop(enum device_flags flags) +static int bezel_stop(enum deviced_event reason) { enum bezel_state state; diff --git a/plugins/wearable/display/core.c b/plugins/wearable/display/core.c index 3e611947..db688aeb 100644 --- a/plugins/wearable/display/core.c +++ b/plugins/wearable/display/core.c @@ -154,21 +154,8 @@ inline struct syscommon_deviced_display_state_info *state_st(enum syscommon_devi return &states[state]; } -static int get_device_flags(unsigned long *device_flags) +static void lcd_on_procedure(int state, enum deviced_event reason) { - if (!device_flags) - return -EINVAL; - - *device_flags = NORMAL_MODE; - - return 0; -} - -static void lcd_on_procedure(int state, enum device_flags flag) -{ - unsigned long flags = NORMAL_MODE; - display_plugin_get_device_flags(&flags); - flags |= flag; int ret; /* @@ -192,11 +179,11 @@ static void lcd_on_procedure(int state, enum device_flags flag) return; } - _I("[lcdstep] 0x%lx", flags); + _I("[lcdstep] reason: %s", syscommon_plugin_deviced_common_get_event_name(reason)); /* send LCDOn dbus signal */ if (!lcdon_broadcast) - broadcast_lcd_on(SIGNAL_PRE, flags); + broadcast_lcd_on(SIGNAL_PRE, reason); /* Update brightness level */ if (state == LCD_DIM) @@ -209,22 +196,18 @@ static void lcd_on_procedure(int state, enum device_flags flag) else if (state == LCD_DIM) set_setting_pmstate(SYSCOMMON_DEVICED_DISPLAY_STATE_DIM); - display_start_dependent_device(flags); + display_start_dependent_device(reason); if (!lcdon_broadcast) { - broadcast_lcd_on(SIGNAL_POST, flags); + broadcast_lcd_on(SIGNAL_POST, reason); lcdon_broadcast = true; } display_misc_set_touch_event_blocked(false); } -static void lcd_off_procedure(enum device_flags flag) +static void lcd_off_procedure(enum deviced_event reason) { - unsigned long flags = NORMAL_MODE; - display_plugin_get_device_flags(&flags); - flags |= flag; - /* * Display off procedure * step 0. enhance mode off using nofity (e.g mdnie, HBM, LBM) @@ -236,14 +219,14 @@ static void lcd_off_procedure(enum device_flags flag) * step 4. broadcast lcd off complete siganl * step 5. enter doze mode if it is enabled */ - _I("[lcdstep] 0x%lx", flags); + _I("[lcdstep] reason: %s", syscommon_plugin_deviced_common_get_event_name(reason)); /* notification */ syscommon_notifier_emit_notify(DEVICED_NOTIFIER_LCD_OFF, NULL); if (lcdon_broadcast) { - broadcast_lcd_off(SIGNAL_PRE, flags); + broadcast_lcd_off(SIGNAL_PRE, reason); lcdon_broadcast = false; } @@ -253,9 +236,9 @@ static void lcd_off_procedure(enum device_flags flag) set_setting_pmstate(SYSCOMMON_DEVICED_DISPLAY_STATE_OFF); - display_stop_dependent_device(flags); + display_stop_dependent_device(reason); - broadcast_lcd_off(SIGNAL_POST, flags); + broadcast_lcd_off(SIGNAL_POST, reason); syscommon_notifier_emit_notify(DEVICED_NOTIFIER_LCD_OFF_COMPLETE, NULL); enter_doze(); @@ -309,7 +292,7 @@ int custom_lcdon(int timeout) return -EINVAL; if (check_lcd_is_on() == false) - display_panel_lcd_on_direct(LCD_ON_BY_GESTURE); + display_panel_lcd_on_direct(DEVICED_EVENT_MISC_GESTURE); /* Exceptional case: * During tutorial, reset timeout by default timeout, not the given timeout */ @@ -340,7 +323,7 @@ int custom_lcdon(int timeout) return 0; } -int custom_lcdoff(enum device_flags flag) +int custom_lcdoff(enum deviced_event reason) { struct syscommon_deviced_display_state_info *st; @@ -350,7 +333,7 @@ int custom_lcdoff(enum device_flags flag) * call app can be changed to lcd state by proximity. * If proximity is near then normal lock will be unlocked. */ - if (flag & LCD_OFF_BY_PROXIMITY) { + if (reason == DEVICED_EVENT_MISC_PROXIMITY) { _I("custom lcd off by proximity, delete normal lock"); display_lock_release_lock_all(SYSCOMMON_DEVICED_DISPLAY_STATE_ON); } else { @@ -359,9 +342,9 @@ int custom_lcdoff(enum device_flags flag) } } - _I("custom lcd off by flag(%d)", flag); + _I("custom lcd off by reason(%d)", reason); if (display_panel_get_dpms_cached_state() == SYSCOMMON_DEVICED_DPMS_ON) - lcd_off_procedure(flag); + lcd_off_procedure(reason); if (set_custom_lcdon_timeout(0) == true) display_state_transition_update_display_state_timeout_by_priority(); @@ -381,15 +364,15 @@ int custom_lcdoff(enum device_flags flag) int display_on_by_reason(const char *reason, int timeout) { struct syscommon_deviced_display_state_info *st; - int flag; + int _reason; int str_len; str_len = strlen(reason); if (!strncmp(reason, GESTURE_STR, str_len)) - flag = LCD_ON_BY_GESTURE; + _reason = DEVICED_EVENT_MISC_GESTURE; else if (!strncmp(reason, EVENT_STR, str_len)) - flag = LCD_ON_BY_EVENT; + _reason = DEVICED_EVENT_UNKNOWN; else { _E("Reason is unknown(%s)", reason); return -EINVAL; @@ -401,7 +384,7 @@ int display_on_by_reason(const char *reason, int timeout) } if (check_lcd_is_on() == false) - display_panel_lcd_on_direct(flag); + display_panel_lcd_on_direct(_reason); _I("platform lcd on by %s (%d ms)", reason, timeout); if (set_custom_lcdon_timeout(timeout) == true) @@ -422,7 +405,7 @@ int display_on_by_reason(const char *reason, int timeout) int display_off_by_reason(const char *reason) { struct syscommon_deviced_display_state_info *st; - int flag; + int _reason; int str_len; str_len = strlen(reason); @@ -432,17 +415,17 @@ int display_off_by_reason(const char *reason) _I("skip platform lcd off by gesture"); return -ECANCELED; } - flag = LCD_OFF_BY_GESTURE; + _reason = DEVICED_EVENT_MISC_GESTURE; } else if (!strncmp(reason, PALM_STR, str_len)) { display_lock_release_lock_all(SYSCOMMON_DEVICED_DISPLAY_STATE_ON); display_lock_release_lock_all(SYSCOMMON_DEVICED_DISPLAY_STATE_DIM); - flag = LCD_OFF_BY_PALM; + _reason = DEVICED_EVENT_MISC_PALM; } else if (!strncmp(reason, DISPLAY_DETACH_STR, str_len)) { display_lock_release_lock_all(SYSCOMMON_DEVICED_DISPLAY_STATE_ON); display_lock_release_lock_all(SYSCOMMON_DEVICED_DISPLAY_STATE_DIM); - flag = LCD_OFF_BY_DISPLAY_DETACH; + _reason = DEVICED_EVENT_DEVICE_DETACH; } else { _E("Reason is unknown(%s)", reason); return -EINVAL; @@ -450,7 +433,7 @@ int display_off_by_reason(const char *reason) _I("platform lcd off by %s", reason); if (display_panel_get_dpms_cached_state() == SYSCOMMON_DEVICED_DPMS_ON) - lcd_off_procedure(flag); + lcd_off_procedure(_reason); /* state transition */ set_pm_old_state(get_pm_cur_state()); @@ -474,7 +457,7 @@ static int default_proc_change_state(unsigned int cond, pid_t pid) switch (next) { case SYSCOMMON_DEVICED_DISPLAY_STATE_ON: if (check_lcd_is_on() == false) - display_panel_lcd_on_direct(LCD_ON_BY_EVENT); + display_panel_lcd_on_direct(DEVICED_EVENT_UNKNOWN); display_state_transition_update_lock_screen_timeout(LOCK_SCREEN_CONTROL_TIMEOUT); display_state_transition_do_proc_change_state_action(next, -1); break; @@ -483,7 +466,7 @@ static int default_proc_change_state(unsigned int cond, pid_t pid) break; case SYSCOMMON_DEVICED_DISPLAY_STATE_OFF: if (display_panel_get_dpms_cached_state() == SYSCOMMON_DEVICED_DPMS_ON) - lcd_off_procedure(LCD_OFF_BY_EVENT); + lcd_off_procedure(DEVICED_EVENT_UNKNOWN); if (set_custom_lcdon_timeout(0)) display_state_transition_update_display_state_timeout_by_priority(); display_state_transition_do_proc_change_state_action(next, -1); @@ -645,7 +628,7 @@ static int default_action(int timeout) display_backlight_update_by_default_brightness(); if (check_lcd_is_on() == false) - lcd_on_procedure(LCD_NORMAL, NORMAL_MODE); + lcd_on_procedure(LCD_NORMAL, DEVICED_EVENT_UNKNOWN); break; case SYSCOMMON_DEVICED_DISPLAY_STATE_DIM: @@ -658,25 +641,25 @@ static int default_action(int timeout) display_backlight_set_brightness_by_dim_brightness(); if ((get_pm_old_state() == SYSCOMMON_DEVICED_DISPLAY_STATE_OFF) || (get_pm_old_state() == SYSCOMMON_DEVICED_DISPLAY_STATE_SLEEP)) - lcd_on_procedure(LCD_DIM, NORMAL_MODE); + lcd_on_procedure(LCD_DIM, DEVICED_EVENT_UNKNOWN); break; case SYSCOMMON_DEVICED_DISPLAY_STATE_OFF: if ((get_pm_old_state() != SYSCOMMON_DEVICED_DISPLAY_STATE_SLEEP) && (get_pm_old_state() != SYSCOMMON_DEVICED_DISPLAY_STATE_OFF)) { /* lcd off state : turn off the backlight */ if (display_panel_get_dpms_cached_state() == SYSCOMMON_DEVICED_DPMS_ON) - lcd_off_procedure(LCD_OFF_BY_TIMEOUT); + lcd_off_procedure(DEVICED_EVENT_DISPLAY_SCREEN_TIMEOUT); } display_panel_get_lcd_paneloff_mode(&lcd_paneloff_mode); if (display_panel_get_dpms_cached_state() == SYSCOMMON_DEVICED_DPMS_ON || lcd_paneloff_mode) - lcd_off_procedure(LCD_OFF_BY_TIMEOUT); + lcd_off_procedure(DEVICED_EVENT_DISPLAY_SCREEN_TIMEOUT); break; case SYSCOMMON_DEVICED_DISPLAY_STATE_SLEEP: if (display_panel_get_dpms_cached_state() == SYSCOMMON_DEVICED_DPMS_ON) - lcd_off_procedure(LCD_OFF_BY_TIMEOUT); + lcd_off_procedure(DEVICED_EVENT_DISPLAY_SCREEN_TIMEOUT); if (!pm_get_power_lock_support()) { /* sleep state : set system mode to SUSPEND */ @@ -795,7 +778,7 @@ static int update_setting(int key_idx, int val) val == VCONFKEY_IDLE_LOCK && display_panel_get_dpms_cached_state() != SYSCOMMON_DEVICED_DPMS_ON && is_lcdon_blocked() == LCDON_BLOCK_NONE) - lcd_on_procedure(LCD_NORMAL, LCD_ON_BY_EVENT); + lcd_on_procedure(LCD_NORMAL, DEVICED_EVENT_UNKNOWN); display_state_transition_update_display_state_timeout_by_priority(); if (get_pm_cur_state() == SYSCOMMON_DEVICED_DISPLAY_STATE_ON) states[get_pm_cur_state()].trans(EVENT_INPUT); @@ -851,7 +834,6 @@ static int display_probe(void *data) dp->config = &display_conf; init_display_states(dp); setup_display_plugin_backlight_ops(dp); - dp->get_device_flags = get_device_flags; dp->lcd_on_procedure = lcd_on_procedure; dp->lcd_off_procedure = lcd_off_procedure; dp->custom_lcd_on = custom_lcdon; @@ -913,7 +895,7 @@ static void display_exit(void *data) return; } -static int display_start(enum device_flags flags) +static int display_start(enum deviced_event reason) { bool lcd_paneloff_mode = false; @@ -926,14 +908,14 @@ static int display_start(enum device_flags flags) } /* normal lcd on */ - display_panel_set_panel_state_by_on_state(flags); + display_panel_set_panel_state_by_on_state(reason); return 0; } -static int display_stop(enum device_flags flags) +static int display_stop(enum deviced_event reason) { - display_panel_set_panel_state_by_off_state(flags); + display_panel_set_panel_state_by_off_state(reason); return 0; } diff --git a/plugins/wearable/display/key-filter.c b/plugins/wearable/display/key-filter.c index b969e1c7..4d086143 100644 --- a/plugins/wearable/display/key-filter.c +++ b/plugins/wearable/display/key-filter.c @@ -191,7 +191,7 @@ static inline void broadcast_lcdoff_by_powerkey(void) NULL); } -static inline bool switch_on_lcd(enum device_flags flags) +static inline bool switch_on_lcd(enum deviced_event reason) { int ret; @@ -204,12 +204,12 @@ static inline bool switch_on_lcd(enum device_flags flags) if (current_state_in_on()) return false; - if (flags & LCD_ON_BY_POWER_KEY) + if (reason == DEVICED_EVENT_INPUT_POWERKEY) broadcast_lcdon_by_powerkey(); - else if (flags & LCD_ON_BY_TOUCH) + else if (reason == DEVICED_EVENT_TOUCHSCREEN) _I("Display on by Touch_wakeup event"); - display_panel_lcd_on_direct(flags); + display_panel_lcd_on_direct(reason); return true; } @@ -224,7 +224,7 @@ static inline void switch_off_lcd(void) broadcast_lcdoff_by_powerkey(); - display_panel_lcd_off_procedure(LCD_OFF_BY_POWER_KEY); + display_panel_lcd_off_procedure(DEVICED_EVENT_INPUT_POWERKEY); } static void check_key_combination(struct input_event *pinput) @@ -337,7 +337,7 @@ static int process_menu_key(struct input_event *pinput) _D("No lcd-on capability!"); return true; } else if (pinput->value == KEY_PRESSED) - switch_on_lcd(LCD_ON_BY_POWER_KEY); + switch_on_lcd(DEVICED_EVENT_INPUT_POWERKEY); return false; } @@ -401,7 +401,7 @@ static int process_back_key(struct input_event *pinput) int ignore = true; if (pinput->value == KEY_PRESSED) { - switch_on_lcd(LCD_ON_BY_BACK_KEY); + switch_on_lcd(DEVICED_EVENT_INPUT_BACKKEY); _I("back key pressed"); ignore = false; } @@ -450,7 +450,7 @@ static int process_power_key(struct input_event *pinput) break; case KEY_PRESSED: if (display_has_caps(caps, SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDON)) { - skip_lcd_off = switch_on_lcd(LCD_ON_BY_POWER_KEY); + skip_lcd_off = switch_on_lcd(DEVICED_EVENT_INPUT_POWERKEY); } else { _D("No lcdon capability!"); skip_lcd_off = false; @@ -624,7 +624,7 @@ static void check_key_filter(struct timeval time, unsigned short type, unsigned break; case EV_REL: if ((get_pm_cur_state() == SYSCOMMON_DEVICED_DISPLAY_STATE_OFF) && bezel_wakeup) { - switch_on_lcd(LCD_ON_BY_BEZEL); + switch_on_lcd(DEVICED_EVENT_INPUT_BEZEL); ignore = false; } else if (get_pm_cur_state() != SYSCOMMON_DEVICED_DISPLAY_STATE_OFF) ignore = false; @@ -637,7 +637,7 @@ static void check_key_filter(struct timeval time, unsigned short type, unsigned update_vital_state(pinput); if (pinput->value == KEY_PRESSED) { - switch_on_lcd(LCD_ON_BY_TOUCH); + switch_on_lcd(DEVICED_EVENT_TOUCHSCREEN); ignore = false; } diff --git a/src/display/core.h b/src/display/core.h index e29a1136..3b1e456f 100644 --- a/src/display/core.h +++ b/src/display/core.h @@ -24,6 +24,7 @@ #ifndef __POWER_MANAGER_H__ #define __POWER_MANAGER_H__ +#include #include #include "poll.h" @@ -76,7 +77,7 @@ void set_lock_screen_bg_state(bool state); /* core.c */ int delete_condition(enum syscommon_deviced_display_state state); -int custom_lcdoff(enum device_flags flag); +int custom_lcdoff(enum deviced_event reason); /* auto-brightness.c */ void set_brightness_changed_state(void); diff --git a/src/display/display-dbus.c b/src/display/display-dbus.c index 0ff03adb..1d54a5ca 100644 --- a/src/display/display-dbus.c +++ b/src/display/display-dbus.c @@ -700,7 +700,7 @@ static GVariant *dbus_setrefreshrate(GDBusConnection *conn, control = g_display_plugin.config->control_display; if (control) - display_panel_set_panel_state_by_off_state(NORMAL_MODE); + display_panel_set_panel_state_by_off_state(DEVICED_EVENT_MISC_DBUS); _D("app : %d, value : %d", app, val); ret = display_panel_set_frame_rate(val); @@ -708,7 +708,7 @@ static GVariant *dbus_setrefreshrate(GDBusConnection *conn, _E("Failed to set frame rate (%d)", ret); if (control) - display_panel_set_panel_state_by_on_state(NORMAL_MODE); + display_panel_set_panel_state_by_on_state(DEVICED_EVENT_MISC_DBUS); error: return g_variant_new("(i)", ret); @@ -967,7 +967,7 @@ static GVariant *dbus_customlcdoff(GDBusConnection *conn, GVariant *param, GDBusMethodInvocation *invocation, gpointer user_data) { int ret = 0; - enum device_flags flag; + enum deviced_event reason; char *reason_str = NULL; pid_t pid; @@ -977,16 +977,16 @@ static GVariant *dbus_customlcdoff(GDBusConnection *conn, g_variant_get(param, "(s)", &reason_str); if (!strcmp(reason_str, LCDOFF_PROXI_STR)) - flag = LCD_OFF_BY_PROXIMITY; + reason = DEVICED_EVENT_MISC_PROXIMITY; else if (!strcmp(reason_str, LCDOFF_GESTURE_STR)) - flag = LCD_OFF_BY_GESTURE; + reason = DEVICED_EVENT_MISC_GESTURE; else { _E("%s resean is invalid, dbus ignored!", reason_str); ret = -EINVAL; goto out; } - ret = display_panel_custom_lcd_off(flag); + ret = display_panel_custom_lcd_off(reason); out: g_free(reason_str); diff --git a/src/display/display-panel.c b/src/display/display-panel.c index 60e2401b..a4a8beac 100644 --- a/src/display/display-panel.c +++ b/src/display/display-panel.c @@ -53,7 +53,7 @@ static bool lcd_on_broadcasted = true; static struct timeval lcd_on_timeval; /* FIXME: This function is for temporary use, should be fixed after plugin refactoring */ -int display_panel_set_dpms_state(int dpms_on, enum device_flags flags) +static int display_panel_set_dpms_state(int dpms_on) { dpms_set_state(dpms_on); @@ -144,15 +144,16 @@ int display_panel_get_white_balance(enum hal_display_white_balance white_balance return ret; } -int display_panel_set_panel_state_by_on_state(enum device_flags flags) +int display_panel_set_panel_state_by_on_state(enum deviced_event reason) { int ret = -1; static int cnt; - _I("[DPMS XLIB Backlight] LCD on %#x cnt:%d", flags, cnt); + _I("[DPMS XLIB Backlight] LCD on reason: %s, cnt:%d", + syscommon_plugin_deviced_common_get_event_name(reason), cnt); cnt++; - ret = display_panel_set_dpms_state(SYSCOMMON_DEVICED_DPMS_ON, flags); + ret = display_panel_set_dpms_state(SYSCOMMON_DEVICED_DPMS_ON); #ifdef ENABLE_PM_LOG enum syscommon_deviced_display_state current; @@ -165,7 +166,7 @@ int display_panel_set_panel_state_by_on_state(enum device_flags flags) return ret; } -int display_panel_set_panel_state_by_off_state(enum device_flags flags) +int display_panel_set_panel_state_by_off_state(enum deviced_event reason) { int ret = -1; static int cnt; @@ -173,7 +174,8 @@ int display_panel_set_panel_state_by_off_state(enum device_flags flags) display_backlight_get_default_brightness(&default_brightness); - _I("[DPMS XLIB Backlight] LCD off %#x cnt:%d", flags, cnt); + _I("[DPMS XLIB Backlight] LCD off, reason: %s, cnt:%d", + syscommon_plugin_deviced_common_get_event_name(reason), cnt); cnt++; /** @@ -184,10 +186,10 @@ int display_panel_set_panel_state_by_off_state(enum device_flags flags) * it be helpful when recall how it was used. * * if (flags & FORCE_OFF_MODE) - * ret = display_panel_set_dpms_state(SYSCOMMON_DEVICED_DPMS_FORCE_OFF, flags); + * ret = display_panel_set_dpms_state(SYSCOMMON_DEVICED_DPMS_FORCE_OFF); * else */ - ret = display_panel_set_dpms_state(SYSCOMMON_DEVICED_DPMS_OFF, flags); + ret = display_panel_set_dpms_state(SYSCOMMON_DEVICED_DPMS_OFF); #ifdef ENABLE_PM_LOG enum syscommon_deviced_display_state current; @@ -206,7 +208,7 @@ int display_panel_set_panel_state_by_standby_state(bool standby_on) if ((dpms_get_cached_state() == SYSCOMMON_DEVICED_DPMS_ON) || standby_on) { _I("LCD standby"); - ret = display_panel_set_dpms_state(SYSCOMMON_DEVICED_DPMS_STANDBY, 0); + ret = display_panel_set_dpms_state(SYSCOMMON_DEVICED_DPMS_STANDBY); } return ret; @@ -232,13 +234,9 @@ void display_panel_get_lcd_paneloff_mode(bool *on) *on = lcd_paneloff_mode; } -void display_panel_lcd_on_procedure(int state, enum device_flags flag) +void display_panel_lcd_on_procedure(int state, enum deviced_event reason) { - unsigned long flags = NORMAL_MODE; - display_util_get_device_flags(&flags); - flags |= flag; - - if (display_plugin_lcd_on_procedure(state, flag) == 0) + if (display_plugin_lcd_on_procedure(state, reason) == 0) return; /* * Display on procedure @@ -254,11 +252,11 @@ void display_panel_lcd_on_procedure(int state, enum device_flags flag) */ leave_doze(); - _I("[lcdstep] 0x%lx", flags); + _I("[lcdstep] reason: %s", syscommon_plugin_deviced_common_get_event_name(reason)); /* send LCDOn dbus signal */ if (!lcd_on_broadcasted) - broadcast_lcd_on(SIGNAL_PRE, flags); + broadcast_lcd_on(SIGNAL_PRE, reason); /* Update brightness level */ if (state == LCD_DIM) @@ -271,10 +269,10 @@ void display_panel_lcd_on_procedure(int state, enum device_flags flag) else if (state == LCD_DIM) set_setting_pmstate(SYSCOMMON_DEVICED_DISPLAY_STATE_DIM); - display_start_dependent_device(flags); + display_start_dependent_device(reason); if (!lcd_on_broadcasted) { - broadcast_lcd_on(SIGNAL_POST, flags); + broadcast_lcd_on(SIGNAL_POST, reason); lcd_on_broadcasted = true; } @@ -283,13 +281,9 @@ void display_panel_lcd_on_procedure(int state, enum device_flags flag) display_misc_set_touch_event_blocked(false); } -void display_panel_lcd_off_procedure(enum device_flags flag) +void display_panel_lcd_off_procedure(enum deviced_event reason) { - unsigned long flags = NORMAL_MODE; - display_util_get_device_flags(&flags); - flags |= flag; - - if (display_plugin_lcd_off_procedure(flag) == 0) + if (display_plugin_lcd_off_procedure(reason) == 0) return; /* * Display off procedure @@ -302,14 +296,14 @@ void display_panel_lcd_off_procedure(enum device_flags flag) * step 4. broadcast lcd off complete siganl * step 5. enter doze mode if it is enabled */ - _I("[lcdstep] 0x%lx", flags); + _I("[lcdstep] reason: %s", syscommon_plugin_deviced_common_get_event_name(reason)); /* notification */ syscommon_notifier_emit_notify(DEVICED_NOTIFIER_LCD_OFF, NULL); if (lcd_on_broadcasted) { - broadcast_lcd_off(SIGNAL_PRE, flags); + broadcast_lcd_off(SIGNAL_PRE, reason); lcd_on_broadcasted = false; } @@ -321,34 +315,38 @@ void display_panel_lcd_off_procedure(enum device_flags flag) touchled_control_backlight(TOUCHLED_DIRECT_OFF); - display_stop_dependent_device(flags); + display_stop_dependent_device(reason); - broadcast_lcd_off(SIGNAL_POST, flags); + broadcast_lcd_off(SIGNAL_POST, reason); syscommon_notifier_emit_notify(DEVICED_NOTIFIER_LCD_OFF_COMPLETE, NULL); enter_doze(); } -void display_panel_lcd_on_direct(enum device_flags flags) +void display_panel_lcd_on_direct(enum deviced_event reason) { - enum hal_device_power_transition_reason reason; + /** + * FIXME: Those hal_device_power_transition_reason could be + * integrated into deviced common enum, deviced_event + */ + enum hal_device_power_transition_reason power_reason; - if (flags & LCD_ON_BY_POWER_KEY) - reason = HAL_DEVICE_POWER_TRANSITION_REASON_POWER_KEY; - else if (flags & LCD_ON_BY_TOUCH) - reason = HAL_DEVICE_POWER_TRANSITION_REASON_TOUCH_SCREEN; + if (reason == DEVICED_EVENT_INPUT_POWERKEY) + power_reason = HAL_DEVICE_POWER_TRANSITION_REASON_POWER_KEY; + else if (reason == DEVICED_EVENT_TOUCHSCREEN) + power_reason = HAL_DEVICE_POWER_TRANSITION_REASON_TOUCH_SCREEN; else - reason = HAL_DEVICE_POWER_TRANSITION_REASON_UNKNOWN; + power_reason = HAL_DEVICE_POWER_TRANSITION_REASON_UNKNOWN; syscommon_resman_set_resource_attr_uint64_4(SYSCOMMON_RESOURCE_ID(DEVICED_RESOURCE_TYPE_POWER), DEVICED_POWER_ATTR_UINT64_4_CURRENT_STATE, - DEVICED_POWER_STATE_SLEEP, DEVICED_POWER_STATE_NORMAL, reason, 0); + DEVICED_POWER_STATE_SLEEP, DEVICED_POWER_STATE_NORMAL, power_reason, 0); set_pm_cur_state(SYSCOMMON_DEVICED_DISPLAY_STATE_ON); _D("lcd is on directly"); display_panel_update_lcd_on_timeval(); - display_panel_lcd_on_procedure(LCD_NORMAL, flags); + display_panel_lcd_on_procedure(LCD_NORMAL, reason); display_state_transition_update_lock_screen_timeout(LOCK_SCREEN_INPUT_TIMEOUT); } @@ -369,7 +367,7 @@ int display_panel_custom_lcd_on(int timeout) return -EINVAL; if (display_panel_get_dpms_cached_state() != SYSCOMMON_DEVICED_DPMS_ON) - display_panel_lcd_on_direct(LCD_ON_BY_GESTURE); + display_panel_lcd_on_direct(DEVICED_EVENT_MISC_GESTURE); _I("Custom lcd on timeout(%d ms).", timeout); if (set_custom_lcdon_timeout(timeout)) @@ -382,9 +380,9 @@ int display_panel_custom_lcd_on(int timeout) return 0; } -int display_panel_custom_lcd_off(enum device_flags flag) +int display_panel_custom_lcd_off(enum deviced_event reason) { - if (display_plugin_custom_lcd_off(flag) == 0) + if (display_plugin_custom_lcd_off(reason) == 0) return 0; /* check holdkey block flag in lock node */ @@ -394,7 +392,7 @@ int display_panel_custom_lcd_off(enum device_flags flag) * call app can be changed to lcd state by proximity. * If proximity is near then normal lock will be unlocked. */ - if (flag & LCD_OFF_BY_PROXIMITY) { + if (reason == DEVICED_EVENT_MISC_PROXIMITY) { _I("custom lcd off by proximity, delete normal lock"); display_lock_release_lock_all(SYSCOMMON_DEVICED_DISPLAY_STATE_ON); } else { @@ -403,14 +401,14 @@ int display_panel_custom_lcd_off(enum device_flags flag) } } - _I("custom lcd off by flag(%d)", flag); + _I("custom lcd off by reason(%d)", reason); if (display_panel_get_dpms_cached_state() == SYSCOMMON_DEVICED_DPMS_ON) - display_panel_lcd_off_procedure(flag); + display_panel_lcd_off_procedure(reason); if (set_custom_lcdon_timeout(0) == true) display_state_transition_update_display_state_timeout_by_priority(); - display_state_set_current(SYSCOMMON_DEVICED_DISPLAY_STATE_OFF, DEVICED_EVENT_INPUT); + display_state_set_current(SYSCOMMON_DEVICED_DISPLAY_STATE_OFF, reason); return 0; } @@ -420,7 +418,7 @@ int display_panel_custom_lcd_off(enum device_flags flag) */ int display_panel_display_turn_on_by_reason(const char *reason, int timeout) { - int flag; + int _reason; int str_len; if (display_plugin_display_on_by_reason(reason, timeout) == 0) @@ -432,9 +430,9 @@ int display_panel_display_turn_on_by_reason(const char *reason, int timeout) str_len = strlen(reason); if (!strncmp(reason, GESTURE_STR, str_len)) { - flag = LCD_ON_BY_GESTURE; + _reason = DEVICED_EVENT_MISC_GESTURE; } else if (!strncmp(reason, EVENT_STR, str_len)) { - flag = LCD_ON_BY_EVENT; + _reason = DEVICED_EVENT_UNKNOWN; } else { _E("Reason is unknown(%s)", reason); return -EINVAL; @@ -446,7 +444,7 @@ int display_panel_display_turn_on_by_reason(const char *reason, int timeout) } if (display_panel_get_dpms_cached_state() != SYSCOMMON_DEVICED_DPMS_ON) - display_panel_lcd_on_direct(flag); + display_panel_lcd_on_direct(_reason); _I("platform lcd on by %s (%d ms)", reason, timeout); if (set_custom_lcdon_timeout(timeout) == true) @@ -459,7 +457,7 @@ int display_panel_display_turn_on_by_reason(const char *reason, int timeout) int display_panel_display_turn_off_by_reason(const char *reason) { - int flag; + enum deviced_event _reason; int str_len; if (display_plugin_display_off_by_reason(reason) == 0) @@ -475,12 +473,12 @@ int display_panel_display_turn_off_by_reason(const char *reason) _I("skip platform lcd off by gesture"); return -ECANCELED; } - flag = LCD_OFF_BY_GESTURE; + _reason = DEVICED_EVENT_MISC_GESTURE; } else if (!strncmp(reason, PALM_STR, str_len)) { display_lock_release_lock_all(SYSCOMMON_DEVICED_DISPLAY_STATE_ON); display_lock_release_lock_all(SYSCOMMON_DEVICED_DISPLAY_STATE_DIM); - flag = LCD_OFF_BY_PALM; + _reason = DEVICED_EVENT_MISC_PALM; } else { _E("Reason is unknown(%s)", reason); return -EINVAL; @@ -488,9 +486,9 @@ int display_panel_display_turn_off_by_reason(const char *reason) _I("platform lcd off by %s", reason); if (display_panel_get_dpms_cached_state() == SYSCOMMON_DEVICED_DPMS_ON) - display_panel_lcd_off_procedure(flag); + display_panel_lcd_off_procedure(_reason); - display_state_set_current(SYSCOMMON_DEVICED_DISPLAY_STATE_OFF, DEVICED_EVENT_INPUT); + display_state_set_current(SYSCOMMON_DEVICED_DISPLAY_STATE_OFF, _reason); return 0; } diff --git a/src/display/display-panel.h b/src/display/display-panel.h index 0e879884..a42644df 100644 --- a/src/display/display-panel.h +++ b/src/display/display-panel.h @@ -20,23 +20,23 @@ #define __DISPLAY_PANEL_H__ #include +#include #include "display-dpms.h" #include "shared/devices.h" -int display_panel_set_dpms_state(int dpms_on, enum device_flags flags); int display_panel_set_white_balance(enum hal_display_white_balance white_balance_type, int value); int display_panel_get_white_balance(enum hal_display_white_balance white_balance_type, int* out_val); -int display_panel_set_panel_state_by_on_state(enum device_flags flags); -int display_panel_set_panel_state_by_off_state(enum device_flags flags); +int display_panel_set_panel_state_by_on_state(enum deviced_event reason); +int display_panel_set_panel_state_by_off_state(enum deviced_event reason); int display_panel_set_panel_state_by_standby_state(bool standby_on); void display_panel_set_lcd_paneloff_mode(bool on); void display_panel_get_lcd_paneloff_mode(bool *on); -void display_panel_lcd_on_procedure(int state, enum device_flags flag); -void display_panel_lcd_off_procedure(enum device_flags flag); -void display_panel_lcd_on_direct(enum device_flags flags); +void display_panel_lcd_on_procedure(int state, enum deviced_event reason); +void display_panel_lcd_off_procedure(enum deviced_event reason); +void display_panel_lcd_on_direct(enum deviced_event reason); int display_panel_custom_lcd_on(int timeout); -int display_panel_custom_lcd_off(enum device_flags flag); +int display_panel_custom_lcd_off(enum deviced_event reason); int display_panel_display_turn_on_by_reason(const char *reason, int timeout); int display_panel_display_turn_off_by_reason(const char *reason); bool display_panel_is_lcd_on_state_broadcasted(void); diff --git a/src/display/display-plugin.c b/src/display/display-plugin.c index a9e558ef..1490210d 100644 --- a/src/display/display-plugin.c +++ b/src/display/display-plugin.c @@ -45,20 +45,20 @@ int display_plugin_auto_brightness_control(enum brightness_request_e request, in return 0; } -int display_plugin_lcd_on_procedure(int state, enum device_flags flag) +int display_plugin_lcd_on_procedure(int state, enum deviced_event reason) { if (g_display_plugin.lcd_on_procedure) { - g_display_plugin.lcd_on_procedure(state, flag); + g_display_plugin.lcd_on_procedure(state, reason); return 0; } return -EOPNOTSUPP; } -int display_plugin_lcd_off_procedure(enum device_flags flag) +int display_plugin_lcd_off_procedure(enum deviced_event reason) { if (g_display_plugin.lcd_off_procedure) { - g_display_plugin.lcd_off_procedure(flag); + g_display_plugin.lcd_off_procedure(reason); return 0; } @@ -75,10 +75,10 @@ int display_plugin_custom_lcd_on(int timeout) return -EOPNOTSUPP; } -int display_plugin_custom_lcd_off(enum device_flags flag) +int display_plugin_custom_lcd_off(enum deviced_event reason) { if (g_display_plugin.custom_lcd_off) { - g_display_plugin.custom_lcd_off(flag); + g_display_plugin.custom_lcd_off(reason); return 0; } @@ -298,15 +298,4 @@ int display_plugin_config_get_pm_default_brightness(int *pm_default_brightness) *pm_default_brightness = g_display_plugin.config->pm_default_brightness; return 0; -} - -int display_plugin_get_device_flags(unsigned long *device_flags) -{ - if (!device_flags) - return -EINVAL; - - if (!g_display_plugin.get_device_flags) - return -EOPNOTSUPP; - - return g_display_plugin.get_device_flags(device_flags); } \ No newline at end of file diff --git a/src/display/display-plugin.h b/src/display/display-plugin.h index 2456c97d..2f3ad9d0 100644 --- a/src/display/display-plugin.h +++ b/src/display/display-plugin.h @@ -21,6 +21,7 @@ #include #include +#include #include "core.h" #include "display-config.h" @@ -58,11 +59,10 @@ struct display_plugin { bool system_wakeup_flag; int (*auto_brightness_control) (enum brightness_request_e request, int set_brightness); /* FIXME: function names will be redefined */ - int (*get_device_flags) (unsigned long *device_flags); - void (*lcd_on_procedure) (int state, enum device_flags flag); - void (*lcd_off_procedure) (enum device_flags flag); + void (*lcd_on_procedure) (int state, enum deviced_event reason); + void (*lcd_off_procedure) (enum deviced_event reason); int (*custom_lcd_on) (int timeout); - int (*custom_lcd_off) (enum device_flags flag); + int (*custom_lcd_off) (enum deviced_event reason); int (*display_on_by_reason) (const char *reason, int timeout); int (*display_off_by_reason) (const char *reason); void (*default_saving_mode) (int onoff); @@ -80,11 +80,10 @@ extern struct display_plugin g_display_plugin; int display_plugin_get_system_wakeup_flag(bool *flag); int display_plugin_set_system_wakeup_flag(bool flag); int display_plugin_auto_brightness_control(enum brightness_request_e request, int set_brightness); -int display_plugin_get_device_flags(unsigned long *device_flags); -int display_plugin_lcd_on_procedure(int state, enum device_flags flag); -int display_plugin_lcd_off_procedure(enum device_flags flag); +int display_plugin_lcd_on_procedure(int state, enum deviced_event reason); +int display_plugin_lcd_off_procedure(enum deviced_event reason); int display_plugin_custom_lcd_on(int timeout); -int display_plugin_custom_lcd_off(enum device_flags flag); +int display_plugin_custom_lcd_off(enum deviced_event reason); int display_plugin_display_on_by_reason(const char *reason, int timeout); int display_plugin_display_off_by_reason(const char *reason); int display_plugin_set_power_save_mode_flag(int onoff); diff --git a/src/display/display-signal.c b/src/display/display-signal.c index 7f251ac4..7f7d2976 100644 --- a/src/display/display-signal.c +++ b/src/display/display-signal.c @@ -40,7 +40,7 @@ static const char *lcdoff_sig_lookup[SIGNAL_MAX] = { static struct display_plugin *disp_plgn; static long displayoff_time; -void broadcast_lcd_on(enum signal_type type, enum device_flags flags) +void broadcast_lcd_on(enum signal_type type, enum deviced_event reason) { const char *str; const char *signal; @@ -55,7 +55,7 @@ void broadcast_lcd_on(enum signal_type type, enum device_flags flags) if (type == SIGNAL_PRE && displayoff_time != 0) diff = clock_gettime_to_long() - displayoff_time; - display_util_get_device_flags_name(flags, &str); + str = syscommon_plugin_deviced_common_get_event_name(reason); signal = lcdon_sig_lookup[type]; _I("lcdstep : Broadcast signal(%s:%s).", signal, str); @@ -68,7 +68,7 @@ void broadcast_lcd_on(enum signal_type type, enum device_flags flags) _E("Failed to send dbus signal(%s)", signal); } -void broadcast_lcd_off(enum signal_type type, enum device_flags flags) +void broadcast_lcd_off(enum signal_type type, enum deviced_event reason) { const char *str; const char *signal; @@ -84,7 +84,7 @@ void broadcast_lcd_off(enum signal_type type, enum device_flags flags) signal = lcdoff_sig_lookup[type]; - display_util_get_device_flags_name(flags, &str); + str = syscommon_plugin_deviced_common_get_event_name(reason); _I("lcdstep : Broadcast signal(%s).", signal); ret = gdbus_signal_emit_sync(NULL, diff --git a/src/display/display-signal.h b/src/display/display-signal.h index 47cd1f22..22fbaf51 100644 --- a/src/display/display-signal.h +++ b/src/display/display-signal.h @@ -19,6 +19,7 @@ #ifndef __DISPLAY_SIGNAL_H__ #define __DISPLAY_SIGNAL_H__ +#include #include #include "shared/devices.h" @@ -31,8 +32,8 @@ enum signal_type { SIGNAL_MAX, }; -void broadcast_lcd_on(enum signal_type type, enum device_flags flags); -void broadcast_lcd_off(enum signal_type type, enum device_flags flags); +void broadcast_lcd_on(enum signal_type type, enum deviced_event reason); +void broadcast_lcd_off(enum signal_type type, enum deviced_event reason); void set_process_active(bool flag, pid_t pid); void display_signal_register_display_brightness_notifier(void); diff --git a/src/display/display-state-transition.c b/src/display/display-state-transition.c index 0d9401d9..620a9625 100644 --- a/src/display/display-state-transition.c +++ b/src/display/display-state-transition.c @@ -748,7 +748,8 @@ static int display_state_transition_do_state_action(int timeout) display_backlight_update_by_default_brightness(); if (display_panel_get_dpms_cached_state() != SYSCOMMON_DEVICED_DPMS_ON) - display_panel_lcd_on_procedure(LCD_NORMAL, NORMAL_MODE); + /* FIXME: need to get reason */ + display_panel_lcd_on_procedure(LCD_NORMAL, DEVICED_EVENT_UNKNOWN); break; case SYSCOMMON_DEVICED_DISPLAY_STATE_DIM: @@ -761,25 +762,26 @@ static int display_state_transition_do_state_action(int timeout) display_backlight_set_brightness_by_dim_brightness(); if ((previous == SYSCOMMON_DEVICED_DISPLAY_STATE_OFF) || (previous == SYSCOMMON_DEVICED_DISPLAY_STATE_SLEEP)) - display_panel_lcd_on_procedure(LCD_DIM, NORMAL_MODE); + /* FIXME: need to get reason */ + display_panel_lcd_on_procedure(LCD_DIM, DEVICED_EVENT_UNKNOWN); break; case SYSCOMMON_DEVICED_DISPLAY_STATE_OFF: if ((previous != SYSCOMMON_DEVICED_DISPLAY_STATE_SLEEP) && (previous != SYSCOMMON_DEVICED_DISPLAY_STATE_OFF)) { /* lcd off state : turn off the backlight */ if (display_panel_get_dpms_cached_state() == SYSCOMMON_DEVICED_DPMS_ON) - display_panel_lcd_off_procedure(LCD_OFF_BY_TIMEOUT); + display_panel_lcd_off_procedure(DEVICED_EVENT_DISPLAY_SCREEN_TIMEOUT); } display_panel_get_lcd_paneloff_mode(&lcd_paneloff_mode); if (display_panel_get_dpms_cached_state() == SYSCOMMON_DEVICED_DPMS_ON || lcd_paneloff_mode) - display_panel_lcd_off_procedure(LCD_OFF_BY_TIMEOUT); + display_panel_lcd_off_procedure(DEVICED_EVENT_DISPLAY_SCREEN_TIMEOUT); break; case SYSCOMMON_DEVICED_DISPLAY_STATE_SLEEP: if (display_panel_get_dpms_cached_state() == SYSCOMMON_DEVICED_DPMS_ON) - display_panel_lcd_off_procedure(LCD_OFF_BY_TIMEOUT); + display_panel_lcd_off_procedure(DEVICED_EVENT_DISPLAY_SCREEN_TIMEOUT); if (!pm_get_power_lock_support()) { /* sleep state : set system mode to SUSPEND */ @@ -836,7 +838,6 @@ void display_state_transition_do_proc_change_state_action(enum syscommon_deviced display_state_transition_do_state_action(state_timeout); else display_state_transition_do_state_action(timeout); - } @@ -846,6 +847,13 @@ void display_state_transition_do_proc_change_state_action(enum syscommon_deviced */ int display_state_transition_do_proc_change_state(unsigned int cond, pid_t pid) { + /** + * FIXME: This function is not receiving "reason" for transition. + * The actual reason could be incorrect, for example, lcdoff triggered by + * dbus_changestate() will goes the below SYSCOMMON_DEVICED_DISPLAY_STATE_OFF case, + * calling display_panel_off_procedure() with reason SCREEN_TIMEOUT, but it is + * actually not. + */ enum syscommon_deviced_display_state next; const char *state_name = NULL; @@ -859,7 +867,7 @@ int display_state_transition_do_proc_change_state(unsigned int cond, pid_t pid) switch (next) { case SYSCOMMON_DEVICED_DISPLAY_STATE_ON: if (display_panel_get_dpms_cached_state() != SYSCOMMON_DEVICED_DPMS_ON) - display_panel_lcd_on_direct(LCD_ON_BY_EVENT); + display_panel_lcd_on_direct(DEVICED_EVENT_UNKNOWN); display_state_transition_update_lock_screen_timeout(LOCK_SCREEN_CONTROL_TIMEOUT); display_state_transition_do_proc_change_state_action(next, TIMEOUT_NONE); break; @@ -868,7 +876,7 @@ int display_state_transition_do_proc_change_state(unsigned int cond, pid_t pid) break; case SYSCOMMON_DEVICED_DISPLAY_STATE_OFF: if (display_panel_get_dpms_cached_state() == SYSCOMMON_DEVICED_DPMS_ON) - display_panel_lcd_off_procedure(LCD_OFF_BY_EVENT); + display_panel_lcd_off_procedure(DEVICED_EVENT_DISPLAY_SCREEN_TIMEOUT); if (set_custom_lcdon_timeout(0)) display_state_transition_update_display_state_timeout_by_priority(); display_state_transition_do_proc_change_state_action(next, TIMEOUT_NONE); diff --git a/src/display/display-util.c b/src/display/display-util.c index ec996748..6670ed47 100644 --- a/src/display/display-util.c +++ b/src/display/display-util.c @@ -15,55 +15,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #include "display-misc.h" #include "display-plugin.h" #include "display-util.h" -int display_util_get_device_flags_name(enum device_flags flags, const char **flag_name) -{ - if (!flag_name) - return -EINVAL; - - if (flags & (LCD_ON_BY_GESTURE | LCD_OFF_BY_GESTURE)) - *flag_name = GESTURE_STR; - else if (flags & (LCD_ON_BY_POWER_KEY | LCD_OFF_BY_POWER_KEY)) - *flag_name = POWER_KEY_STR; - else if (flags & (LCD_ON_BY_EVENT | LCD_OFF_BY_EVENT)) - *flag_name = EVENT_STR; - else if (flags & LCD_ON_BY_BACK_KEY) - *flag_name = BACK_KEY_STR; - else if (flags & LCD_ON_BY_TOUCH) - *flag_name = TOUCH_STR; - else if (flags & LCD_ON_BY_BEZEL) - *flag_name = BEZEL_STR; - else if (flags & LCD_OFF_BY_TIMEOUT) - *flag_name = TIMEOUT_STR; - else if (flags & LCD_OFF_BY_PROXIMITY) - *flag_name = PROXI_STR; - else if (flags & LCD_OFF_BY_PALM) - *flag_name = PALM_STR; - else if (flags & LCD_OFF_BY_DISPLAY_DETACH) - *flag_name = DISPLAY_DETACH_STR; - else - *flag_name = UNKNOWN_STR; - - return 0; -} - -int display_util_get_device_flags(unsigned long *device_flags) -{ - - if (!device_flags) - return -EINVAL; - - if (g_display_plugin.get_device_flags) - return display_plugin_get_device_flags(device_flags); - - *device_flags = NORMAL_MODE; - - return 0; -} - int display_util_get_display_state(int s_bits) { switch (s_bits) { diff --git a/src/display/display-util.h b/src/display/display-util.h index 9be17f10..829630d6 100644 --- a/src/display/display-util.h +++ b/src/display/display-util.h @@ -25,8 +25,6 @@ #define USEC_TO_SEC(x) ((x)/1000000.0) #define NSEC_TO_SEC(x) ((x)/1000000000.0) -int display_util_get_device_flags_name(enum device_flags flags, const char **flag_name); -int display_util_get_device_flags(unsigned long *device_flags); int display_util_get_display_state(int s_bits); #endif /* __DISPLAY_UTIL_H__ */ \ No newline at end of file diff --git a/src/display/display.c b/src/display/display.c index 42bb7f57..9336ee0d 100644 --- a/src/display/display.c +++ b/src/display/display.c @@ -85,7 +85,7 @@ inline void set_display_init_direction(enum syscommon_deviced_display_orientatio g_display_init_direction = display_init_direction; } -void lcd_direct_control(enum syscommon_deviced_dpms_state dpms_state, int flags) +static void lcd_direct_control(enum syscommon_deviced_dpms_state dpms_state, enum deviced_event reason) { const struct device_ops *ops = NULL; GList *l = NULL; @@ -93,11 +93,11 @@ void lcd_direct_control(enum syscommon_deviced_dpms_state dpms_state, int flags) switch (dpms_state) { case SYSCOMMON_DEVICED_DPMS_ON: SYS_G_LIST_FOREACH(display_dependent_device_ops, l, ops) - ops->start(flags); + ops->start(reason); break; case SYSCOMMON_DEVICED_DPMS_OFF: SYS_G_LIST_FOREACH(display_dependent_device_ops, l, ops) - ops->stop(flags); + ops->stop(reason); break; default: _E("state is wrong value %d", dpms_state); @@ -289,7 +289,7 @@ static gboolean delayed_dpms_init_done(gpointer data) switch (current) { case SYSCOMMON_DEVICED_DISPLAY_STATE_ON: case SYSCOMMON_DEVICED_DISPLAY_STATE_DIM: - display_panel_lcd_on_procedure(LCD_NORMAL, LCD_ON_BY_EVENT); + display_panel_lcd_on_procedure(LCD_NORMAL, DEVICED_EVENT_DEVICE_READY); display_plugin_config_get_timeout_enable(&timeout_enable); if (timeout_enable) { display_plugin_state_get_timeout(SYSCOMMON_DEVICED_DISPLAY_STATE_ON, &timeout); @@ -300,7 +300,7 @@ static gboolean delayed_dpms_init_done(gpointer data) } break; case SYSCOMMON_DEVICED_DISPLAY_STATE_OFF: - display_panel_lcd_off_procedure(LCD_OFF_BY_EVENT); + display_panel_lcd_off_procedure(DEVICED_EVENT_DISPLAY_SCREEN_TIMEOUT); display_plugin_config_get_lcdoff_timeout(&lcdoff_timeout); display_state_transition_reset_state_transition_timeout(lcdoff_timeout); break; @@ -391,11 +391,11 @@ static void esd_action(void) touchscreen_ops = find_device("touchscreen"); if (!check_default(touchscreen_ops)) - touchscreen_ops->stop(NORMAL_MODE); - display_panel_set_panel_state_by_off_state(NORMAL_MODE); - display_panel_set_panel_state_by_on_state(NORMAL_MODE); + touchscreen_ops->stop(DEVICED_EVENT_MISC_ESD); + display_panel_set_panel_state_by_off_state(DEVICED_EVENT_MISC_ESD); + display_panel_set_panel_state_by_on_state(DEVICED_EVENT_MISC_ESD); if (!check_default(touchscreen_ops)) - touchscreen_ops->start(NORMAL_MODE); + touchscreen_ops->start(DEVICED_EVENT_MISC_ESD); } static void lcd_uevent_changed(struct udev_device *dev) @@ -607,7 +607,7 @@ static void display_init(void *data) /* In smd test, TSP should be turned off if display panel is not existed. */ if (display_panel_get_dpms_cached_state() == -ENOENT) { _I("Display panel is not existed."); - lcd_direct_control(SYSCOMMON_DEVICED_DPMS_OFF, NORMAL_MODE); + lcd_direct_control(SYSCOMMON_DEVICED_DPMS_OFF, DEVICED_EVENT_DEVICE_DETACH); display_unregister_dependent_device(); } @@ -617,9 +617,9 @@ static void display_init(void *data) // wm_ready = check_wm_ready(); if (display_panel_init_dpms()) { if (display_is_lcdon_blocked() != LCDON_BLOCK_NONE) { - display_panel_lcd_off_procedure(LCD_OFF_BY_EVENT); + display_panel_lcd_off_procedure(DEVICED_EVENT_DISPLAY_SCREEN_TIMEOUT); } else { - display_panel_lcd_on_procedure(LCD_NORMAL, LCD_ON_BY_EVENT); + display_panel_lcd_on_procedure(LCD_NORMAL, DEVICED_EVENT_DEVICE_READY); } } else { display_add_timer_for_waiting_dpms_init(); @@ -701,11 +701,11 @@ static void display_exit(void *data) ops = find_device("touchscreen"); if (!check_default(ops)) - ops->start(NORMAL_MODE); + ops->start(DEVICED_EVENT_DISPLAY); ops = find_device("touchkey"); if (!check_default(ops)) - ops->start(NORMAL_MODE); + ops->start(DEVICED_EVENT_DISPLAY); syscommon_notifier_unsubscribe_notify(DEVICED_NOTIFIER_DELAYED_INIT, delayed_init_done); syscommon_notifier_unsubscribe_notify(DEVICED_NOTIFIER_APPLICATION_BACKGROUND, display_app_background); @@ -722,7 +722,7 @@ static void display_exit(void *data) unload_display_hal_backend(); } -static int display_start(enum device_flags flags) +static int display_start(enum deviced_event reason) { bool lcd_paneloff_mode = false; @@ -735,14 +735,14 @@ static int display_start(enum device_flags flags) } /* normal lcd on */ - display_panel_set_panel_state_by_on_state(flags); + display_panel_set_panel_state_by_on_state(reason); return 0; } -static int display_stop(enum device_flags flags) +static int display_stop(enum deviced_event reason) { - display_panel_set_panel_state_by_off_state(flags); + display_panel_set_panel_state_by_off_state(reason); return 0; } diff --git a/src/display/display.h b/src/display/display.h index 1483ed53..01b1d8af 100644 --- a/src/display/display.h +++ b/src/display/display.h @@ -35,7 +35,6 @@ #define BATTERY_FLAG 0x00020000 #define COOLDOWN_FLAG 0x00040000 -void lcd_direct_control(enum syscommon_deviced_dpms_state dpms_state, int flags); int get_pm_cur_state(void); int get_pm_old_state(void); void set_pm_cur_state(int cur_state); diff --git a/src/display/resource-display.c b/src/display/resource-display.c index 0fd3e7c5..99575109 100644 --- a/src/display/resource-display.c +++ b/src/display/resource-display.c @@ -112,12 +112,12 @@ static int set_tuple2_display_attr_data(int resource_id, case DEVICED_DISPLAY_ATTR_TUPLE2_CURRENT_STATE: { enum syscommon_deviced_display_state state = *(enum syscommon_deviced_display_state *) data1; - enum deviced_event event = *(enum deviced_event *) data2; + enum deviced_event reason = *(enum deviced_event *) data2; /** * FIXME: Need to change it to display_state_set_current() */ - if (event == DEVICED_EVENT_DISPLAY_SCREEN_TIMEOUT) + if (reason == DEVICED_EVENT_DISPLAY_SCREEN_TIMEOUT) return display_state_transition_do_state_transition(state, EVENT_TIMEOUT); else return display_state_transition_do_state_transition(state, EVENT_INPUT); @@ -126,24 +126,11 @@ static int set_tuple2_display_attr_data(int resource_id, { enum syscommon_deviced_dpms_state state = *(enum syscommon_deviced_dpms_state *) data1; enum deviced_event reason = *(enum deviced_event *) data2; - int flag; - - switch (reason) { - case DEVICED_EVENT_INPUT_POWERKEY: - flag = LCD_ON_BY_POWER_KEY; - break; - case DEVICED_EVENT_TOUCHSCREEN: - flag = LCD_ON_BY_TOUCH; - break; - default: - flag = 0; - break; - } if (state == SYSCOMMON_DEVICED_DPMS_OFF) - display_panel_lcd_off_procedure(flag); + display_panel_lcd_off_procedure(reason); else if (state == SYSCOMMON_DEVICED_DPMS_ON) - display_panel_lcd_on_direct(flag); + display_panel_lcd_on_direct(reason); return 0; } case DEVICED_DISPLAY_ATTR_TUPLE2_CURRENT_STATE_WITH_OPTION: diff --git a/src/display/setting.c b/src/display/setting.c index 0a106a17..4269d105 100644 --- a/src/display/setting.c +++ b/src/display/setting.c @@ -362,7 +362,8 @@ int display_setting_update_pm_setting(int key_idx, int val) val == VCONFKEY_IDLE_LOCK && display_panel_get_dpms_cached_state() != SYSCOMMON_DEVICED_DPMS_ON && display_is_lcdon_blocked() == LCDON_BLOCK_NONE) - display_panel_lcd_on_procedure(LCD_NORMAL, LCD_ON_BY_EVENT); + /* FIXME: what is appropriate reason for this? */ + display_panel_lcd_on_procedure(LCD_NORMAL, DEVICED_EVENT_MISC); display_state_transition_update_display_state_timeout_by_priority(); if (current == SYSCOMMON_DEVICED_DISPLAY_STATE_ON) display_state_transition_do_state_transition(current, EVENT_INPUT); diff --git a/src/power/power-off.c b/src/power/power-off.c index 17bb60f4..ad6bb777 100644 --- a/src/power/power-off.c +++ b/src/power/power-off.c @@ -86,12 +86,21 @@ static void poweroff_notify_resourced(void) POWEROFF_WAIT_RESOURCED); } -static void disable_display(void) +static void disable_display(int state) { const struct device_ops *display_device_ops = NULL; + enum deviced_event reason = DEVICED_EVENT_POWER; + + if (state == DEVICED_POWER_STATE_POWEROFF) + reason = DEVICED_EVENT_POWER_OFF; + else if (state == DEVICED_POWER_STATE_REBOOT) + reason = DEVICED_EVENT_POWER_REBOOT; + else if (state == DEVICED_POWER_STATE_EXIT) + reason = DEVICED_EVENT_POWER_EXIT; + FIND_DEVICE_VOID(display_device_ops, "display"); if (display_device_ops->stop) - display_device_ops->stop(NORMAL_MODE); + display_device_ops->stop(reason); } static int disable_systemd_journald(void) @@ -251,7 +260,7 @@ static gboolean __poweroff_main(gpointer data) disable_systemd_journald(); disable_coredump_handler(); poweroff_delay_for_seconds(); - disable_display(); + disable_display(state); /* Below functions follow after notifying DEVICED_NOTIFIER_POWEROFF 1. pmlock diff --git a/src/shared/devices.h b/src/shared/devices.h index e585275f..d51a42f3 100644 --- a/src/shared/devices.h +++ b/src/shared/devices.h @@ -22,6 +22,7 @@ #include #include +#include #include "shared/common.h" @@ -40,23 +41,6 @@ #define DISPLAY_DETACH_STR "display_detach" #define UNKNOWN_STR "unknown" -enum device_flags { - NORMAL_MODE = 0x00000001, - LCD_ON_BY_GESTURE = 0x00010000, - LCD_ON_BY_POWER_KEY = 0x00020000, - LCD_ON_BY_BACK_KEY = 0x00040000, - LCD_ON_BY_EVENT = 0x00080000, - LCD_ON_BY_TOUCH = 0x00100000, - LCD_ON_BY_BEZEL = 0x00200000, - LCD_OFF_BY_DISPLAY_DETACH = 0x01000000, - LCD_OFF_BY_POWER_KEY = 0x02000000, - LCD_OFF_BY_TIMEOUT = 0x04000000, - LCD_OFF_BY_EVENT = 0x08000000, - LCD_OFF_BY_PROXIMITY = 0x20000000, - LCD_OFF_BY_GESTURE = 0x40000000, - LCD_OFF_BY_PALM = 0x80000000, -}; - struct device_ops { int priority; /* high number will be initialized first */ bool disable_auto_init; /* default: false */ @@ -65,8 +49,8 @@ struct device_ops { int (*probe) (void *data); void (*init) (void *data); void (*exit) (void *data); - int (*start) (enum device_flags flags); - int (*stop) (enum device_flags flags); + int (*start) (enum deviced_event reason); + int (*stop) (enum deviced_event reason); int (*status) (void); int (*execute) (void *data); void (*suspend) (void); @@ -85,7 +69,7 @@ enum device_ops_status { static inline int device_start(const struct device_ops *dev) { if (dev && dev->start) - return dev->start(NORMAL_MODE); + return dev->start(DEVICED_EVENT_MISC); return -EINVAL; } @@ -93,7 +77,7 @@ static inline int device_start(const struct device_ops *dev) static inline int device_stop(const struct device_ops *dev) { if (dev && dev->stop) - return dev->stop(NORMAL_MODE); + return dev->stop(DEVICED_EVENT_MISC); return -EINVAL; } diff --git a/src/touchscreen/touchscreen.c b/src/touchscreen/touchscreen.c index 4c95181f..bd0ba066 100644 --- a/src/touchscreen/touchscreen.c +++ b/src/touchscreen/touchscreen.c @@ -45,8 +45,8 @@ static bool touchscreen_dev_available = false; static int touchscreen_enable = DEVICE_OPS_STATUS_START; static int powersaving_support = true; -static int touchscreen_start(enum device_flags flags); -static int touchscreen_stop(enum device_flags flags); +static int touchscreen_start(enum deviced_event reason); +static int touchscreen_stop(enum deviced_event reason); static int touchscreen_powersaving(enum ps_mode mode); static int touchscreen_set_state(enum touchscreen_state state); @@ -68,7 +68,7 @@ static void touchscreen_wakeup_status(keynode_t *key, void *data) if (display_panel_get_dpms_cached_state() != SYSCOMMON_DEVICED_DPMS_ON) { if (g_display_plugin.config->touch_wakeup) { - touchscreen_start(NORMAL_MODE); + touchscreen_start(DEVICED_EVENT_DEVICE_READY); } else { touchscreen_powersaving(POWERSAVING_OFF); touchscreen_set_state(TOUCHSCREEN_OFF); @@ -170,7 +170,7 @@ static int touchscreen_execute(void *data) return 0; } -static int touchscreen_start(enum device_flags flags) +static int touchscreen_start(enum deviced_event reason) { int state = -1; int ret; @@ -197,7 +197,7 @@ static int touchscreen_start(enum device_flags flags) return ret; } -static int touchscreen_stop(enum device_flags flags) +static int touchscreen_stop(enum deviced_event reason) { if (!g_display_plugin.config) { _I("Touchscreen is not initialized."); @@ -256,7 +256,7 @@ static GVariant *dbus_touchscreen_enable(GDBusConnection *conn, GVariant *param, GDBusMethodInvocation *invocation, gpointer user_data) { int ret; - ret = touchscreen_start(NORMAL_MODE); + ret = touchscreen_start(DEVICED_EVENT_DEVICE_READY); return g_variant_new("(i)", ret); } diff --git a/tests/usb-host-test/usb-host-test.c b/tests/usb-host-test/usb-host-test.c index 7a17d530..787c4755 100644 --- a/tests/usb-host-test/usb-host-test.c +++ b/tests/usb-host-test/usb-host-test.c @@ -550,7 +550,7 @@ static GVariant *dbus_start(GDBusConnection *conn, if (!usb_host_test_device_ops) usb_host_test_device_ops = find_device("usb-host-test"); - ret = usb_host_test_device_ops->start(NORMAL_MODE); + ret = usb_host_test_device_ops->start(DEVICED_EVENT_MISC_DBUS); if (ret != 0 && ret != -EALREADY) _E("Failed to start usb-host-test : %d", ret); @@ -567,14 +567,14 @@ static GVariant *dbus_stop(GDBusConnection *conn, if (!usb_host_test_device_ops) usb_host_test_device_ops = find_device("usb-host-test"); - ret = usb_host_test_device_ops->stop(NORMAL_MODE); + ret = usb_host_test_device_ops->stop(DEVICED_EVENT_MISC_DBUS); if (ret != 0 && ret != -EALREADY) _E("Failed to stop usb-host-test : %d", ret); return gdbus_new_g_variant_tuple(); } -static int usb_host_test_start(enum device_flags flags) +static int usb_host_test_start(enum deviced_event reason) { if (status == DEVICE_OPS_STATUS_START) return -EALREADY; @@ -582,7 +582,7 @@ static int usb_host_test_start(enum device_flags flags) return start(); } -static int usb_host_test_stop(enum device_flags flags) +static int usb_host_test_stop(enum deviced_event reason) { if (status == DEVICE_OPS_STATUS_STOP) return -EALREADY;