!77 电源节能模式兼容hadess和tuned两个后端。

From: @tangjie02 
Reviewed-by: @stonefly128 
Signed-off-by: @stonefly128
This commit is contained in:
openeuler-ci-bot 2023-07-08 02:46:45 +00:00 committed by Gitee
commit 2eeee339f0
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 1134 additions and 1 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,83 @@
From 8a7cee50c347b79d0f68c0426ce5a07f25b462de Mon Sep 17 00:00:00 2001
From: tangjie02 <tangjie02@kylinsec.com.cn>
Date: Mon, 8 May 2023 18:04:07 +0800
Subject: [PATCH] fix(edid): Fix the problem that cannot match correct monitor
when has same edid.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 修复edid相同时无法正确匹配到对应的显示器问题
Signed-off-by: tangjie02 <tangjie02@kylinsec.com.cn>
---
plugins/display/display-manager.cpp | 28 +++++++++++++++++++++++++---
plugins/display/display-manager.h | 3 +++
2 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/plugins/display/display-manager.cpp b/plugins/display/display-manager.cpp
index 0860253..f80e248 100644
--- a/plugins/display/display-manager.cpp
+++ b/plugins/display/display-manager.cpp
@@ -410,12 +410,13 @@ bool DisplayManager::apply_screen_config(const ScreenConfigInfo &screen_config,
for (const auto &c_monitor : c_monitors)
{
- std::string uid = c_monitor.uid();
- auto monitor = this->get_monitor_by_uid(uid);
+ auto monitor = this->match_best_monitor(c_monitor.uid(), c_monitor.name());
if (!monitor)
{
- KLOG_WARNING("Cannot find monitor for %s.", uid.c_str());
+ KLOG_WARNING("cannot find monitor for uid=%s, name=%s.",
+ c_monitor.uid().c_str(),
+ c_monitor.name().c_str());
return false;
}
@@ -800,6 +801,27 @@ std::shared_ptr<DisplayMonitor> DisplayManager::get_monitor_by_name(const std::s
return nullptr;
}
+std::shared_ptr<DisplayMonitor> DisplayManager::match_best_monitor(const std::string &uid,
+ const std::string &name)
+{
+ std::shared_ptr<DisplayMonitor> retval;
+ for (const auto &iter : this->monitors_)
+ {
+ if (!retval && iter.second->get_uid() == uid)
+ {
+ retval = iter.second;
+ }
+
+ // 完美匹配则直接退出
+ if (iter.second->get_uid() == uid && iter.second->name_get() == name)
+ {
+ retval = iter.second;
+ break;
+ }
+ }
+ return retval;
+}
+
std::string DisplayManager::get_monitors_uid()
{
std::vector<std::string> result;
diff --git a/plugins/display/display-manager.h b/plugins/display/display-manager.h
index c2fdce6..3d866ff 100644
--- a/plugins/display/display-manager.h
+++ b/plugins/display/display-manager.h
@@ -107,6 +107,9 @@ private:
std::shared_ptr<DisplayMonitor> get_monitor(uint32_t id);
std::shared_ptr<DisplayMonitor> get_monitor_by_uid(const std::string& uid);
std::shared_ptr<DisplayMonitor> get_monitor_by_name(const std::string& name);
+ // 优先匹配uid如果有多个uid匹配则再匹配name
+ std::shared_ptr<DisplayMonitor> match_best_monitor(const std::string& uid,
+ const std::string& name);
// 将uid进行排序后拼接
std::string get_monitors_uid();
--
2.36.1

View File

@ -1,6 +1,6 @@
Name: kiran-cc-daemon
Version: 2.5.1
Release: 12
Release: 14
Summary: DBus daemon for Kiran Desktop
License: MulanPSL-2.0
@ -15,6 +15,8 @@ Patch0006: 0001-fix-identification-issues-in-control-centers.patch
Patch0007: 0001-fix-keybinding-Add-support-desktop-key-for-GC.patch
Patch0008: 0001-fix-display-Add-adaptive-screen-change-flag.patch
patch0009: 0001-fix-systeminfo-Adjusting-the-reading-method-of-cpu-i.patch
Patch0010: 0001-feature-power-Compatiable-two-power-profile-daemon-w.patch
Patch0011: 0001-fix-edid-Fix-the-problem-that-cannot-match-correct-m.patch
BuildRequires: cmake >= 3.2
BuildRequires: pkgconfig(glibmm-2.4)
@ -184,6 +186,10 @@ glib-compile-schemas /usr/share/glib-2.0/schemas &> /dev/nulls || :
%{_libdir}/pkgconfig/kiran-cc-daemon.pc
%changelog
* Sat Jul 08 2023 tangjie02 <tangjie02@kylinsec.com.cn> - 2.5.1-13
- KYOS-F: Compatiable two power profile daemon which contains hadess and tuned.
- KYOS-B: Fix the problem that cannot match correct monitor when has same edid.
* Fri Jun 9 2023 wangtaozhi <wangtaozhi@kylinsec.com.cn> - 2.5.1-12
- KYOS-F: Adjusting the reading method of cpu information
- KYOS-F: Resolve program crash issue when exiting the program