Battery Monitoring Dotpup for JWM
-
- Posts: 286
- Joined: Tue 16 Aug 2005, 03:47
- Location: Appalachian Mountains
Thanks
Thanks it will take me a few days... I have a lot to do this weekend.
I think the best way to do it it to is like this
Then the script would do something like
I think the best way to do it it to is like this
Code: Select all
script.sh | executable
Code: Select all
while [ 1 ];do
echo "#000000"
echo "#ffffff"
echo "`batmon.sh`"
sleep 10
echo "#000000"
echo "#ffffff"
echo "`freemem.sh`"
sleep 10
done
-
- Posts: 286
- Joined: Tue 16 Aug 2005, 03:47
- Location: Appalachian Mountains
This should work for you
When I get the above idea working you can set it up however you like...
For now this is an exe that does not change.. it just stays on battery.
For now this is an exe that does not change.. it just stays on battery.
- Attachments
-
- noswapbatmon.tar.gz
- (8.51 KiB) Downloaded 574 times
Thanks, brad_chuck!
batmon.pup 0.2 works great with Puppy 2.12beta on my Dell Inspiron 510m laptop.
Here is a hack of batmon.sh to display the CPU temperature. Useful for seeing the effect of running CPU frequency scaling or for monitoring cooling status.
Requires: modprobe thermal to work.
Could also be used alternating: freemem/battery charge/CPU temp
Note that the $a variable is necessary. The folder name varies from machine to machine. On my Dell 510m it is THM, on a Thinkpad it is THM0.
Paul
batmon.pup 0.2 works great with Puppy 2.12beta on my Dell Inspiron 510m laptop.
Here is a hack of batmon.sh to display the CPU temperature. Useful for seeing the effect of running CPU frequency scaling or for monitoring cooling status.
Requires: modprobe thermal to work.
Could also be used alternating: freemem/battery charge/CPU temp
Code: Select all
#!/bin/sh
#batmon.sh hack for displaying CPU temperature, by pakt
cd /proc/acpi/thermal_zone/
for a in `ls`
do
if [ "`grep C /proc/acpi/thermal_zone/$a/temperature`" != "" ]; then
temp="`cat /proc/acpi/thermal_zone/$a/temperature | grep "temperature:" | sed -n 's/temperature: //p'`"
fi
done
echo -n "${temp}"
Paul
- Attachments
-
- batmon_temp.png
- batmon.sh hacked to show CPU temp
- (2.29 KiB) Downloaded 1859 times
Methinks Raspberry Pi were ideal for runnin' Puppy Linux
-
- Posts: 195
- Joined: Sat 21 Jan 2006, 05:35
- Location: Bedfordshire, UK
I still have the -% displayed, with version 0.2 (I think - I'm not very good with tar and all that stuff ). It swaps between free memory and the -%, so I assume that it's v0.2.
Does this mean anything from typing batmon.sh?
/usr/local/bin/batmon.sh: line 19: let: per=((*100)/()): syntax error: operand expected (error token is "*100)/())")
Anyway, a couple of comments:
1. As any such feature takes up some screen space, I'd suggest it doesn't display the decimal place or MB, just M, for the free memory. 123M is plenty, 123.2MB takes up a bit more space, but seems unnecessary.
2. I'd agree with a previous poster, that swapping is less preferable to one fixed display. (I guess it sort of contradicts my other comment!)
Thinking further ahead, would it be possible for batmon to also perform a graceful shutdown if the % gets below a threshold? I usually use my laptop on mains power, but have left it on battery once or twice and found it dead when I've come back. Thus it hasn't saved to disk, so there is a risk of losing stuff.
Does this mean anything from typing batmon.sh?
/usr/local/bin/batmon.sh: line 19: let: per=((*100)/()): syntax error: operand expected (error token is "*100)/())")
Anyway, a couple of comments:
1. As any such feature takes up some screen space, I'd suggest it doesn't display the decimal place or MB, just M, for the free memory. 123M is plenty, 123.2MB takes up a bit more space, but seems unnecessary.
2. I'd agree with a previous poster, that swapping is less preferable to one fixed display. (I guess it sort of contradicts my other comment!)
Thinking further ahead, would it be possible for batmon to also perform a graceful shutdown if the % gets below a threshold? I usually use my laptop on mains power, but have left it on battery once or twice and found it dead when I've come back. Thus it hasn't saved to disk, so there is a risk of losing stuff.
I also got the '-%' until I remembered to 'modprobe battery' and 'modprobe ac'.Rickrandom wrote:I still have the -% displayed, with version 0.2 (I think - I'm not very good with tar and all that stuff ). It swaps between free memory and the -%, so I assume that it's v0.2.
The 'modprobe ac' is needed if you want the '-' sign to change to '+' when the laptop is running on ac power.
Hope that helps
Paul
Methinks Raspberry Pi were ideal for runnin' Puppy Linux
-
- Posts: 195
- Joined: Sat 21 Jan 2006, 05:35
- Location: Bedfordshire, UK
-
- 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.