Need help with Linux and how much battery is left on laptop.

  • rjstephens
  • Professor
  • Professor
  • User avatar
  • Posts: 774
  • Loc: Brisbane, Australia

Post 3+ Months Ago

Ok Here's my problem. I finally put linux on my laptop, after searching for hours for a way to shrink the win2k partition. Trouble is, when I'm running linux I have no indication of how much battery my laptop has remaining. I know i can type apm at the prompt, but i want something that tells me while i'm running KDE/GNOME. How can I get something that will give me this info?

It's a IBM thinkpad T20 with Red Hat 9. Thanks.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Nego
  • Expert
  • Expert
  • User avatar
  • Posts: 697
  • Loc: Chicago

Post 3+ Months Ago

Im almost possitive that redhat has available software on their site, just do a search related to your problem they should have some type of software that will show your battery's current level.
  • Axe
  • Genius
  • Genius
  • User avatar
  • Posts: 5739
  • Loc: Sub-level 28

Post 3+ Months Ago

Yeah, or just check the usual places..

http://www.sourceforge.net
http://www.freshmeat.net
  • Daemonguy
  • Moderator
  • Web Master
  • User avatar
  • Posts: 2700
  • Loc: Somewhere outside the box in Sarasota, FL.

Post 3+ Months Ago

Red Hat distribution comes with APM, and I think they are integrating ACPI. However, what you are asking for is a constant display, and to the best of my knowledge no distro does that from the CLI.
Yes, yes, I know. I bet you use the standard GUI -- oi. :)

If you are using KDE, there is a battery monitor built in. You can enable it in the KDE control center under Laptop and Battery, found in the Power and Control section.

Click "Show battery monitor". As long as you have APM compiled in your kernel, you should be good to go.

Cheers.
  • rjmthezonenet
  • Expert
  • Expert
  • User avatar
  • Posts: 526
  • Loc: St. John's, Newfoundland, Canada

Post 3+ Months Ago

Hmmm... that would be a nice thing to add to the shell prompt.
  • Daemonguy
  • Moderator
  • Web Master
  • User avatar
  • Posts: 2700
  • Loc: Somewhere outside the box in Sarasota, FL.

Post 3+ Months Ago

rjmthezonenet wrote:
Hmmm... that would be a nice thing to add to the shell prompt.

Not really certain how feasible that would be. Forgetting for a moment that you would have to read in the scripted output of a interval based check, it would have to re-write the present line or print a newline with the updated prompt every x seconds -- as determined by the interval. This would of course be a problem to data entry on the CLI if your prompt kept jumping around. :)

Cheers.
  • rjmthezonenet
  • Expert
  • Expert
  • User avatar
  • Posts: 526
  • Loc: St. John's, Newfoundland, Canada

Post 3+ Months Ago

Daemonguy wrote:
This would of course be a problem to data entry on the CLI if your prompt kept jumping around.


no no, the current prompt would display the most recent data. Why change a prompt that a user isn't following?
  • Daemonguy
  • Moderator
  • Web Master
  • User avatar
  • Posts: 2700
  • Loc: Somewhere outside the box in Sarasota, FL.

Post 3+ Months Ago

rjmthezonenet wrote:
Daemonguy wrote:
This would of course be a problem to data entry on the CLI if your prompt kept jumping around.


no no, the current prompt would display the most recent data. Why change a prompt that a user isn't following?


Yes, but then if you expected updates in real time, or at least when the data changed, the current prompt would need to be overwritten or a new prompt displayed.

We *are* talking about a CLI to the box in question, yes? Not some GUI window running console?

Cheers.
  • rjmthezonenet
  • Expert
  • Expert
  • User avatar
  • Posts: 526
  • Loc: St. John's, Newfoundland, Canada

Post 3+ Months Ago

Realtime updates aren't practical for a CLI, with the exception of a program running in the foreground (eg. top). In that case, the prompt would not be available. Furthermore, battery life is measured in hours so realtime reportings would be excessive. I'm talking about each new prompt displaying the most recent statistics.

Another scenario would be writing warning to the console when a threshold has been reached (eg. shutdown).
  • Daemonguy
  • Moderator
  • Web Master
  • User avatar
  • Posts: 2700
  • Loc: Somewhere outside the box in Sarasota, FL.

Post 3+ Months Ago

rjmthezonenet wrote:
Realtime updates aren't practical for a CLI, with the exception of a program running in the foreground (eg. top). In that case, the prompt would not be available. Furthermore, battery life is measured in hours so realtime reportings would be excessive. I'm talking about each new prompt displaying the most recent statistics.

Another scenario would be writing warning to the console when a threshold has been reached (eg. shutdown).


I believe we have a mis-communication here, so I will clarify my aforementioned position.

Yes, you are correct that CLI updates are not practical for the prompt. (You can run realtime code in the background -- stats/metrics gathering etc. -- with an output to a real-time front end user application, obviously.)

You *can* rewrite the prompt, though if you note I was making the point that it would severely hinder one's progress, and therefore would be, as you state, impractical.

I believe you are mistaken as to the measurement of battery life; it is not merely measured in hours, instead there are quite a few data points one can extract from the apm command interface.

Code: [ Select ]
tulku# apm
APM version: 1.2
APM Management: Disabled
AC Line status: on-line
Battery status: charging
Remaining battery life: 96%
Remaining battery time: unknown
Number of batteries: 2
Battery 0:
    Battery status: charging
    Remaining battery life: 100%
    Remaining battery time: 0:00:00
Battery 1:
    Battery status: not present
Resume timer: unknown
Resume on ring indicator: disabled
APM Capabilities:
    unknown
tulku#

  1. tulku# apm
  2. APM version: 1.2
  3. APM Management: Disabled
  4. AC Line status: on-line
  5. Battery status: charging
  6. Remaining battery life: 96%
  7. Remaining battery time: unknown
  8. Number of batteries: 2
  9. Battery 0:
  10.     Battery status: charging
  11.     Remaining battery life: 100%
  12.     Remaining battery time: 0:00:00
  13. Battery 1:
  14.     Battery status: not present
  15. Resume timer: unknown
  16. Resume on ring indicator: disabled
  17. APM Capabilities:
  18.     unknown
  19. tulku#


Now I have it disabled on this laptop in favor of ACPI, however, if it was enabled there would be even more information that what is showing. It's a simple matter to parse through with an awk and use whichever output one desired in whatever capacity one desired.
I am not sure which laptop you have, but both of mine chew through battery power like a 9 year old through a bag of cookies. I can watch my battery monitor in KDE show the life drain away while in the airport in no time flat. ;)

If you wanted to send console messages, it would be simple enough to cron up an hourly check, or run a daemon that monitored for threshold, then posted. When I do use X, I have the graphical battery monitor, and I rarely use a console on my laptop/desktop systems. I have some custom monitors in place for security issues which notify me in other ways, so I never felt the need for a 'console' window.

Cheers.

Post Information

  • Total Posts in this topic: 10 posts
  • Users browsing this forum: No registered users and 26 guests
  • 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 post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.