[Goodies-dev] [xfce4-battery-plugin][Patch] Show current power usage

David Rosca nowrep at gmail.com
Fri Nov 16 13:57:11 CET 2012


 > Are you sure that /sys/class/power_supply/BAT{x}/power_now is available
> on every machine Xfce is running on? Me is not. What happens to the
> battery plugin when there's no battery at all? :)

It is using ACPIState.prate from libacpi.c (already in plugin source). It
will try to read
it from different sources, and if all of them fails, it will be zero.

I actually only used a variable that is not used to display in plugin.

> Maybe it's better to show also the maximal power, e.g. "x/y W" where x
> is the current usage and y the maximum. You could calculate the
> maximum, or get it simply from file system if provided so.

I don't really think this is necessary. Maximum power is static value that
won't
change in one battery discharge cycle and there is no static value available
to be displayed in the plugin.
You can always check it in xfce-power-manager.

Thank you all for tip with bugzilla, I'll try to follow my patch there.

David Rosca


2012/11/16 Raphael Groner <raphgro at web.de>

> Hi,
>
> yeah, bugzilla seems to be the right place for patches like yours.
> Downstreams could catch the patch and apply the patch in their own
> responsibility or cause of need to their individual packages, when
> no active upstream is available.
>
> I think the battery plugin is still maintained. At least, we had a
> short discussion recently [1] about my suggestion merging it into the
> source of the power manager.
>
> Oh, I can see that bz is already full with similar bugs, e.g. [2].
>
> Without having looked into the source in much detail, I would like to
> add some ideas.
>
> Are you sure that /sys/class/power_supply/BAT{x}/power_now is available
> on every machine Xfce is running on? Me is not. What happens to the
> battery plugin when there's no battery at all? :)
>
> Maybe it's better to show also the maximal power, e.g. "x/y W" where x
> is the current usage and y the maximum. You could calculate the
> maximum, or get it simply from file system if provided so.
>
> BG,
> Raphael
>
> [1] https://bugzilla.xfce.org/show_bug.cgi?id=4499
> [2] https://bugzilla.xfce.org/show_bug.cgi?id=6652
>
>
> Am Fri, 16 Nov 2012 12:00:02 +0100
> schrieb goodies-dev-request at xfce.org:
>
> [...]
> > Date: Fri, 16 Nov 2012 08:08:58 +0100
> > From: Yves-Alexis Perez <corsac at debian.org>
> > To: Xfce Goodies development discussion <goodies-dev at xfce.org>
> > Subject: Re: [Goodies-dev] [xfce4-battery-plugin][Patch] Show current
> >       power usage
> > Message-ID: <1353049738.17241.93.camel at scapa>
> > Content-Type: text/plain; charset="utf-8"
> >
> > On jeu., 2012-11-15 at 09:16 +0100, David Rosca wrote:
> > > Hi,
> > > I have made a small patch that adds support for showing current
> > > power usage (in Watts)
> > > next to approximate remaining time. So in panel, it will be shown
> > > like:
> > >
> > >                                     04:25 (9 W)
> > >
> > > It is using data from libacpi.c
> > > (from /sys/class/power_supply/BAT{x}/power_now).
> > > It is working great for my laptop (Thinkpad X220) running 3.5.7
> > > kernel. It may however need
> > > some tweaking to get it working properly on every laptop.
> > >
> > > Current power usage will only be shown when on battery (I
> > > used !acline check, so I hope it's correct).
> > > I have integrated it into remaining time box because i didn't want
> > > to create a new box just for this.
> > >
> > > I'm not really sure if I can send attachements to mailing lists, so
> > > I will append the patch at the end
> > > of the mail.
> > >
> > > Please let me know what you think about this patch.
> > >
> > Can you please attach it to bugzilla so it doesn't get lost? However,
> > I'm unsure if the battery plugin is really maintained these days, so
> > it might be a bit hard to have it reviewed and committed?
> >
> > Regards,
>
> _______________________________________________
> Goodies-dev mailing list
> Goodies-dev at xfce.org
> https://mail.xfce.org/mailman/listinfo/goodies-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.xfce.org/pipermail/goodies-dev/attachments/20121116/9b065d8b/attachment.html>


More information about the Goodies-dev mailing list