maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   Pybattery - battery statusbar applet with candies (https://talk.maemo.org/showthread.php?t=24905)

412b 2008-11-11 20:04

Advanced Power - battery statusbar applet with candies
 
2 Attachment(s)
Once upon a time I got tired of the standard battery applet and decided to make my own one. So here is the result.
1. I DO think that it would be better to be written in C, but...
2. I tested it only on n810 (2008, Diablo, 36-5/43-7) and N900 (10.2010.19-1), so testing feedback is highly appreciated.
3. Known issues:
- Right after full battery charge it's not 100%, because battery capacity is less than designed value.
- CPU governor isn't saved in gconf, so after reboot it's gonna be "ondemand" again.

P.S. Hope you enjoy using it ;)

Since AP and APM are in Extras, no need for download links, I guess.
Garage: Advanced Power Monitor 0.4.1, Advanced Power 0.3.6, themes: Hildon, LCARS, Okuda

Fremantle version can be found in extras-devel repo at the moment.

Remember to reboot your device if status-menu is messed up

Localization templates attached only for Fremantle.

P.P.S. If you can make translation to your language for this app, feel free to PM me.

GeneralAntilles 2008-11-11 20:44

Re: Pybattery - battery statusbar applet with candies
 
How about making this the Advanced Power applet? ;) I like where this is heading, though. I can help with icons and UI Mockups if you're interested.

412b 2008-11-11 20:51

Re: Pybattery - battery statusbar applet with candies
 
Quote:

Originally Posted by GeneralAntilles (Post 241124)
How about making this the Advanced Power applet? ;) I like where this is heading, though. I can help with icons and UI Mockups if you're interested.

Hmmm... AdvancedPower... ))) I'll think about it :)
I'm interested, 'cause I'm using it ;) So you are welcomed.
I'm thinking of theme support and settings for hiding/showing info.

qwerty12 2008-11-11 20:51

Re: Pybattery - battery statusbar applet with candies
 
Woah, this is some seriously nice **** :)

How about putting this in the postinst:
sed -i 's/^Mandatory/#Mandatory/' /usr/share/applications/hildon-status-bar/hildon-status-bar-battery.desktop

at least #6 is done automatically then :)

GeneralAntilles 2008-11-11 21:05

Re: Pybattery - battery statusbar applet with candies
 
Quote:

Originally Posted by 412b (Post 241126)
Hmmm... AdvancedPower... ))) I'll think about it :)

Well, I like it because it creates a set of replacement statusbar applets that are open source, faster, better, more useful than the Nokia applets. Advanced Backlight, Advanced Power, Advanced Connectivity, etc.

Each applet will benefit from the shared branding with the others, people will instantly know what it is when you slap "Advanced" on the front of the name. The end result is better for everybody involved. ;)

dkwatts 2008-11-11 21:29

Re: Pybattery - battery statusbar applet with candies
 
Reattach, please. I'm not planning on uninstalling it.

qwerty12 2008-11-11 21:37

Re: Pybattery - battery statusbar applet with candies
 
When the charger is inserted, is it possible to play the /usr/share/sounds/ui-charging_started.wav sound?

412b 2008-11-11 21:40

Re: Pybattery - battery statusbar applet with candies
 
Fixed and uploaded.

Quote:

Originally Posted by qwerty12 (Post 241141)
When the charger is inserted, is it possible to play the /usr/share/sounds/ui-charging_started.wav sound?

I guess, yes ;)
I just don't like that sound on charger connect.

qwerty12 2008-11-11 21:46

Re: Pybattery - battery statusbar applet with candies
 
Quote:

Originally Posted by 412b (Post 241142)
I guess, yes ;)
I just don't like that sound on charger connect.

It can always be made an option . ;)

dkwatts 2008-11-11 21:55

Re: Pybattery - battery statusbar applet with candies
 
CPU Freq Definitions:
conservative =
ondemand = same as liqbase?
null =
powersave = same as liqbase?
performance = same as liqbase?

412b 2008-11-11 21:59

Re: Pybattery - battery statusbar applet with candies
 
Quote:

Originally Posted by dkwatts (Post 241147)
CPU Freq Definitions:
conservative =
ondemand = same as liqbase?
null =
powersave = same as liqbase?
performance = same as liqbase?

What do you mean by "same as liqbase"?
Governors and cpufreq are system-wide...

dkwatts 2008-11-11 22:21

Re: Pybattery - battery statusbar applet with candies
 
Quote:

Originally Posted by 412b (Post 241150)
What do you mean by "same as liqbase"?
Governors and cpufreq are system-wide...

Found my answer at http://www.mjmwired.net/kernel/Docum.../governors.txt

Up until now I have been using liqbase scripts to regulate cpufreq:

"sudo /usr/bin/liqbase-cpu-powersave"
"sudo /usr/bin/liqbase-cpu-ondemand"
"sudo /usr/bin/liqbase-cpu-performance"

lcuk 2008-11-11 22:33

Re: Pybattery - battery statusbar applet with candies
 
dkwatts, yes they are the same.

allnameswereout 2008-11-11 23:01

Re: Pybattery - battery statusbar applet with candies
 
I read "with candles". Made me wonder.

...

Thanks for the statusbar applet, I'm trying it out.

qwerty12 2008-11-11 23:36

Re: Pybattery - battery statusbar applet with candies
 
Hrm, noticed original battery applet gets activated when you use my sed conmand line to comment mandatory ;)

Anyway, delete that postinst with just that sed line and make a preinst with:

Quote:

#!/bin/sh

qDesktop=/usr/share/applications/hildon-status-bar/hildon-status-bar-battery.desktop

12MandCheck=`cat $qDesktop | grep Mandatory`

if [ x$12MandCheck = xMandatory=true ]; then
sed -i 's/^Mandatory/#Mandatory/' $qDesktop
fi
Running it as preinst should stop maemo from realising desktop file changed and reenabling original applet.

BrentDC 2008-11-12 03:27

Re: Pybattery - battery statusbar applet with candies
 
Thank you 412b, this is a great addition to my tablet.

I've actually been learning Python for the single purpose of creating an applet just like this! What license are you releasing this under? GPL? I would love to modify it per my needs...

Thank you again.

tso 2008-11-12 03:32

Re: Pybattery - battery statusbar applet with candies
 
heh, watching that percentage drop makes me want to do something about my wifi setup.

i just wonder how this will interact with the n800 led indication for a fully charged battery.

TrueJournals 2008-11-12 04:34

Re: Pybattery - battery statusbar applet with candies
 
Very nice! I modified it once I downloaded it to use farenheit instead of celsius for the temperature (hooray America!) Do you think you could include an option for this?

Also, I think something like acmonitor would be cool incorporated into this. acmonitor lets you have different backlight levels (and baclight settings) for plugged in and running on batteries. I'd like to see cpu governor added to that list, so I could have performance when plugged in, and ondemand for battery usage. Maybe go another step and change it to powersave when the battery gets low.

GeneralAntilles 2008-11-12 04:40

Re: Pybattery - battery statusbar applet with candies
 
Quote:

Originally Posted by TrueJournals (Post 241228)
Maybe go another step and change it to powersave when the battery gets low.

Unless you're constantly using the CPU, this is likely to use more power, as it'll take longer for the CPU to complete tasks and go to idle, and idle is where you want to be as quickly as possible (Race to Idle).

TrueJournals 2008-11-12 04:45

Re: Pybattery - battery statusbar applet with candies
 
Ah, ok. Thanks for the explination. Kind of ironic, isn't it?

Also, I've stumbled upoon a bug: this applet doesn't update when other applications change the cpu governor. I went into liqbase and changed it to performance, but the applet still shows it as ondemand.

allnameswereout 2008-11-12 06:50

Re: Pybattery - battery statusbar applet with candies
 
Quote:

Originally Posted by TrueJournals (Post 241228)
Very nice! I modified it once I downloaded it to use farenheit instead of celsius for the temperature (hooray America!) Do you think you could include an option for this?

OMWeather also sets this. Ideally, this would be set in the Configuration Screen (based on LOCALE).

I like it a lot.

It doesn't tell about swap usage though, nor CPU usage. Some people use load-applet for this (with the 2 bars), but this shows realtime usage.

The entries appear to be clickable while unclickable options are normally grey. So it should be in an info box, or greyed out.

It is also a little bit slow before the information pops up.

qwerty12 2008-11-12 07:05

Re: Pybattery - battery statusbar applet with candies
 
Quote:

Originally Posted by allnameswereout (Post 241247)
It doesn't tell about swap usage though

I'm not a python programmer by any means but by copying the RAM stuff by 412b, I quickly made this:

http://slexy.org/view/s2P5BWtSNa

It doesn't hide automatically however when swap is disabled (I need to read up on python's if statements usage)

bow 2008-11-12 08:47

Re: Pybattery - battery statusbar applet with candies
 
<solved>When I try to install this it says it's missing a couple of application packages. python2.5-hildondesktop and hildon-desktop-python-loader.</solved>


Yeah, silly me, a simple apt-get fixed that... Never mind :)

412b 2008-11-12 12:49

Re: Pybattery - battery statusbar applet with candies
 
Quote:

Originally Posted by BrentDC (Post 241213)
What license are you releasing this under? GPL? I would love to modify it per my needs...

I think it's gonna be GPL or FreeBSD License. You can modify it in any way, but leaving the copyright. May be your needs would be community-wide and implemented in this app :)

412b 2008-11-12 12:50

Re: Pybattery - battery statusbar applet with candies
 
Quote:

Originally Posted by tso (Post 241215)
i just wonder how this will interact with the n800 led indication for a fully charged battery.

On n810 it's as it was before. Just working :)

412b 2008-11-12 12:54

Re: Pybattery - battery statusbar applet with candies
 
Quote:

Originally Posted by TrueJournals (Post 241228)
Very nice! I modified it once I downloaded it to use farenheit instead of celsius for the temperature (hooray America!) Do you think you could include an option for this?

Also, I think something like acmonitor would be cool incorporated into this. acmonitor lets you have different backlight levels (and baclight settings) for plugged in and running on batteries. I'd like to see cpu governor added to that list, so I could have performance when plugged in, and ondemand for battery usage. Maybe go another step and change it to powersave when the battery gets low.

All the configuration stuff will be implemented later (including localization and regional stuff, I guess).

Quote:

Originally Posted by TrueJournals (Post 241231)
Also, I've stumbled upoon a bug: this applet doesn't update when other applications change the cpu governor. I went into liqbase and changed it to performance, but the applet still shows it as ondemand.

Yeah... Gonna fix it in 0.2.20

412b 2008-11-12 13:00

Re: Pybattery - battery statusbar applet with candies
 
Quote:

Originally Posted by allnameswereout (Post 241247)
It doesn't tell about swap usage though, nor CPU usage. Some people use load-applet for this (with the 2 bars), but this shows realtime usage.

The entries appear to be clickable while unclickable options are normally grey. So it should be in an info box, or greyed out.

It is also a little bit slow before the information pops up.

If swap usage is needed, I can implement it easily in kind of way qwerty12 did it with some difference (code changed a bit in 0.2.19).

About clickable entries... Well, it becomes hardly readable in grey. So it's hard to figure out the best way. I'm testing different solutions.

Popup is speeded up in 0.2.19

dkwatts 2008-11-12 15:07

Re: Pybattery - battery statusbar applet with candies
 
Quote:

Originally Posted by GeneralAntilles (Post 241230)
Unless you're constantly using the CPU, this is likely to use more power, as it'll take longer for the CPU to complete tasks and go to idle, and idle is where you want to be as quickly as possible (Race to Idle).

When current cpu demand does not require max cpu speed, will “conservative” arrive at idle at the same time that “ondemand” arrives at idle?

If yes, then "conservative" is the better setting when on battery.

tso 2008-11-12 16:04

Re: Pybattery - battery statusbar applet with candies
 
Quote:

Originally Posted by 412b (Post 241299)
On n810 it's as it was before. Just working :)

guessing that some brainiac over at nokia turned it of by default if running on a N800 then. grumble...

tso 2008-11-12 16:06

Re: Pybattery - battery statusbar applet with candies
 
Quote:

Originally Posted by dkwatts (Post 241342)
When current cpu demand does not require max cpu speed, will “conservative” arrive at idle at the same time that “ondemand” arrives at idle?

If yes, then "conservative" is the better setting when on battery.

iirc, ondemand goes straight to max clock, then steps downwards.

conservative steps upwards, then goes straight to min clock.

Aisu 2008-11-12 16:29

Re: Pybattery - battery statusbar applet with candies
 
Thank you, thank you, thank you!

Wonderful applet that I have been wanting for ages. It does everything I want (plus, I'm very happy you wrote it in Python so that I can muss with it. Like making it display Fahrenheit ;)). I just have one, kinda weird, request.

When the screen is off on the (edit) N810, the led blinks a nice blue color infrequently, right? Well, I was wondering if you could use the led to indicate battery status. Green for high, Blue for ok , do we have a Yellow?, and red for almost dead. Please think about it :D

Thanks again for this great applet! It is very much appreciated.

GeneralAntilles 2008-11-12 16:35

Re: Pybattery - battery statusbar applet with candies
 
Quote:

Originally Posted by Aisu (Post 241374)
When the screen is off on the N8*0, the led blinks a nice blue color infrequently, right? Well, I was wondering if you could use the led to indicate battery status. (Green for high, Blue ok , do we have a Yellow?, and red for almost dead.) Please think about it :D

The N800's LED is 15 steps of blue. The N810's LED is full RGB.

tso 2008-11-12 16:42

Re: Pybattery - battery statusbar applet with candies
 
seems pybattery is triggering an old classic when it comes to using python inside hildon-desktop.

basically, ones i have activated pybattery, the cpu will stay at max clock, and will remain there even if i turn pybattery of.

the only real option for freeing up the cpu so that the cpu can idle and clock down is to kill hildon-desktop.

412b 2008-11-12 18:45

Re: Pybattery - battery statusbar applet with candies
 
Quote:

Originally Posted by tso (Post 241381)
seems pybattery is triggering an old classic when it comes to using python inside hildon-desktop.

basically, ones i have activated pybattery, the cpu will stay at max clock, and will remain there even if i turn pybattery of.

the only real option for freeing up the cpu so that the cpu can idle and clock down is to kill hildon-desktop.

Really strange... Applet was designed to use about 0-2% of cpu and seems to do it.
Do you have python-launcher installed? I have had some sad experience, which leaded to uninstalling it.
Does anyone else has such behavior?

mikkov 2008-11-12 18:51

Re: Pybattery - battery statusbar applet with candies
 
I can confirm the bug. I don't have python-launcher

tso 2008-11-12 19:52

Re: Pybattery - battery statusbar applet with candies
 
just for the record, yes i have python-launcher installed.

but i have been using some of the home* applets, and they make use of python, without seeing this lately.

albright 2008-11-12 20:27

Re: Pybattery - battery statusbar applet with candies
 
I can confirm. I *wondered* why after installing
advanced (sic)-power my tablet on idle was eating
the battery. Pegged at 400mhz!!

I wonder what's causing this (otherwise, it is a
great app).

lcuk 2008-11-12 20:42

Re: Pybattery - battery statusbar applet with candies
 
albright, ive run in performance for months now on multiple tablets, running at 400 isn't really the problem, because it still does sleep state things i believe and by far the biggest killers on an idle tablet is the wifi/screen/disk.

however constantly running a naughty process at 400 drains the battery quicker than running a naughty process at 133.

albright 2008-11-12 21:03

Re: Pybattery - battery statusbar applet with candies
 
that is a good point, lcuk. Is there any app which, like
powertop, can tell if the processor is entering low
power states properly?

In this case, the *only* difference between yesterday (very
good battery performance) and today (very poor battery
performance, an externally physically warm tablet) is
the installation of advanced-power. Once it is killed, and
hildon-desktop restarted, you can watch the temperature
drop (from mid-thirties C to 20 C - basically ambient temp).

Who knows, perhaps whatever causes this problem pegs
the processor speed and somehow interferes with the sleep
states too. Hopefully, somebody can figure this out.

lcuk 2008-11-12 21:13

Re: Pybattery - battery statusbar applet with candies
 
albright, one day does not really tell you the exact cause.
i cannot even install it at the moment, but I "feel" how well my device is doing every time i view the stars in liqbase.
When it is busy I see the stars stutter and jerk, when completely idle they flow smoothly.

really good indicator for me :)


All times are GMT. The time now is 04:12.

vBulletin® Version 3.8.8