Battery Monitoring Dotpup for JWM
-
- Posts: 195
- Joined: Sat 21 Jan 2006, 05:35
- Location: Bedfordshire, UK
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
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
Strange that you don't get BAT0. That should be your main battery.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#
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
Methinks Raspberry Pi were ideal for runnin' Puppy Linux
-
- Posts: 622
- Joined: Wed 05 Apr 2006, 20:43
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 as being the main battery, rather than assuming BAT0.
I guess one needs to take the first entry returned from
Code: Select all
ls /proc/acpi/battery/
-
- Posts: 286
- Joined: Tue 16 Aug 2005, 03:47
- Location: Appalachian Mountains
The script does this
Rickrandom, can you type
and post the output?
Then for all the files in that dir type
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 ?????
Code: Select all
ls /proc/acpi/battery/BAT1
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 ?????
-
- Posts: 195
- Joined: Sat 21 Jan 2006, 05:35
- Location: Bedfordshire, UK
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#
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#
-
- Posts: 286
- Joined: Tue 16 Aug 2005, 03:47
- Location: Appalachian Mountains
try this
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
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.
Try one more thing.......
reboot and use
Code: Select all
insmod battery
insmod ac
What version of Puppy are you using?
Thank you for your patience.
-
- Posts: 195
- Joined: Sat 21 Jan 2006, 05:35
- Location: Bedfordshire, UK
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.
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.
-
- Posts: 622
- Joined: Wed 05 Apr 2006, 20:43
Re: The script does this
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!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 ?????
Cheers,
Mark
-
- Posts: 286
- Joined: Tue 16 Aug 2005, 03:47
- Location: Appalachian Mountains
Try this!
Rickrandom, You almost have me stumped. 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...
Just a note I have batmon-0.1.0 80% done.
Then boot and try the batmon-0.0.2.tar.gz
Report results...
Just a note I have batmon-0.1.0 80% done.
Re: Try this!
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.
-
- Posts: 286
- Joined: Tue 16 Aug 2005, 03:47
- Location: Appalachian Mountains
hi kirka
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.
I have not put this into dotpup format yet because I don't think it is ready.
Yep, I missed line. Sorry.Use the instructions to install it.
Now it switches between free memory and a long line of strange symbols.
/proc/acpi/battery/BAT0/state:
I liked your original batmon with the seperate tray display. Could you re-post it?present: yes
capacity state: ok
charging state: charging
present rate: unknown
remaining capacity: 33310 mWh
present voltage: 16886 mV
Thanks
-
- Posts: 286
- Joined: Tue 16 Aug 2005, 03:47
- Location: Appalachian Mountains
yes
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.
I also prefer the no switching... This is the one I am using now.
-
- Posts: 286
- Joined: Tue 16 Aug 2005, 03:47
- Location: Appalachian Mountains
a quick fix...
On most batterys there is a number
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?
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?
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.
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.
-
- Posts: 286
- Joined: Tue 16 Aug 2005, 03:47
- Location: Appalachian Mountains
new dotpup
New dotpup see main post.
(batmon0.0.7.pup)
(batmon0.0.7.pup)