Battery Monitoring Dotpup for JWM

Stuff that has yet to be sorted into a category.
Message
Author
User avatar
pakt
Posts: 1157
Joined: Sat 04 Jun 2005, 16:54
Location: Sweden

#31 Post by pakt »

Rickrandom, what do you get if you run:

# ls /proc/acpi/battery/

I get 'BAT0 BAT1'

If you get 'BAT0', then run:

# cat /proc/acpi/battery/BAT0/state

What does that show?
Methinks Raspberry Pi were ideal for runnin' Puppy Linux

Rickrandom
Posts: 195
Joined: Sat 21 Jan 2006, 05:35
Location: Bedfordshire, UK

#32 Post by Rickrandom »

I get:

sh-3.00# ls /proc/acpi/battery/
BAT1
sh-3.00# cat /proc/acpi/battery/BAT1/state
present: no
sh-3.00# cat /proc/acpi/battery/BAT01/state
cat: /proc/acpi/battery/BAT01/state: No such file or directory
sh-3.00#
sh-3.00# cat /proc/acpi/battery/BAT0/state
cat: /proc/acpi/battery/BAT0/state: No such file or directory
sh-3.00#

I managed to type BAT01 once

:?

User avatar
pakt
Posts: 1157
Joined: Sat 04 Jun 2005, 16:54
Location: Sweden

#33 Post by pakt »

Rickrandom wrote:I get:

sh-3.00# ls /proc/acpi/battery/
BAT1

sh-3.00# cat /proc/acpi/battery/BAT1/state
present: no

sh-3.00# cat /proc/acpi/battery/BAT0/state
cat: /proc/acpi/battery/BAT0/state: No such file or directory
sh-3.00#
Strange that you don't get BAT0. That should be your main battery.

Many laptops can be fitted with a second battery, e.g. in place of the CD drive to increase battery running time. I believe BAT1 is a reference to that second battery. In your case, as in most cases, it isn't present.

I really don't know why BAT0 doesn't show up. This is why you are getting '-%'.

This is what I get on my Dell Inspiron 510m:

Code: Select all

# ls /proc/acpi/battery/
BAT0  BAT1

# cat /proc/acpi/battery/BAT0/state
present:                 yes
capacity state:          ok
charging state:          charged
present rate:            unknown
remaining capacity:      32000 mWh
present voltage:         16157 mV

# cat /proc/acpi/battery/BAT1/state
present:                 no
Paul
Methinks Raspberry Pi were ideal for runnin' Puppy Linux

marksouth2000
Posts: 622
Joined: Wed 05 Apr 2006, 20:43

#34 Post by marksouth2000 »

One cannot assume that a sole battery will be BAT0. The machine I'm typing this from has one battery, listed as BAT1.

I guess one needs to take the first entry returned from

Code: Select all

ls /proc/acpi/battery/
as being the main battery, rather than assuming BAT0.

brad_chuck
Posts: 286
Joined: Tue 16 Aug 2005, 03:47
Location: Appalachian Mountains

The script does this

#35 Post by brad_chuck »

Rickrandom, can you type

Code: Select all

ls /proc/acpi/battery/BAT1
and post the output?

Then for all the files in that dir type

Code: Select all

cat /proc/acpi/battery/BAT1/filename

About your ideas... They sound great. When I get more work done all this can be done with a shell script.

It is bad when your are using a live CD because as of right now your laptop will just turn off! Ouch!




marksouth2000, That is what the script does now. Whatever the first dir in /proc/acpi/battery/ is the one that it uses. I also have BAT1 ?????

Rickrandom
Posts: 195
Joined: Sat 21 Jan 2006, 05:35
Location: Bedfordshire, UK

#36 Post by Rickrandom »

Ok, did as you asked, after a bit of mis-typing:

sh-3.00# modprobe battery
sh-3.00# ls /proc/acpi/battery
BAT1
sh-3.00# ls /proc/acpi/battery/BAT1
alarm info state
sh-3.00# cat /proc/acpi/battery/BAT1/alarm
present: no
sh-3.00# cat /proc/acpi/battery/BAT1/info
present: no
sh-3.00# cat /proc/acpi/battery/BAT1/state
present: no
sh-3.00# modprobe ac
sh-3.00# ls /proc/acpi/ac
ls: /proc/acpi/ac: No such file or directory
sh-3.00# ls /proc/acpi/ac_adaptor
ls: /proc/acpi/ac_adaptor: No such file or directory
sh-3.00# ls /proc/acpi/ac_adapter
ACAD
sh-3.00# ls /proc/acpi/ac_adaptor/ACAD
ls: /proc/acpi/ac_adaptor/ACAD: No such file or directory
sh-3.00# ls /proc/acpi/ac_adapter/ACAD
state
sh-3.00# cat /proc/acpi/ac_adapter/ACAD/state
state: off-line
sh-3.00#

brad_chuck
Posts: 286
Joined: Tue 16 Aug 2005, 03:47
Location: Appalachian Mountains

try this

#37 Post by brad_chuck »

Ok, well this means that your kernel module is not loading. So we need to work on that.

Try one more thing.......

reboot and use

Code: Select all

insmod battery
insmod ac
see if anything changes. When it works it will work so you can use batmon to test if your module is loaded. No need to type all that junk in the console.

What version of Puppy are you using?



Thank you for your patience.

Rickrandom
Posts: 195
Joined: Sat 21 Jan 2006, 05:35
Location: Bedfordshire, UK

#38 Post by Rickrandom »

sh-3.00# insmod battery
insmod: can't read 'battery': No such file or directory
sh-3.00# insmod ac
insmod: can't read 'ac': No such file or directory
sh-3.00# modprobe battery
sh-3.00# insmod battery
insmod: can't read 'battery': No such file or directory
sh-3.00# modprobe ac
sh-3.00# insmod ac
insmod: can't read 'ac': No such file or directory

I'm using Puppy 2.10, booting from CD, with a pupsave file on the NTFS hard drive.

If you want me to look in the BIOS or elsewhere for anything, let me know, but I've no idea what to look for.

marksouth2000
Posts: 622
Joined: Wed 05 Apr 2006, 20:43

Re: The script does this

#39 Post by marksouth2000 »

brad_chuck wrote:marksouth2000, That is what the script does now. Whatever the first dir in /proc/acpi/battery/ is the one that it uses. I also have BAT1 ?????
Thanks brad_chuck. It's very rare for my feedback ever to get an acknowledgement, let alone result in a change in the code, so I'm over the moon to hear this!

Cheers,
Mark 8)

brad_chuck
Posts: 286
Joined: Tue 16 Aug 2005, 03:47
Location: Appalachian Mountains

Try this!

#40 Post by brad_chuck »

Rickrandom, You almost have me stumped. :oops: But try to boot the CD with the startup option "puppy prefix=ram". If you can't do that make a new CD and boot that.

Then boot and try the batmon-0.0.2.tar.gz

Report results... :lol:



Just a note I have batmon-0.1.0 80% done.

amish
Posts: 615
Joined: Sun 24 Sep 2006, 23:15

Re: Try this!

#41 Post by amish »

sadly i'm not going to be able to test this, because i won't have access to the machine i did the script on. (my laptop has power management turned off)
sadly, it is not possible to separate politics from free software. free software - politics = unfree software.

kirk
Posts: 1553
Joined: Fri 11 Nov 2005, 19:04
Location: florida

#42 Post by kirk »

Tried batmon-0.0.2.tar.gz in 212beta2. Does not display in the tray, Shows up on the desktop.

brad_chuck
Posts: 286
Joined: Tue 16 Aug 2005, 03:47
Location: Appalachian Mountains

hi kirka

#43 Post by brad_chuck »

Yes, It will if you just run the exec. Check out the first post. Use the instructions to install it.

I have not put this into dotpup format yet because I don't think it is ready.

kirk
Posts: 1553
Joined: Fri 11 Nov 2005, 19:04
Location: florida

#44 Post by kirk »

Use the instructions to install it.
Yep, I missed line. Sorry. :oops:

Now it switches between free memory and a long line of strange symbols.

/proc/acpi/battery/BAT0/state:
present: yes
capacity state: ok
charging state: charging
present rate: unknown
remaining capacity: 33310 mWh
present voltage: 16886 mV
I liked your original batmon with the seperate tray display. Could you re-post it?

Thanks

brad_chuck
Posts: 286
Joined: Tue 16 Aug 2005, 03:47
Location: Appalachian Mountains

yes

#45 Post by brad_chuck »

Another user requested it a while back. It is posted about half way down on the second page of this "topic".

I also prefer the no switching... This is the one I am using now.

brad_chuck
Posts: 286
Joined: Tue 16 Aug 2005, 03:47
Location: Appalachian Mountains

a quick fix...

#46 Post by brad_chuck »

On most batterys there is a number

Lycanth
Posts: 9
Joined: Mon 13 Nov 2006, 01:20

#47 Post by Lycanth »

I have this half working [so to speak] it reads my second battery [after modprobing it manually at every boot] but it doesn't pick up my first, also I don't have those battery files in the /proc/acpi [though I'm not really worried about that] is it possible for it to pick up the power in both batteries? also insmod doesn't work either, it just says file/directory doesn't exsist, thinking I might have to copy some files from the CD to my hard drive

EDIT: got the files created and stuff, just the insmod comes up as none exsistant, and primary battery is detected, but there's no readout on it's remaining power, but it does report a remaining for my secondary battery if it's installed [either alone in the second slot or with the primary battery] is there a way of making puppy auto load the modprobes to save typing it in on each boot?

EDIT 2: ok, checked about a little and found out the following
BAT1 [secondary] detects battery presence, monitors state, displays remaining power for any battery inserted
BAT0 [primary] as above but doesn't show remaining power for any battery, am I the only one with that problem?

User avatar
peppyy
Posts: 443
Joined: Mon 27 Jun 2005, 23:49
Location: VT USA
Contact:

#48 Post by peppyy »

Works well on 2.0.1 ibm thinkpad t22. I don't need the freespace indicator there as much as I do the battery since I am using a hd install and have 4gb left. I will look at the switch and change it for my needs. It is a bit distracting when it resizes.

Nice job!
Puppy Linux...
It just works!

Braden
Posts: 69
Joined: Fri 22 Sep 2006, 20:39
Location: Waterloo, Ontario, Canada

#49 Post by Braden »

I couldn't get my system to modprobe ac, but there's a charging flag in the battery's state file.

I don't like the switching mode either, I'd rather have both the battery and the RAM-remaining displayed at once. Or better yet, have it change on clicks: power, RAM, and whatever other information we give it.

Would you consider releasing your source code? If you'd rather not release it, fine, but I think it would allow for better customization, and is more in the spirit of Puppy in particular and Linux in general. Dotpups are great for general users, but I imagine there's plenty of coders here who'd love to sink their teeth into the source and tweak it to their own preferences.

Maybe include some manner of control file, at least, allowing us to set the frequency of the switching, or disable the switching, or add new displays entirely, providing the name of a script to execute.

Also, if you have it reading that file entirely from inside your C code, there will be no easy way to handle slight differences in the battery and ac formats.

brad_chuck
Posts: 286
Joined: Tue 16 Aug 2005, 03:47
Location: Appalachian Mountains

new dotpup

#50 Post by brad_chuck »

New dotpup see main post.

(batmon0.0.7.pup)

Post Reply