! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
battery-plugin unresponsive during /proc reads
Status:
RESOLVED: DUPLICATE
Product:
Xfce4-battery-plugin
Component:
General

Comments

Description Bartosz Janiak 2007-09-05 09:28:11 CEST
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; pl; rv:1.8.1.3) Gecko/20070508 Firefox/2.0.0.3
Build Identifier: 

[ I posted this to goodies-dev earlier, but got no response, so I'm posting it here as well ]

I've got some problems with interface responsiveness in
xfce4-battery-plugin, that is - the tooltip showed up much too late, and
the configuration dialog was hardly usable - I had to wait a few seconds
after each click for the interface to react. This is due to the fact
that reading battery & AC /proc entries blocks the whole application
for ~2 seconds.

I've found two ways to solve this problem (and I think that both should
be available in xfce4-battery-plugin):

1. Reading those files in a separate thread.
2. Checking battery & AC status from /sys entries instead (which can be
read without blocking the interface). This is possible on linux
2.6.23-rc3-mm1 with some patches(*) from linux-acpi mailing list, and
should be available in stable kernel soon. I use it currently and
haven't found any bugs yet, so I thought I'd share this solution as
well.

I include both patches (they're separate now, but merging them
shouldn't be a big problem). I'm new to this project - and
open-source development in general - so they aren't probably done the
Right Way. Criticism welcome :)

Reproducible: Always
Comment 2 Bartosz Janiak 2007-09-05 09:31:16 CEST
Created attachment 1345 
Patch for xfce4-battery-plugin using gthread
Comment 3 Bartosz Janiak 2007-09-05 09:31:46 CEST
Created attachment 1346 
Patch for xfce4-battery-plugin using battery status provided by sysfs
Comment 4 Yves-Alexis Perez editbugs 2007-10-28 09:42:13 CET
The sysfs patch won't work for 2.6.24 kernels (some file names have changed). I'm attaching a fixed patch.
Comment 5 Yves-Alexis Perez editbugs 2007-10-28 09:43:14 CET
Created attachment 1411 
sysfs patch for battery plugin, reloaded
Comment 6 Yves-Alexis Perez editbugs 2008-02-19 12:43:19 CET
AC is sometimes called ACAD in /sys/class/power_supply. I'll come with a refreshed patch wich fixes this.

Could this patch (or a variant) be integrated, now that 2.6.24 is out?

Cheers,
Comment 7 Yves-Alexis Perez editbugs 2008-03-13 07:23:26 CET
(In reply to comment #6)
> AC is sometimes called ACAD in /sys/class/power_supply. I'll come with a
> refreshed patch wich fixes this.
> 
> Could this patch (or a variant) be integrated, now that 2.6.24 is out?

Mhmh, in the end, we may have a situation. The sysfs patch doesn't work really great. Some users say the indicator is stuck at 28%. Some people don't have any /sys/class/power_supply/AC but other weird and non standard names.

The plugin shouldn't look at fixed folder name but rather detect correctly AC/BAT folder names. 

This is becoming an issue, because ACPI_PROCFS_POWER is now deprecated and may be removed in 2.6.26. 

The hal-based branch is not yet stable (at least officially), and, well, depends on hal.

Bartosz: could refresh your patch so it works correctly on all boxes? I tried to look at it, but this is a quite intrusive change so I'm really not sure.

Nick: maybe the solution is to deprecate the 0.5.0 battery plugin early, and switch to hal (even if this add hal dependency on laptops).

What do you think?

Comment 8 Nick Schermer editbugs 2008-03-13 07:37:06 CET
I don't think the hal dependency is a show stopper. That said, I'm not really putting any time in acpi version, since I think it's a dead end. So for patch writer, I can only suggest to work on the hal-based version (please).
Comment 9 Yves-Alexis Perez editbugs 2008-03-13 07:49:36 CET
(In reply to comment #8)
> I don't think the hal dependency is a show stopper. That said, I'm not really
> putting any time in acpi version, since I think it's a dead end. So for patch
> writer, I can only suggest to work on the hal-based version (please).

Do you think releasing the hal-based version as stable is possible anytime soon?

I'm running it currently (with the integrated patche for progress bar and the remaining_time correctly picked up) and it seems to work fine.
Comment 10 Florian Rivoal editbugs 2010-12-27 16:50:16 CET
As far as I can tell, the patch in Bug #3793 makes this one obsolete. Closing this one since I applied that one. Please reopen (with an explanation) if I got this wrong.

*** This bug has been marked as a duplicate of bug 3793 ***

Bug #3533

Reported by:
Bartosz Janiak
Reported on: 2007-09-05
Last modified on: 2010-12-27

People

Assignee:
Xfce-Goodies Maintainers
CC List:
2 users

Version

Version:
0.5.1 or older

Attachments

Additional information