[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-hardware-devel
Subject: [Kde-hardware-devel] Review Request: Fix bug: generateProfiles generates a config where lidClose eve
From: "Alex Fiestas" <alex () eyeos ! org>
Date: 2012-10-14 23:20:44
Message-ID: 20121014232044.2401.50775 () vidsolbach ! de
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/106859/
-----------------------------------------------------------
Review request for Solid.
Description
-------
The bug is produced because of the following code:
if (methods.contains(Solid::PowerManagement::SuspendState)) {
handleButtonEvents.writeEntry< uint >("lidAction", ToRamMode);
} else {
handleButtonEvents.writeEntry< uint >("lidAction", TurnOffScreenMode);
}
There, SuspendState will NOT be contained in method, so we will fallback to=
TurnOffScreenMode.
LibSolid is always returning an empty "methods" (QList of SuspendMethods). =
LibSolid uses powerdevil
dbus api to know which suspend methods are available:
libsolid---dbus--->powerdevl-----backend---->UDisk
The problem is that the DBus interface of powerdevil is being setup AFTER g=
enerateProfile is executed, so libsolid
will fail to query powerdevil for the available suspend methods because pow=
erdevil haven't made them public yet.
The approach in the fix:
There are many ways of fixing this, the simpler one is to execute the dbus =
registering before generateProfiles is executed,
the others are based on the same principle of moving the current code aroun=
d to make libsolid work.
The reason why I went for a different approach is because it is architectur=
ally wrong to have an interdependence:
PowerDevil------->libsolid------->PowerDevil.
No matter how careful we are, having this interdependence is going to cause=
problems sooner or later.
So, what I have done to keep the patch small is add 2 new arguments to gene=
rateProfiles (toRam and toDisk) so we don't
have to call libsolid in order to get this info.
I had to add these arguments instead of using PowerDevil::BackendInfo becau=
se generateProfiles is also used in EditPage.
Diffs
-----
powerdevil/daemon/powerdevilcore.cpp b968d21 =
powerdevil/daemon/powerdevilprofilegenerator.h a909294 =
powerdevil/daemon/powerdevilprofilegenerator.cpp 060fc30 =
powerdevil/kcmodule/profiles/EditPage.cpp 95a98d9 =
Diff: http://git.reviewboard.kde.org/r/106859/diff/
Testing
-------
Thanks,
Alex Fiestas
[Attachment #5 (text/html)]
<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 \
solid;"> <tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="http://git.reviewboard.kde.org/r/106859/">http://git.reviewboard.kde.org/r/106859/</a>
</td>
</tr>
</table>
<br />
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('http://git.reviewboard.kde.org/media/rb/images/review_request_box_top_bg.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;"> <tr>
<td>
<div>Review request for Solid.</div>
<div>By Alex Fiestas.</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" \
style="border: 1px solid #b8b5a0"> <tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">The bug is produced because of the following code: if \
(methods.contains(Solid::PowerManagement::SuspendState)) { \
handleButtonEvents.writeEntry< uint >("lidAction", ToRamMode); } else \
{ handleButtonEvents.writeEntry< uint >("lidAction", \
TurnOffScreenMode); }
There, SuspendState will NOT be contained in method, so we will fallback to \
TurnOffScreenMode.
LibSolid is always returning an empty "methods" (QList of SuspendMethods). \
LibSolid uses powerdevil dbus api to know which suspend methods are available:
libsolid---dbus--->powerdevl-----backend---->UDisk
The problem is that the DBus interface of powerdevil is being setup AFTER \
generateProfile is executed, so libsolid will fail to query powerdevil for the \
available suspend methods because powerdevil haven't made them public yet.
The approach in the fix:
There are many ways of fixing this, the simpler one is to execute the dbus \
registering before generateProfiles is executed, the others are based on the same \
principle of moving the current code around to make libsolid work.
The reason why I went for a different approach is because it is architecturally wrong \
to have an interdependence:
PowerDevil------->libsolid------->PowerDevil.
No matter how careful we are, having this interdependence is going to cause problems \
sooner or later.
So, what I have done to keep the patch small is add 2 new arguments to \
generateProfiles (toRam and toDisk) so we don't have to call libsolid in order to \
get this info. I had to add these arguments instead of using PowerDevil::BackendInfo \
because generateProfiles is also used in EditPage.</pre> </td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>powerdevil/daemon/powerdevilcore.cpp <span style="color: \
grey">(b968d21)</span></li>
<li>powerdevil/daemon/powerdevilprofilegenerator.h <span style="color: \
grey">(a909294)</span></li>
<li>powerdevil/daemon/powerdevilprofilegenerator.cpp <span style="color: \
grey">(060fc30)</span></li>
<li>powerdevil/kcmodule/profiles/EditPage.cpp <span style="color: \
grey">(95a98d9)</span></li>
</ul>
<p><a href="http://git.reviewboard.kde.org/r/106859/diff/" style="margin-left: \
3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>
_______________________________________________
Kde-hardware-devel mailing list
Kde-hardware-devel@kde.org
https://mail.kde.org/mailman/listinfo/kde-hardware-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic