Bug#444500: klaptopdaemon: "Hibernate" menu items missing with 2.6.22 and later kernels
On Sat, Nov 24, 2007 at 11:13:45AM +0100, Marc Haber wrote:
> On Sat, Sep 29, 2007 at 10:20:59AM +0200, Marc Haber wrote:
> > klaptopdaemon does not show the "Hibernate" menu items with recent
> > kernels. This is upstream Bug #148928.
>
> Still applies for 3.5.8-1. I have not yet tried whether the patch
> still helps.
The attached patch is verified to fix 3.5.8-1. Please apply.
Greetings
Marc
--
-----------------------------------------------------------------------------
Marc Haber | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany | lose things." Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature | How to make an American Quilt | Fax: *49 621 72739835
diff -Nur kdeutils-3.5.8/klaptopdaemon/portable.cpp kdeutils-3.5.8.new/klaptopdaemon/portable.cpp
--- kdeutils-3.5.8/klaptopdaemon/portable.cpp 2008-01-30 09:20:06.000000000 +0100
+++ kdeutils-3.5.8.new/klaptopdaemon/portable.cpp 2008-01-30 09:20:57.000000000 +0100
@@ -690,11 +690,11 @@
mask = 0;
QFile p("/sys/power/state");
- QFile f("/proc/acpi/sleep");
if (p.exists() && p.open(IO_ReadOnly)) {
+ QTextStream stream(&p);
QString l;
- p.readLine(l,500);
+ l = stream.readLine();
QStringList ll = QStringList::split(' ',l,false);
for (QValueListIterator<QString> i = ll.begin(); i!=ll.end(); i++) {
QString s = *i;
@@ -708,20 +708,6 @@
}
p.close();
}
- else if (f.exists() && f.open(IO_ReadOnly)) {
- QString l;
- f.readLine(l, 500);
- QStringList ll = QStringList::split(' ',l,false);
- for (QValueListIterator<QString> i = ll.begin(); i!=ll.end(); i++) {
- QString s = *i;
- if (s[0] == 'S') {
- int c = s[1].digitValue();
- if (c >= 0 && c <= 9)
- mask |= 1<<c;
- }
- }
- f.close();
- }
}
return((mask&acpi_sleep_enabled&(1<<state)) != 0);
}
Reply to: