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 Tue 21 Oct 2014, 11:54
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Unsorted
Battery Monitoring Dotpup for JWM
Moderators: deshlab, Flash, GuestToo, Ian, JohnMurga, Lobster
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 6 of 6 Posts_count   Goto page: Previous 1, 2, 3, 4, 5, 6
Author Message
setecio

Joined: 01 Nov 2006
Posts: 326
Location: UK

PostPosted: Thu 12 Apr 2007, 17:01    Post_subject:  

Certainly, I'll watch the post for a few days, so post if you want any more info / terminal results / details ...... (just give me beginner instructions.) I wasn't sure whether conky worked or not - I just couldn't see anything referring to 'battery' anywhere ? If it was hidden somewhere? One reading on conky, MPD, said MPD not responding, I'm not sure what that means ?

sh-3.00# apm
sh: apm: command not found
sh-3.00# ls /proc/apm
/proc/apm
sh-3.00#

How can I easily confirm if the laptop uses ACPI or APM ?
Back to top
View user's profile Send_private_message 
HairyWill


Joined: 26 May 2006
Posts: 2949
Location: Southampton, UK

PostPosted: Thu 12 Apr 2007, 18:04    Post_subject:  

[quote="setecio"]One reading on conky, MPD, said MPD not responding, I'm not sure what that means ?[/qote]I think that stands for Music Player Daemon
http://www.musicpd.org/
this isn't included in vanilla puppy and I don't think I've ever seen a dotpup / pet for it
Quote:
sh-3.00# ls /proc/apm
/proc/apm
sorry I think I meant
Code:
cat /proc/apm

Quote:
How can I easily confirm if the laptop uses ACPI or APM ?

As you have a file /proc/apm I think you can assume apm support. My laptop does acpi and has a directory in /proc called acpi with a whole load of files inside containing system info.

_________________
Will
contribute: community website, screenshots, puplets, wiki, rss
Back to top
View user's profile Send_private_message 
setecio

Joined: 01 Nov 2006
Posts: 326
Location: UK

PostPosted: Thu 12 Apr 2007, 19:00    Post_subject:  

Battery is now low

sh-3.00# cat /proc/apm
1.16ac 1.2 0x03 0x00 0x02 0x04 3% 3 min
sh-3.00#
Back to top
View user's profile Send_private_message 
HairyWill


Joined: 26 May 2006
Posts: 2949
Location: Southampton, UK

PostPosted: Thu 12 Apr 2007, 20:32    Post_subject:  

thanks for that

After I posted last a light bulb came on in my head.
Just because I have acpi it doesn't mean I have to use it.
I changed my kernel boot parameters to include
acpi=off apm=on
and bingo I'm now using apm. For test purposes only as acpi is much more powerful.
so on battery I get
Code:
sh-3.00# cat /proc/apm
1.16ac 1.2 0x03 0x00 0x00 0x01 55% 29 min
and on charge I get
Code:
sh-3.00# cat /proc/apm                     
1.16ac 1.2 0x03 0x01 0x03 0x09 52% -1 ?
For the record I didn't need to modprobe apm the module was loaded automatically.
_________________
Will
contribute: community website, screenshots, puplets, wiki, rss

Edited_time_total
Back to top
View user's profile Send_private_message 
HairyWill


Joined: 26 May 2006
Posts: 2949
Location: Southampton, UK

PostPosted: Thu 12 Apr 2007, 21:27    Post_subject:  

To make batmon work for apm try replacing the contents of /root/my-applications/bin/batmon.sh with the following. Leaving Brads copyright intact of course.
Code:
per=`awk '{print $7}' /proc/apm | awk -F % '{print $1}'`

if [ $per -lt "6" ]; then
        if [ "`cat /tmp/batmon.warn.txt | grep warned`" == "" ]; then
                Xdialog --msgbox "WARNING! Your battery is low." 0 0 &
                echo "warned" >> /tmp/batmon.warn.txt
        fi     
fi

if [ $per -gt "5" ]; then
        rm /tmp/batmon.warn.txt 2> /dev/null
fi

if [ `awk '{print $8}' /proc/apm` -gt 0 ]
then
        acon="-"
else
        acon="+"
fi

echo -n "${acon}${per}%"
To make a batmon that supports apm and acpi just requires a test for /proc/apm or /proc/acpi before deciding which code to use.
_________________
Will
contribute: community website, screenshots, puplets, wiki, rss
Back to top
View user's profile Send_private_message 
setecio

Joined: 01 Nov 2006
Posts: 326
Location: UK

PostPosted: Fri 13 Apr 2007, 03:52    Post_subject:  

Excellent. I saved a backup copy of existing batmon.sh as batmon.old, and replaced everything after the comments with your new code in the batmon.sh, and the battery level on the green batmon icon in the taskbar is now displaying a perfect % remaining figure.

Thanks for that. Very Happy

When I hover the mouse over it, a little box appears with 'aasdf' in it. Can this be changed or stopped ?
Back to top
View user's profile Send_private_message 
brad_chuck

Joined: 15 Aug 2005
Posts: 284
Location: Appalachian Mountains

PostPosted: Fri 13 Apr 2007, 19:00    Post_subject:  

Great work HairyWill and setecio.

Next time I get to it I will make this an option in the batmonsetup.sh program and then folks with APM can use batmon without all this hassle.

I tried sed last night and gave up. Perhaps I should learn awk.....

Anyway thanks for the code.
Back to top
View user's profile Send_private_message 
gdemonta


Joined: 19 Feb 2007
Posts: 190
Location: Paris, France

PostPosted: Fri 11 May 2007, 04:02    Post_subject:  

Hello Brad_chuck,
I tried batmon a few days ago and I got the famous %- problem. Yesterday I noticed the line I had previously added to automatically mount one of my partition didn't function either since that day (I know I'm a bit slow...).
I went to the rc.local file and, wow, I found the batmon line your script added fot modprobing battery had benn added in the same line as my automount! So i just pulsed "enter" to separate both lines and I got the batmon working and my automount working again. It works great!
I also wanted to point out for the icewm users to edit preference in root/.icewm ant activate taskbarAPM something in order to show the batmon.

_________________
Dumbledore: "The evidence of the Dark Lord's return is incontrovertible"
IBM X31 - Puppy 2.16 Hard disk install with EZpup
Back to top
View user's profile Send_private_message 
Kezo

Joined: 24 Jan 2008
Posts: 4
Location: Hungary

PostPosted: Thu 24 Jan 2008, 15:19    Post_subject:  

Dear all,

I just started to use Puppy3.01 on a FujitsuSiemens K7610W laptop. I made batmon visible on the tray and it shows the good percentage of the battery but if I move the mouse above the tray it shows the "aasdf" which is weird to me...
I would appreciate if anyone had a good idea what to do!

BTW, this is the first Linux what I brave enough to try, but I really like it!
Back to top
View user's profile Send_private_message 
MichelC

Joined: 26 Feb 2008
Posts: 1

PostPosted: Tue 26 Feb 2008, 09:35    Post_subject: Batmon does not work with 2 batteries  

I run Puppy Linux 3.01 on a Compaq Armada laptop. Batmon used to work perfectly until I add a second battery. I then got -% in the tray.
Running batmon.sh in a terminal window gives the error :
--------------
/usr/local/bin/batmon.sh: line 18: let: per=((2885
2655*100)/(2885
2655)): missing `)' (error token is "2655*100)/(2885
2655))")
---------------
I look at the script and the tmp files and made the following changes to the script to add the values of the two batteries :
--------------
for a in `ls`
do
rc1="`cat /proc/acpi/battery/$a/state | grep "remaining capacity:" | sed -n 's/remaining capacity: //p' | sed -n 's/ m[A-Z]h//p'`"
cap1="`cat /proc/acpi/battery/$a/info | grep "last full cap" | sed -n 's/last full capacity: //p' | sed -n 's/ m[A-Z]h//p'`"
rc="($rc+$rc1)"
cap="($cap+$cap1)"
done
echo $rc >> /tmp/batmon.rc
echo $cap >> /tmp/batmon.cap
----------------
I now get what seems to be ok. I am not a Linux programmer and would like to know if my changes are valid and is there a better way to do it.

Thanks
Back to top
View user's profile Send_private_message 
raffy

Joined: 25 May 2005
Posts: 4775
Location: Manila

PostPosted: Tue 26 Feb 2008, 10:37    Post_subject: hexedit  

setecio wrote:
When I hover the mouse over it, a little box appears with 'aasdf' in it. Can this be changed or stopped ?

You can use hexedit to find and change it.
Back to top
View user's profile Send_private_message 
whatshisname

Joined: 11 May 2008
Posts: 22

PostPosted: Sat 21 Nov 2009, 16:30    Post_subject:  

Been trying for a couple of days to get some kind of battery monitoring working with my ancient Dell Inspiron 2600 laptop. Running 4.3.1 Puppy. Previous versions of Puppy worked. Oddly, though, I've tried loading some livecd's of older versions of Puppy and they all present the contents of "/proc/apm" as indicated below.

Have to boot with "acpi=off".

No matter whether the laptop is plugged in or not, "cat /proc/apm" yields:

# more /proc/apm
1.16ac 1.2 0x03 0x01 0xff 0x80 -1% -1 ?

Unless I can get something besides the above, no battery watching script is going to work.

I've tried "modprobe apm" to make sure the module is loaded. Still no joy.

Suggestions anyone?

Thanks.
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 6 of 6 Posts_count   Goto page: Previous 1, 2, 3, 4, 5, 6
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Unsorted
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.1153s ][ Queries: 13 (0.0396s) ][ GZIP on ]