Hi,

we have still problems with dbus reconnecting if dbus shuts
down. Powersave daemon reconnects, but not until the first or second acpi
event has happened as long as CPUFREQ_USERSPACE is used.

So the trick would be to poll the filedescriptor in a specific intervall
as long as dbus is away and switch back to blocking mode as soon as dbus
back. I appended a patch which does exactly this. I tested with different
example usages:

        with(out) battery, CPUFREQ_KERNEL/ CPUFREQ_USERSPACE and mixtures
        of these modes.

Please comment and test if it works!

Greetings,
        Holger



Index: daemon/powersaved.cpp
===================================================================
RCS file: /cvsroot/powersave/powersave/daemon/powersaved.cpp,v
retrieving revision 1.139
diff -u -r1.139 powersaved.cpp
--- daemon/powersaved.cpp       30 Aug 2005 15:31:34 -0000      1.139
+++ daemon/powersaved.cpp       31 Aug 2005 12:37:11 -0000
@@ -345,13 +345,30 @@
        gettimeofday(&tv_start, &dummy);
        for (;;){
                do{
+                       // we must try to reconnect to dbus in a specific
+                       // timeout if dbus died. If select blocks because
+                       // of CPUFREQ_KERNEL, we wouldn't reconnect until
+                       // the first or second acpi event happens. This is
+                       // also only a workaround which should be fixed
+                       // properly.
+                       if ( DBus_Server::DBusDied ) {
+                               req.tv_sec  = 3;
+                               req.tv_usec = 0;
+                       }
+                       else {
+                               req.tv_sec  = req_init.tv_sec;
+                               req.tv_usec = req_init.tv_usec;
+                       }
+
                        temp_fd_set=fd_set_reading;
 
-                       // if no cpufreq and no battery is supported do not 
poll at all!
+                       // if no cpufreq and no battery is supported and
+                       // dbus did not die do not poll at all!
                        if ((cur_state.BAT_STATE == BAT_NONE_STATE && 
                            !CPUFreq_Interface::isSupported() && !acpidDied) ||
                            (!config->current_scheme->FORCE_BATTERY_POLLING &&
-                           (config->CPUFREQ_CONTROL == CPUFREQ_KERNEL))) {
+                           (config->CPUFREQ_CONTROL == CPUFREQ_KERNEL)) &&
+                           (!DBus_Server::DBusDied) ) {
                                pDebug(DBG_DEBUG, "Select waiting without 
timeout, polling disabled.");
                                ret = select (max_FD_value+1, &temp_fd_set, 
NULL, NULL, NULL);
                                pDebug(DBG_INFO, "Select came out");
_______________________________________________
powersave-devel mailing list
[email protected]
http://forge.novell.com/mailman/listinfo/powersave-devel

Reply via email to