Low-batt notification for Puppy? (Solved)
Xbatalarm combined with powerapplet_tray
Hi,
For those cannot get powerapplet_tray working, I referenced it in xbatalarm.
Among other changes, I applied new icons and forced the right one to appear in the tray.
Changed the default alarm level to 10%.
Tested in Puli, probably works for other puppies, too.
As powerapplet_tray is a built-in feature in many puplets, I also created a bare xbat-p.pet, see http://murga-linux.com/puppy/viewtopic. ... &start=154
Have fun!
Regards,
gjuhasz
Edit: first upload of the attachment failed, uploaded again.
Edit2: after bugfix, uploaded again
Edit3 on 29 Jan: after bugfix and some uplift, uploaded again. Thanks for the feedbacks.
For those cannot get powerapplet_tray working, I referenced it in xbatalarm.
Among other changes, I applied new icons and forced the right one to appear in the tray.
Changed the default alarm level to 10%.
Tested in Puli, probably works for other puppies, too.
As powerapplet_tray is a built-in feature in many puplets, I also created a bare xbat-p.pet, see http://murga-linux.com/puppy/viewtopic. ... &start=154
Have fun!
Regards,
gjuhasz
Edit: first upload of the attachment failed, uploaded again.
Edit2: after bugfix, uploaded again
Edit3 on 29 Jan: after bugfix and some uplift, uploaded again. Thanks for the feedbacks.
- Attachments
-
- xbat.pet
- MD5sum: 754de17b66e4578b661a233ae1d9018c
- (8.64 KiB) Downloaded 204 times
Last edited by gjuhasz on Sat 30 Jan 2016, 02:14, edited 7 times in total.
-
- Posts: 807
- Joined: Mon 12 Oct 2009, 17:11
- Mike Walsh
- Posts: 6351
- Joined: Sat 28 Jun 2014, 12:42
- Location: King's Lynn, UK.
Hi, B.K.
As far as I recall, the 'link' for batterup is that you need to request it from rcrsn51. Bill does things this way with a lot of the .pets that he creates, because it usually means that folk who do request an item are more likely to be serious about testing it out, and reporting back with results!
Hope that helps. Just drop him a request by PM if you'd like to try it out. That's usually all it takes. Be patient; it may take him a little while to get back to you.
Mike.
As far as I recall, the 'link' for batterup is that you need to request it from rcrsn51. Bill does things this way with a lot of the .pets that he creates, because it usually means that folk who do request an item are more likely to be serious about testing it out, and reporting back with results!
Hope that helps. Just drop him a request by PM if you'd like to try it out. That's usually all it takes. Be patient; it may take him a little while to get back to you.
Mike.
-
- Posts: 807
- Joined: Mon 12 Oct 2009, 17:11
Mike Walsh wrote:
With apologies to the iconic quote from W.P. Kinsella's Field of Dreams: "If you build it, he will come."
Bill, "If you build it, they will come." "If you expose it, they will hear of it[find it]; don't and it stays hidden."
It's not the puppy forum way....Bill does things this way with a lot of the .pets that he creates, because it usually means that folk who do request an item are more likely to be serious about testing it out, and reporting back with results!
With apologies to the iconic quote from W.P. Kinsella's Field of Dreams: "If you build it, he will come."
Bill, "If you build it, they will come." "If you expose it, they will hear of it[find it]; don't and it stays hidden."
Sure clears the air. Thanks Mike. Had you not made reference to batterup, nobody would have heard of it. It seems you were invited via PM to try it. Perhaps protocol would dictate that your test reports should have also been made in private. Naughty Mike! (kidding of course) As my lappy isn't working at the moment, no PM to Bill. I would not want to upset him by taking too long to report results. I'll just make a note in my archives that batterup is available on request.Hope that helps. Just drop him a request by PM if you'd like to try it out. That's usually all it takes. Be patient; it may take him a little while to get back to you.
[color=blue]B.K. Johnson
tahrpup-6.0.5 PAE (upgraded from 6.0 =>6.0.2=>6.0.3=>6.0.5 via quickpet/PPM=Not installed); slacko-5.7 occasionally. Frugal install, pupsave file, multi OS flashdrive, FAT32 , SYSLINUX boot, CPU-Dual E2140, 4GB RAM[/color]
tahrpup-6.0.5 PAE (upgraded from 6.0 =>6.0.2=>6.0.3=>6.0.5 via quickpet/PPM=Not installed); slacko-5.7 occasionally. Frugal install, pupsave file, multi OS flashdrive, FAT32 , SYSLINUX boot, CPU-Dual E2140, 4GB RAM[/color]
- Mike Walsh
- Posts: 6351
- Joined: Sat 28 Jun 2014, 12:42
- Location: King's Lynn, UK.
Hi again, BK.
http://www.murga-linux.com/puppy/viewtopic.php?t=91019
.....and it's in the 'Utilities' section, right where you'd expect to find it. He's not hiding the fact that it exists; just being selective about who gets to test it, that's all. Makes sense to pick folks who are more likely to report back, I would have thought. But that's just me.
Some people just have their eccentricities; that's the way Bill prefers to do it.....seems to work well enough. He has made a lot of very useful contributions to the Forums, there's no denying that. I, myself, am using at least 7 of his pets that I can think of off the top of my head; all small, but very useful 'utilities' of various sorts.....that have made Puppy even more usable, if that's possible..!
Mike.
Well, I wouldn't exactly say it's hidden.....after all, there is a thread about it in plain sight on the forum:-B.K.Johnson wrote:It's not the puppy forum way.
With apologies to the iconic quote from W.P. Kinsella's Field of Dreams: "If you build it, he will come."
Bill, "If you build it, they will come." "If you expose it, they will hear of it[find it]; don't and it stays hidden."
http://www.murga-linux.com/puppy/viewtopic.php?t=91019
.....and it's in the 'Utilities' section, right where you'd expect to find it. He's not hiding the fact that it exists; just being selective about who gets to test it, that's all. Makes sense to pick folks who are more likely to report back, I would have thought. But that's just me.
Some people just have their eccentricities; that's the way Bill prefers to do it.....seems to work well enough. He has made a lot of very useful contributions to the Forums, there's no denying that. I, myself, am using at least 7 of his pets that I can think of off the top of my head; all small, but very useful 'utilities' of various sorts.....that have made Puppy even more usable, if that's possible..!
Mike.
xbat and acpitool
G'day gjuhasz, I tried your xbat-p.pet on an ASUS X555L laptop with Xanad's T64_Light-k_4.1.3 EmSee_x86-64 an Italian version derived from 666philb's Tahrpup64, It works very well, great job, Bravo.
The only drawback is that the icon of powerapplet in the tray remains the default (same with xbat.pet).
I have a request it's possible to modify xbat so as to suspend the laptop with acpitool's -s option when it reaches to a particular discharge percentage and to include this option in the xbatalarm-config?
Regards.
corvus
The only drawback is that the icon of powerapplet in the tray remains the default (same with xbat.pet).
I have a request it's possible to modify xbat so as to suspend the laptop with acpitool's -s option when it reaches to a particular discharge percentage and to include this option in the xbatalarm-config?
Regards.
corvus
[b]We are waves of the same sea, leaves of the same tree, flowers of the same garden.[/b]
Here is a modified version that tries to care for battery and emit a xmessage GUI
of /sbin/pup_event_frontend_d .
It is still the old script style, not the current binary exe.
I attach it to give you an idea .
If you want to install it, you may get problems even if set executable .
You can test it by pup_event_frontend_d restart option .
In the editor search for lines containing "BAT_0_CURRENT" .
The idea occured to me to check for battery inside pup_event_frontend_d, since it also
checks for the POWERTIMEOUT variable set in /etc/eventmanager .
If pup_event_frontend_d checks for mousecounts, it could also check for battery status .
of /sbin/pup_event_frontend_d .
It is still the old script style, not the current binary exe.
I attach it to give you an idea .
If you want to install it, you may get problems even if set executable .
You can test it by pup_event_frontend_d restart option .
In the editor search for lines containing "BAT_0_CURRENT" .
The idea occured to me to check for battery inside pup_event_frontend_d, since it also
checks for the POWERTIMEOUT variable set in /etc/eventmanager .
If pup_event_frontend_d checks for mousecounts, it could also check for battery status .
- Attachments
-
- pup_event_frontend_d.gz
- heavily modified
- (13.81 KiB) Downloaded 230 times
«Give me GUI or Death» -- I give you [[Xx]term[inal]] [[Cc]on[s][ole]] .
Macpup user since 2010 on full installations.
People who want problems with Puppy boot frugal :P
Macpup user since 2010 on full installations.
People who want problems with Puppy boot frugal :P
Re: xbat and acpitool
Dear corvus,corvus wrote:The icon of powerapplet in the tray remains the default (same with xbat.pet). I have a request it's possible to modify xbat so as to suspend the laptop with acpitool's -s option when it reaches to a particular discharge percentage and to include this option in the xbatalarm-config?
Hm... I created xbat.pet to force tray icon based visualization - but tested with 32-bit puplets only on Dell and HP laptops. The icon changes according to the (dis)charging level going thru all statuses (see icons at /usr/share/pixmaps/puppy).
Please give me some time to check with a 64-bit puplet (possibly slacko64). Also, I will play with acpitool -s option, first in 32-bit version.
Have fun!
Regards,
gjuhasz
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
Re: Xbatalarm combined with powerapplet_tray
What exactly is the difference between the original powerapplet_tray and the one you packed into the pet?gjuhasz wrote:For those cannot get powerapplet_tray working, I referenced it in xbatalarm.
Among other changes, I applied new icons and forced the right one to appear in the tray
The original icons were quite ugly, but your binary appears to contain no icons at all. After starting the binary it runs in the tray, but the spot remains blank. I see that the accompanying script xbatalarm links to the binary and that they work together, but if I understand the script correctly it kills and restarts the binary every 30sec. which I find a bit rough. I would prefer to use a nicer looking, stand-alone powerapplet_tray. Are you planning to add icons?
Evening, all.
And thank you for your interest to my request.
I thought of something simple like:
thanks again.
corvus
And thank you for your interest to my request.
I thought of something simple like:
to be included somewhere in xbatalarm and its entry to xbatalarm.confSUSP_MARK=$(echo "$LAST_F_CHRG * $SUSP_PERC / 100" | bc) # with $SUSP_PERC entry in xbatalarm.conf
if (( $(bc <<< "$REAL_CHRG < $SUSP_MARK") )); then
acpitool -s &
fi
thanks again.
corvus
[b]We are waves of the same sea, leaves of the same tree, flowers of the same garden.[/b]
Re: Xbatalarm combined with powerapplet_tray
Oops... I found an earlier, buggy version at the link I advertised. The correct version is uploaded as http://www.smokey01.com/gjuhasz/packages/xbat.petMochiMoppel wrote:What exactly is the difference between the original powerapplet_tray and the one you packed into the pet?
...
After starting the binary it runs in the tray, but the spot remains blank
Now, the battery status is visualized by the tray icon and the warning message pops up repeatedly when 10% or less capacity remained.
After installed, you can activate it either by clicking on the xbatalarm menu item or by restarting X. Next time it will auto-start.
Sorry for the inconvenience.
The redesigned icons are in /usr/share/pixmaps/puppy folder.The original icons were quite ugly, but your binary appears to contain no icons at all. ... Are you planning to add icons?
You are right. But it is intentional. I recognized that the binary powerapplet_tray fails to point dynamically to the right icon (so it is unable to mirror the actual battery status) but did not modify it. Instead, I only regularly provide the binary with the right picture behind the fixed blank.svg filenameI see that the accompanying script xbatalarm links to the binary and that they work together, but if I understand the script correctly it kills and restarts the binary every 30sec. which I find a bit rough. I would prefer to use a nicer looking, stand-alone powerapplet_tray.
Just one note: I only check the status instead of restarting the binary in every 30 sec... restarting happens only if a new picture shall be displayed.
Have fun!
Regards,
gjuhasz
- Attachments
-
- Newicons.jpg
- (19.85 KiB) Downloaded 407 times
Re: xbat and acpitool
Well,gjuhasz wrote:Please give me some time to check with a 64-bit puplet (possibly slacko64).
the powerapplet_tray binary fails to work in Slacko 64 either, but performs it differently.
I plan to fix it as soon as I have time. However, for enthusiasts who want to see a dynamically changing powerapplet_tray icon in Slacko64, here is the list of steps (after installed my xbat.pet which works fine for 32-bit puplets such as Tahr 6.0.5):
- 1. Remove /usr/bin/powerapplet_tray installed with my my xbat.pet and restore the original one from /initrd/pup_ro2/usr/bin
2. Move my new icons from /usr/share/pixmaps/puppy to /usr/share/powerapplet
3. Temporarily, change the theme in Slacko64 to any other one
4. Restart X
5. Set up the previous theme
Have fun!
Regards,
gjuhasz
Re: xbat and acpitool
[url=https://sourceforge.net/projects/puppyrusa/]PuppyRus-Arch[/url]
Re: xbat and acpitool
Please find my first attempt to suspend the machine at http://smokey01.com/gjuhasz/packages/xbat-s.petcorvus wrote:I have a request it's possible to modify xbat so as to suspend the laptop with acpitool's -s option when it reaches to a particular discharge percentage and to include this option in the xbatalarm-config?
Please notice that this is for test purposes that suspends the machine just a couple of minutes after the low-batt warning.
Please take a look at Lines 15-16 in /usr/bin/xbatalarm script:
Code: Select all
ALRM_MARK=$(echo "$LAST_F_CHRG * $ALRM_PERC / 100" | bc)
SUSP_MARK=$(echo "$LAST_F_CHRG * $ALRM_PERC / 101" | bc)
Code: Select all
ALRM_MARK=$(echo "$LAST_F_CHRG * $ALRM_PERC / 100" | bc)
SUSP_MARK=$(echo "$LAST_F_CHRG * $ALRM_PERC / 150" | bc)
- 1. Install xbat-s.pet. Ensure that the charger is disconnected and no USB sticks remain mounted.
2. In a terminal, issue acpi to see the actual battery percentage.
3. From the System menu, run xbatalarm-config and set the actual acpi battery percentage as alarm level.
4. Check the alerts displayed (in each 30 seconds about low batt level)
5. Wait some minutes until the hibernation alert arrives. The machine is hibernated in 10 seconds, the (machine-specific) LED slowly blinks.
6. Connect the charger.
7. To wake up the machine, shortly press the power button (in most cases, this contains the slowly blinking LED). The machine should wake up then show the previously seen graphical content of X in a few seconds.
- 1. If you do not connect the charger while the machine is hibernated, it will be hibernated again, just after you wake the machine up.
2. If hibernation happens during high CPU/memory usage, the machine may not wake up (needs to be rebooted by long pressing the power button).
3. If there is a write process to the pendrive, data can be lost or even its filesystem can be damaged.
Also, I am interested in your opinion about the best hibernation risk policy. That is, forcing some pre-emptive commands that admit some smaller issues to avoid the bigger problems. For example, force unmount of all devices, exit running programs, exit to prompt (closing X), etc., may cause loss of the latest session's data but prevents data loss in the "innocent" filesystem(s).
Thanks in advance
Have fun!
Regards,
gjuhasz
Hi gjuhasz, I tested xbat-s, now the powerapplet icons are displayed correctly. I followed your instructions step by step, with my frugal installation booted via USB pendrive, but when xbat has tried to suspend the system it has restarted X.
After several tests I realized that your acpitool binary has a wrong ELFCLASS (it's not 64 bit) so I replaced it with the right one, downloaded from PPM, and it worked.
I need more time to test it better. I thank you for the time and effort in improving this tool.
Regards,
corvus
After several tests I realized that your acpitool binary has a wrong ELFCLASS (it's not 64 bit) so I replaced it with the right one, downloaded from PPM, and it worked.
I need more time to test it better. I thank you for the time and effort in improving this tool.
Regards,
corvus
[b]We are waves of the same sea, leaves of the same tree, flowers of the same garden.[/b]
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
Re: Xbatalarm combined with powerapplet_tray
I'm afraid notgjuhasz wrote:Just one note: I only check the status instead of restarting the binary in every 30 sec... restarting happens only if a new picture shall be displayed.
This happens every 30sec when AC is plugged in and battery is fully charged (code line 41), i.e. even during a time when no new icon needs to be displayed:.
Code: Select all
cp /usr/share/pixmaps/puppy/charged.svg /usr/share/pixmaps/puppy/blank.svg
sync
killall -9 powerapplet_tray; sync ;powerapplet_tray &
Re: Xbatalarm combined with powerapplet_tray
Fixed. Dear MochiMoppel, thanks for the notification.MochiMoppel wrote:That's a lot of copying and killing and resurrenction.
I uploaded three xbat flavors to http://www.smokey01.com/gjuhasz/packages
- 1. xbat.pet - 32-bit tray binary included
2. xbat-p.pet - for Puli users. No tray binary (thus hopefully compatible with 64-bit Slacko, too)
3. xbat-s.pet - my 2nd attempt to correctly suspend the machine. Same as xbat-p above, with additional suspend feature.
No tray binary either. Works without acpitool on the laptops I have access to.
Known issue: If a USB stick remained plugged in (even if unmounted), some laptops rise from sleep after 2-3 seconds.
Dear corvus - could you please check the new xbat-s? Here, with reference to my above post, I apply a realistic preset
Code: Select all
SUSP_MARK=$(echo "$LAST_F_CHRG * $ALRM_PERC / 150" | bc)
- where it is better to temporarily change the value from 150 to 101 for testing purposes. Also, in the updated /usr/bin/suspend script, I commented out the acpitool call in favor of the simpler method in the next line - you can switch back if necessary.
I understand that adding a $SUSP_PERC entry to xbatalarm.conf is more elegant but some additional hint or constraint
(e.g., 5 < $SUSP_PERC < $ALRM_PERC ) shall be applied in this case to help novice users.
Regards,
gjuhasz
Hi gjuhasz, I did several tests with xbat-s.pet, works fine but on one occasion at wake up the system crashed with the following error:
With the above settings and default xbatalarm-config my system went into suspension around the 5%.
The new string, for suspension, did not affect the overall functions I still enjoyed the choice of using acpitool.
Great work, thanks.
corvus
and I made a forced restart to fix the system.puppypc1672 login: [drm: gen8_irq_handler [i915]] * ERROR * the master control interrupt lied (SDE)
Code: Select all
SUSP_MARK=$(echo "$LAST_F_CHRG * $ALRM_PERC / 150" | bc)
The new string, for suspension, did not affect the overall functions I still enjoyed the choice of using acpitool.
Great work, thanks.
corvus
[b]We are waves of the same sea, leaves of the same tree, flowers of the same garden.[/b]
I recently changed my pupversion & liked everything except the included powerapplet_tray, which didn'r seem to reflect my laptop's real battery state.
So i'm happy I came across sfs's link for cbatticon, which is easy to compile, accurately reflects battery state, and with which you can have a script in /root/Startup with something like:
where it will warn you when percentage gets to 10, then poweroff at 5%.
So i'm happy I came across sfs's link for cbatticon, which is easy to compile, accurately reflects battery state, and with which you can have a script in /root/Startup with something like:
Code: Select all
cbatticon -l 10 -r 5 -c wmpoweroff
Last edited by muggins on Sat 10 Feb 2018, 21:35, edited 1 time in total.
Hello, muggins, I am interested in this battery app, but can not compile it, as I have always compiled sources starting with - "./configure --prefix=/usr"muggins wrote:I recently changed my pupversion & liked everything except the included powerapplet_tray, which didn'r seem to reflect my laptop's real battery state.
So i'm happy I came across sfs's link for cbatticon, which is easy to compile, accurately reflects battery state, and with which you can have a script in /root/Startup with something like:
where it will warn you when percentage gets to 10, then poweroff at 5%.Code: Select all
cbatticon -l 10 -r 5 -c wmrpoweroff
and it did not work with this cbatticon source.
Would you, please, post your comp. recipe for this app.?
btw, I'm using xenial-7.5 & slacko-6999, if that matters any.
Thank you
bliss,
festus