From: Youngjae Cho Date: Thu, 13 Jun 2024 06:32:17 +0000 (+0900) Subject: display: Fix plugin api error handling X-Git-Tag: accepted/tizen/unified/20240618.060038~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3769673ece99a49b7b69fa9901dfc62e81689780;p=platform%2Fcore%2Fsystem%2Fdeviced.git display: Fix plugin api error handling The deviced plugin api has changed to return two special error case. 1. -ENOTSUP : It specifies loading fail of plugin backend 2. -EOPNOTSUPP : It succeeded backend loading but the loaded backend has no implemented operation. Both cases take alternative fallback - the predefined default routine by the deviced. Other nagative values are considered as error of backend implementation itself so it won't take the default routine. Change-Id: I854cb9ea5403e163a5acb425f5d98bb61d8c968e Signed-off-by: Youngjae Cho --- diff --git a/src/display/display-panel.c b/src/display/display-panel.c index e73ce662..18ceec1d 100644 --- a/src/display/display-panel.c +++ b/src/display/display-panel.c @@ -239,11 +239,16 @@ void display_panel_lcd_on_procedure(int state, enum deviced_event reason) int ret; ret = syscommon_plugin_deviced_display_lcd_on_procedure(state, reason); - if (ret == 0) + if (ret == -ENOTSUP) { + _D("Take default operation as there is no found plugin backend"); + } else if (ret == -EOPNOTSUPP) { + _D("Take default operation as there is no found plugin backend operation"); + } else if (ret < 0) { + _E("Failed to plugin operation, ret=%d", ret); return; - - if (ret != -EOPNOTSUPP) + } else { return; + } /* * Display on procedure @@ -293,11 +298,16 @@ void display_panel_lcd_off_procedure(enum deviced_event reason) int ret; ret = syscommon_plugin_deviced_display_lcd_off_procedure(reason); - if (ret == 0) + if (ret == -ENOTSUP) { + _D("Take default operation as there is no found plugin backend"); + } else if (ret == -EOPNOTSUPP) { + _D("Take default operation as there is no found plugin backend operation"); + } else if (ret < 0) { + _E("Failed to plugin operation, ret=%d", ret); return; - - if (ret != -EOPNOTSUPP) + } else { return; + } /* * Display off procedure * step 0. enhance mode off using nofity (e.g mdnie, HBM, LBM) @@ -376,11 +386,16 @@ int display_panel_custom_lcd_on(int timeout) int ret; ret = syscommon_plugin_deviced_display_custom_lcd_on(timeout); - if (ret == 0) - return 0; - - if (ret != -EOPNOTSUPP) + if (ret == -ENOTSUP) { + _D("Take default operation as there is no found plugin backend"); + } else if (ret == -EOPNOTSUPP) { + _D("Take default operation as there is no found plugin backend operation"); + } else if (ret < 0) { + _E("Failed to plugin operation, ret=%d", ret); return ret; + } else { + return 0; + } if (timeout <= 0) return -EINVAL; @@ -404,11 +419,16 @@ int display_panel_custom_lcd_off(enum deviced_event reason) int ret; ret = syscommon_plugin_deviced_display_custom_lcd_off(reason); - if (ret == 0) - return 0; - - if (ret != -EOPNOTSUPP) + if (ret == -ENOTSUP) { + _D("Take default operation as there is no found plugin backend"); + } else if (ret == -EOPNOTSUPP) { + _D("Take default operation as there is no found plugin backend operation"); + } else if (ret < 0) { + _E("Failed to plugin operation, ret=%d", ret); return ret; + } else { + return 0; + } /* check holdkey block flag in lock node */ if (display_lock_is_state_locked(SYSCOMMON_DEVICED_DISPLAY_STATE_ON) || display_lock_is_state_locked(SYSCOMMON_DEVICED_DISPLAY_STATE_DIM)) { @@ -448,11 +468,16 @@ int display_panel_display_turn_on_by_reason(const char *reason, int timeout) int ret; ret = syscommon_plugin_deviced_display_on_by_reason(reason, timeout); - if (ret == 0) - return 0; - - if (ret != -EOPNOTSUPP) + if (ret == -ENOTSUP) { + _D("Take default operation as there is no found plugin backend"); + } else if (ret == -EOPNOTSUPP) { + _D("Take default operation as there is no found plugin backend operation"); + } else if (ret < 0) { + _E("Failed to plugin operation, ret=%d", ret); return ret; + } else { + return 0; + } if (!reason) return -EINVAL; @@ -492,11 +517,16 @@ int display_panel_display_turn_off_by_reason(const char *reason) int ret; ret = syscommon_plugin_deviced_display_off_by_reason(reason); - if (ret == 0) - return 0; - - if (ret != -EOPNOTSUPP) + if (ret == -ENOTSUP) { + _D("Take default operation as there is no found plugin backend"); + } else if (ret == -EOPNOTSUPP) { + _D("Take default operation as there is no found plugin backend operation"); + } else if (ret < 0) { + _E("Failed to plugin operation, ret=%d", ret); return ret; + } else { + return 0; + } if (!reason) return -EINVAL; diff --git a/src/display/setting.c b/src/display/setting.c index 4269d105..072f7ca1 100644 --- a/src/display/setting.c +++ b/src/display/setting.c @@ -289,11 +289,16 @@ int display_setting_update_pm_setting(int key_idx, int val) enum syscommon_deviced_display_state current; ret = syscommon_plugin_deviced_display_notify_setting_value_changed(key_idx, val); - if (ret == 0) - return 0; - - if (ret != -EOPNOTSUPP) + if (ret == -ENOTSUP) { + _D("Take default operation as there is no found plugin backend"); + } else if (ret == -EOPNOTSUPP) { + _D("Take default operation as there is no found plugin backend operation"); + } else if (ret < 0) { + _E("Failed to plugin operation, ret=%d", ret); return ret; + } else { + return 0; + } ret = display_state_get_current(¤t); if (ret < 0)