Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 27 Nov 2014, 07:53
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Utilities
Vattery+IBAM
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 3 of 3 Posts_count   Goto page: Previous 1, 2, 3
Author Message
technosaurus


Joined: 18 May 2008
Posts: 4380

PostPosted: Wed 28 Apr 2010, 23:15    Post_subject:  

I didn't go through all of the stuff in /proc/acpi/battery/BAT1/state
to get {dis}charge rate using the getprocinfo function from before
BATRATE=`getprocinfo /proc/acpi/battery/BAT1/state 3 rate`
and approximate time remaining in minutes
BATTIME=$(($BATREMAIN*60/$BATRATE))

Barry's Partview script has some code for generating images on the fly using ppmrough and ppmtogif

I was wondering if you could use an embedded xpm, but set the 6 digit data for the colors to be variables

(crude "battery" example)
Code:
/* XPM */
static char *test_xpm[] = {
"24 24 21 1",
"0   c None",
"1   c #FF0000",
"2   c #FF0000",
"3   c #FF0000",
"4   c #FF0000",
"5   c #FF0000",
"6   c #FF0000",
"7   c #FF0000",
"8   c #FF0000",
"9   c #FF0000",
"a   c #FF0000",
"b   c #FF0000",
"c   c #FF0000",
"d   c #FF0000",
"e   c #FF0000",
"f   c #FF0000",
"g   c #FF0000",
"h   c #FF0000",
"i   c #FF0000",
"j   c #FF0000",
"k   c #FF0000",
"000000000000000000000000",
"000000000000000000000000",
"000000111111111111000000",
"000000222222222222000000",
"000000333333333333000000",
"000000444444444444000000",
"000000555555555555000000",
"000000666666666666000000",
"000000777777777777000000",
"000000888888888888000000",
"000000999999999999000000",
"000000aaaaaaaaaaaa000000",
"000000bbbbbbbbbbbb000000",
"000000cccccccccccc000000",
"000000dddddddddddd000000",
"000000eeeeeeeeeeee000000",
"000000ffffffffffff000000",
"000000gggggggggggg000000",
"000000hhhhhhhhhhhh000000",
"000000iiiiiiiiiiii000000",
"000000jjjjjjjjjjjj000000",
"000000kkkkkkkkkkkk000000",
"000000000000000000000000",
"000000000000000000000000"
};

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send_private_message 
jemimah


Joined: 26 Aug 2009
Posts: 4309
Location: Tampa, FL

PostPosted: Thu 29 Apr 2010, 01:10    Post_subject:  

That time estimate would probably be nowhere near accurate, as batteries aren't very linear. I guess that's what most tools do though. What about laptops with multiple batteries? What about APM?

That might be too cpu heavy to use ppmtogif or whatever Nothing worse than the battery monitor killing your battery life.

You could probably use xpm (gtk definetly supports xpm, or SVG which is also easily generated on the fly [heh, you can copy my code from Vattery]), and just send gtrayicon a signal to update every minute or so. However, I think there's a tool posted on the forum somewhere that already does something very similar to what you're suggesting, and there's the one Barry says he's making.

I personally like Vattery a lot, as it's user configurable, looks nice, it's pretty easy to hack on, and best of all, it's already written. Wink
Back to top
View user's profile Send_private_message Visit_website 
technosaurus


Joined: 18 May 2008
Posts: 4380

PostPosted: Thu 29 Apr 2010, 14:16    Post_subject:  

Anyhow now that I have IBAM up and running (works great by the way) this has become a purely educational excercise and something to add to my bash library

not sure about APM (what is it? automatic power management?) - I'd have to look at the cpu scaling code in (can't think of the name) - but if I recall it does the same sort of thing except that it forcibly writes to /proc

Multiple batteries:
for $onedir in `ls /proc/acpi/battery |grep BAT` ...

up next: a bash script to write an xpm that displays a bar representation of percentage using percentage, & maybe{width, height, foreground, background}? but moving it to the bash library thread in "programming"

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send_private_message 
jemimah


Joined: 26 Aug 2009
Posts: 4309
Location: Tampa, FL

PostPosted: Thu 29 Apr 2010, 14:22    Post_subject:  

Apm is like old-school acpi. Your battery code would only work on newer laptops. http://tldp.org/HOWTO/Battery-Powered/powermgm.html
Back to top
View user's profile Send_private_message Visit_website 
Display_posts:   Sort by:   
Page 3 of 3 Posts_count   Goto page: Previous 1, 2, 3
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Utilities
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0543s ][ Queries: 13 (0.0068s) ][ GZIP on ]