From: Yunhee Seo Date: Tue, 15 Oct 2024 02:03:34 +0000 (+0900) Subject: display: Add support of loading display conf file from /etc/deviced/conf.d/ X-Git-Tag: accepted/tizen/unified/20241017.114737^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0e9c00d9ae101d80c0095673834b358724d6c65a;p=platform%2Fcore%2Fsystem%2Fdeviced.git display: Add support of loading display conf file from /etc/deviced/conf.d/ Before this, display.conf file was used only default config file from deviced. However, display conf file should be handled according to plugin backend profile. With this, display.conf /etc/deviced/conf.d/ can be loaded. To use display.conf defined from plugin backend, this is necessary. Also, as applying this, to test and check dpms type in headless image, new test case is added. Change-Id: I030ec8e77ea50e9082e26231d7cf7549fdac7466 Signed-off-by: Yunhee Seo --- diff --git a/src/display/display-config.c b/src/display/display-config.c index 75986868..212157e3 100644 --- a/src/display/display-config.c +++ b/src/display/display-config.c @@ -124,6 +124,9 @@ int display_load_config(void) return -ENOMEM; } + if (access(PLUGIN_DISPLAY_CONF_FILE, F_OK) == 0) + return config_parse(PLUGIN_DISPLAY_CONF_FILE, display_config_parse, g_display_config); + return config_parse(DISPLAY_CONF_FILE, display_config_parse, g_display_config); } diff --git a/src/display/display-config.h b/src/display/display-config.h index e71a1ac6..54a3df4f 100644 --- a/src/display/display-config.h +++ b/src/display/display-config.h @@ -23,6 +23,7 @@ #include #define DISPLAY_CONF_FILE "/etc/deviced/display.conf" +#define PLUGIN_DISPLAY_CONF_FILE "/etc/deviced/conf.d/display.conf" /** * FIXME: Add getters for all member variables not to expose it with extern keyword diff --git a/tests/syscommon-plugin-test/display.cc b/tests/syscommon-plugin-test/display.cc index a7363ef7..3ace7f0c 100644 --- a/tests/syscommon-plugin-test/display.cc +++ b/tests/syscommon-plugin-test/display.cc @@ -3,6 +3,8 @@ #include "syscommon-plugin-test.h" +#define DISPLAY_FEATURE "http://tizen.org/feature/display" + class DisplayTest : public testing::Test { protected: void SetUp() override { @@ -13,10 +15,15 @@ class DisplayTest : public testing::Test { display_plugin_backend_supported = true; else display_plugin_backend_supported = false; + + ret_val = system_info_get_platform_bool(DISPLAY_FEATURE, &display_feature); + if (ret_val < 0) + display_feature = false; } ~DisplayTest() {} void TearDown() override {} bool display_plugin_backend_supported; + bool display_feature; }; TEST_F(DisplayTest, LoadConfig) @@ -30,3 +37,21 @@ TEST_F(DisplayTest, LoadConfig) ret_val = syscommon_plugin_deviced_display_load_config(&display_config); EXPECT_TRUE(ret_val == 0 || ret_val == -ENOTSUP || ret_val == -EOPNOTSUPP); } + +TEST_F(DisplayTest, CheckDisplayDPMSTypeInHeadless) +{ + int ret_val = -1; + struct syscommon_deviced_display_config *display_config = NULL; + + if (!display_plugin_backend_supported) + return; + + if (display_feature) { + DEBUG_MESSAGE("This image is not headless image, display feature is true."); + return; + } + + ret_val = syscommon_plugin_deviced_display_load_config(&display_config); + if (ret_val == 0 && display_config) + EXPECT_EQ(display_config->display_dpms_type, SYSCOMMON_DEVICED_DPMS_TYPE_NONE); +} \ No newline at end of file