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 Wed 20 Jun 2018, 06:10
All times are UTC - 4
 Forum index » Advanced Topics » Puppy Derivatives
Battery protection in Carolina (Carolite 2)?
Moderators: Flash, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [7 Posts]  
Author Message
Mike7


Joined: 18 Feb 2013
Posts: 394

PostPosted: Tue 01 May 2018, 09:23    Post subject:  Battery protection in Carolina (Carolite 2)?  

Hi, guys.

I'm adding a new battery to my Asus eeepc 1000HA, and I ran into a snag. I need some advice from more-experienced users or developers.

I charged the battery up all the way, then unplugged power and started working it down slowly (I thought). At around 15% capacity left (according to vattery) and just an Internet radio station playing, I had to run next door for a semi-emergency. I should have quickly put it into snooze (Ctrl-F1), but I didn't. I figured that Carolite/Carolina (and Puppy in general) had a battery cutout or shutdown at a safe point, 10% or 5%. (Note: I don't use battery power very often.)

When I got back to the computer a half hour later it was completely shut off, and when I powered up again the battery meter said "Charging.1%".

So, did the op sys let the battery run all the way down? Or did it cut out before that (at 10%) and the battery meter reading is wrong? If the battery was allowed to run down too far, has it been severely damaged?

Does this mean that Carolina/Carolite has no battery protection, and I have to eyeball-monitor battery discharge from now on?

Helpful answers will be greatly appreciated.

Mike7

_________________
Carolite-1.2 w/FF38 on bootable 16G flash drive; Asus eeePC 1000HA, Atom CPU, 2G RAM, 160G HDD.
Back to top
View user's profile Send private message 
Mike7


Joined: 18 Feb 2013
Posts: 394

PostPosted: Thu 03 May 2018, 13:12    Post subject:  

On a second discharge I monitored vattery as it got low and saw that there is a small pop-up box that notifies you when the battery is down to 10% (and, I assume, when it gets down to 5%). But you have to be watching the screen at that precise moment or it passes you by.

Isn't there a built-in utility that cuts out the battery (snooze state?) when it gets too low? Or an add-on that will do this?

How about a little help from the forum with this mundane but important issue?

Thanks in advance.

Mike7

_________________
Carolite-1.2 w/FF38 on bootable 16G flash drive; Asus eeePC 1000HA, Atom CPU, 2G RAM, 160G HDD.
Back to top
View user's profile Send private message 
festus


Joined: 14 Jan 2015
Posts: 185

PostPosted: Thu 03 May 2018, 13:32    Post subject:  

Hello, Mike7

I do not know if it'll work with Carolina, but take a look here:
http://www.murga-linux.com/puppy/viewtopic.php?t=100492&start=30

bliss,
festus
Back to top
View user's profile Send private message 
Moat


Joined: 16 Jul 2013
Posts: 842
Location: Mid-mitten, USA

PostPosted: Thu 03 May 2018, 14:07    Post subject:  

Maybe try "xfce4-power-manager", if installed (or install it, as part of the "Xfce Goodies" tray utilities);

http://goodies.xfce.org/projects/applications/xfce4-power-manager

I believe this should give you the low battery/shutdown/hibernate/etc control you're looking for...

Bob
Back to top
View user's profile Send private message 
drunkjedi


Joined: 24 May 2015
Posts: 897

PostPosted: Thu 03 May 2018, 14:35    Post subject:  

If there's a small popup message at 10% and 5%.

Then that same script which gives those message can be modified to suspend/shutdown.....
No need for extra softwares.

Now what script makes those popups?

Edit: In Fatdog there's a Batt-low.sh in usr/bin. I don't have a laptop so never tested this.

It shuts down pc when battery is low it also checks if adapter is connected and doesn't shutdown if it is.
Code:
#!/bin/dash
FONT="10x20"
FLAG=/tmp/batt-low
SAFE_SHUTDOWN_CAPACITY=2
SAFE_SHUTDOWN_FLAG=/tmp/batt-low-monitor

### helpers

# check if ac adapter is attached
is_online() {
   grep -q on-line /proc/acpi/ac_adapter/*/state ||
   grep -q 1 /sys/class/power_supply/*/online
}

# get remaining capacity
getcap() {
   cat /sys/class/power_supply/*/capacity  | head -n 1
}

# monitor battery and shutdown safely is battery is too low
safe_shutdown() {
   [ -f $SAFE_SHUTDOWN_FLAG ] && exit # only run one instance
   > $SAFE_SHUTDOWN_FLAG
   while ! is_online; do
      if [ $(getcap) -lt $SAFE_SHUTDOWN_CAPACITY ]; then
         poweroff noprompt
         exit
      fi
      sleep 5 # batt is already low, don't waste more by checking too often
   done
   rm -f $SAFE_SHUTDOWN_FLAG
   exit
}


############# main ############

# no warning needed if AC adapter is attached
is_online && exit

# type of message
case $1 in
   critical)
      TYPE=critical
      MG=50 BG=red FG=white TEXT="Battery is critical, shutdown imminent.\nAttach charger now."
      safe_shutdown &
      ;;
   low|*)
      TYPE=low
      MG=30 BG=yellow FG=black TEXT="Battery is low.\nPlease attach charger."
      ;;      
esac

# only show the message once
FLAG=$FLAG-$TYPE
[ -f $FLAG ] && exit
> $FLAG

# display
if type yaf-splash > /dev/null; then
   # preferred UI
   TEXT=$(printf "$TEXT\n\nClick here to remove this message.")
   yaf-splash -font "$FONT" -outline 0 -margin $MG -bg $BG -fg $FG -text "$TEXT"
else
   # alternative UI
   Xdialog --title "Battery Low" --msgbox "$(printf "$TEXT")" 0 0
fi

# cleanup
rm -f $FLAG
Back to top
View user's profile Send private message 
mistfire

Joined: 04 Nov 2008
Posts: 893
Location: PH

PostPosted: Thu 03 May 2018, 18:33    Post subject:  

try cbatticon
Back to top
View user's profile Send private message 
Mike7


Joined: 18 Feb 2013
Posts: 394

PostPosted: Thu 03 May 2018, 23:28    Post subject:  

Hi, all.

cbatticon is not in Carolite, and the battery monitor which is there - vattery - seems to work fine to monitor battery percentage. If cbatticon also shuts off power at a critical low battery discharge percent, that might help to save the battery, but it won't save my work. What I want is to suspend at low battery (10%), with a poweroff at critical battery (5%). I've tested it, and the eeepc hardware suspend permits very little battery drain, so work would be saved for hours before poweroff.

As regards xfce4-power-manager, the Asus eeepc already has a power manager, the "ACPI Tool", with its associated panel item which allows manually switching between Powersave, Performance, and Turbo, or alternatively automatically monitors the power sources and adjusts power usage. I suppose this ACPI Tool also works together with vattery ("vattery-acpitool 0.7"), but how it does that I don't know. Anyway, I don't think it makes sense to add a new power manager when there already is one. They're sure to conflict.

I searched the operating system with the word "batt". There were no .sh files associated with it. The only file I found in the search results that looked vaguely like a battery-related power control was:

/root/.config/xfce4/panel/battery-7.rc

Code:
display_label=false
display_icon=true
display_power=false
display_percentage=false
display_bar=false
display_time=false
tooltip_display_percentage=true
tooltip_display_time=false
low_percentage=10
critical_percentage=5
action_on_low=1
action_on_critical=1
hide_when_full=0
colorA=#8888FF
colorH=#00FF00
colorL=#FFFF00
colorC=#FF0000
command_on_low=
command_on_critical=


Is it possible that a sleep/suspend command could be put into the next-to-last line, and a poweroff command in the last line? If so, what would the commands be?

OTOH, the vattery interface itself has slots for commands at battery low and critical, so if I knew what the sleep/suspend and poweroff commands were maybe I could just slot them in (see attached screenshot) or add them to the vattery config file:

/root/.config/vattery-acpitool/config

Code:
[colors]
charging=#0000ff
draining=#ff0000
background=#ffffff
border=#000000

[percents]
warning=10
critical=5

[commands]
warning=Xdialog --title 'Battery Alert' --msgbox 'Battery is very low' 0 0
critical=Xdialog --title 'Battery Alert' --msgbox 'Battery is critically low' 0 0


Does anyone know what pressing Fn<>F1 on the eeepc actually does, or what file in Carolina, if any, will duplicate the eeepc's hardware sleep/suspend?

Mike7
vattery panel interface screenshot.png
Description 
png

 Download 
Filename  vattery panel interface screenshot.png 
Filesize  68.89 KB 
Downloaded  44 Time(s) 

_________________
Carolite-1.2 w/FF38 on bootable 16G flash drive; Asus eeePC 1000HA, Atom CPU, 2G RAM, 160G HDD.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [7 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Puppy Derivatives
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0723s ][ Queries: 14 (0.0067s) ][ GZIP on ]