Author Topic: Checking battery status?  (Read 8372 times)

0 Members and 1 Guest are viewing this topic.

Offline Joe

  • B&
  • x86
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Checking battery status?
« on: January 07, 2007, 09:26:07 pm »
Yeah -- I'm running Slackware.. uh.. 10.1, I think?

joe@religone:~$ uname -a
Linux religone 2.4.31 #6 Sun Jan 5 19:04:47 PDT 2005 i686 unknown unknown GNU/Linux


I'm using a ThinkPad 600, and I was just wondering if theres any easy way to check my battery percentage / status? Thanks!
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline rabbit

  • x86
  • Hero Member
  • *****
  • Posts: 8092
  • I speak for the entire clan (except Joe)
    • View Profile
Re: Checking battery status?
« Reply #1 on: January 07, 2007, 10:02:06 pm »
"acpi -b" or "cat /proc/acpi/battery/BAT0/state"

Offline Joe

  • B&
  • x86
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: Checking battery status?
« Reply #2 on: January 07, 2007, 10:11:07 pm »
joe@religione:~$ acpi -b
-bash: acpi: command not found
joe@religione:~$ cat /proc/acpi/battery/BAT0/state
cat: /proc/acpi/battery/BAT0/state: No such file or directory
joe@religione:~$
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: Checking battery status?
« Reply #3 on: January 07, 2007, 10:30:29 pm »
Like I said, you need to compile your kernel with acpi.

Offline Joe

  • B&
  • x86
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: Checking battery status?
« Reply #4 on: January 07, 2007, 10:36:50 pm »
Like I said, you need to compile your kernel with acpi.

God damn do I have a short attention span. :P

How do I do that? :)
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: Checking battery status?
« Reply #5 on: January 07, 2007, 11:03:06 pm »
Look around on google... it's a pretty long process.

Offline Ergot

  • 吴立峰 ^_^ !
  • x86
  • Hero Member
  • *****
  • Posts: 3724
  • I steal bandwidth. p_o
    • View Profile
Re: Checking battery status?
« Reply #6 on: January 08, 2007, 02:09:42 am »
Look around on google... it's a pretty long process.
Bull, kernel (re-)compile has gotten stupid easy since 2.6.x.

make menuconfig
Select need stuffs (this is the tricky part)
make
make modules_install
cp arch/i386/boot/bzImage /boot/NAMEGOESHERE

Don't forget to update/run lilo if you're using that.
Who gives a damn? I fuck sheep all the time.
And yes, male both ends.  There are a couple lesbians that need a two-ended dildo...My router just refuses to wear a strap-on.
(05:55:03) JoE ThE oDD: omfg good job i got a boner thinkin bout them chinese bitches
(17:54:15) Sidoh: I love cosmetology

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: Checking battery status?
« Reply #7 on: January 08, 2007, 03:25:16 am »
Yeah, but that "tricky" part can take a really long time for someone who doesn't have much experience compiling a kernel.  It took me two days to get a 2.6 kernel working on my laptop, but I think that's largely because it's a new laptop and Linux drivers were somewhat hard to find and they took more configuration and setup than I was familiar with.  I had a really hard time getting ALSA working properly.  In fact, I don't think I ever got it working 100% the way I wanted it to.  I think I posted something about a headphones jack here.

Just because you can compress the process into a vague, step-by-step list doesn't mean that it's always a trivial task...
« Last Edit: January 08, 2007, 11:17:08 pm by Sidoh »

Offline Joe

  • B&
  • x86
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: Checking battery status?
« Reply #8 on: January 08, 2007, 10:56:54 pm »
Look around on google... it's a pretty long process.
Bull, kernel (re-)compile has gotten stupid easy since 2.6.x.

make menuconfig
Select need stuffs (this is the tricky part)
make
make modules_install
cp arch/i386/boot/bzImage /boot/NAMEGOESHERE

Don't forget to update/run lilo if you're using that.

What folder do you do all that in?
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline rabbit

  • x86
  • Hero Member
  • *****
  • Posts: 8092
  • I speak for the entire clan (except Joe)
    • View Profile
Re: Checking battery status?
« Reply #9 on: January 08, 2007, 11:02:40 pm »
....

That's rebuilding the kernel.  You download the source and unpack it.  That's the folder you do it it..

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: Checking battery status?
« Reply #10 on: January 09, 2007, 07:46:36 pm »
Before anything, try "modprobe battery" then the "cat" that was posted. 

<edit>
ron@slayer:~$ cat /proc/acpi/battery/C11F/state
cat: /proc/acpi/battery/C11F/state: No such file or directory
ron@slayer:~$ sudo modprobe battery
ron@slayer:~$ cat /proc/acpi/battery/C11F/state
present:                 yes
capacity state:          ok
charging state:          discharging
present rate:            1488 mA
remaining capacity:      4543 mAh
present voltage:         14158 mV

I don't think I have ACPI support compiled in.

Offline Joe

  • B&
  • x86
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: Checking battery status?
« Reply #11 on: January 11, 2007, 12:01:54 am »
Ron and I went through and installed Slack's out-of-the-box 2.6 kernel.

cat /proc/acpi/battery/BAT0/state works for me. I don't know what the hell a C11F is.
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline Newby

  • Moderator
  • Hero Member
  • *****
  • Posts: 10877
  • Thrash!
    • View Profile
Re: Checking battery status?
« Reply #12 on: January 11, 2007, 01:23:08 am »
Ron and I went through and installed Slack's out-of-the-box 2.6 kernel.

cat /proc/acpi/battery/BAT0/state works for me. I don't know what the hell a C11F is.

The idea behind a kernel is you customize it to meet the needs of your box. Otherwise your kernel has bloat and un-necessary crap.

And lol, aren't you glad Windows just tells you what percent of your battery is left? FreeBSD's apm does that too.
- Newby
http://www.x86labs.org

Quote
[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

I'd bet that you're currently bloated like a water ballon on a hot summer's day.

That analogy doesn't even make sense.  Why would a water balloon be especially bloated on a hot summer's day? For your sake, I hope there wasn't too much logic testing on your LSAT. 

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: Checking battery status?
« Reply #13 on: January 11, 2007, 01:34:17 am »
The idea behind a kernel is you customize it to meet the needs of your box. Otherwise your kernel has bloat and un-necessary crap.

And lol, aren't you glad Windows just tells you what percent of your battery is left? FreeBSD's apm does that too.

Yeah, it's things like this that discourage me from using Linux.  As much as I like it, I can never last long using it on my workstation.

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: Checking battery status?
« Reply #14 on: January 11, 2007, 08:35:16 am »
Uhm, you realize you're reading the battery's signal directly from the kernel, right?  There's front-end programs that "just tells you what percent of your battery is left", but they use the same raw data.  The difference is, on Windows you aren't allowed to see it :P

Offline Newby

  • Moderator
  • Hero Member
  • *****
  • Posts: 10877
  • Thrash!
    • View Profile
Re: Checking battery status?
« Reply #15 on: January 11, 2007, 10:10:09 am »
Uhm, you realize you're reading the battery's signal directly from the kernel, right?  There's front-end programs that "just tells you what percent of your battery is left", but they use the same raw data.  The difference is, on Windows you aren't allowed to see it :P

Totally off-topic and I don't wanna drag this away from the original point, but yes, we know; the average user doesn't know how to read that and just wants "%" left. I wager Joe is/was one of those people.
- Newby
http://www.x86labs.org

Quote
[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

I'd bet that you're currently bloated like a water ballon on a hot summer's day.

That analogy doesn't even make sense.  Why would a water balloon be especially bloated on a hot summer's day? For your sake, I hope there wasn't too much logic testing on your LSAT. 

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: Checking battery status?
« Reply #16 on: January 11, 2007, 01:48:56 pm »
Uhm, you realize you're reading the battery's signal directly from the kernel, right?  There's front-end programs that "just tells you what percent of your battery is left", but they use the same raw data.  The difference is, on Windows you aren't allowed to see it :P

I'm well aware that there are front ends.

No, the difference is I had to go through this trouble to be able to see it in Linux.

Offline nslay

  • Hero Member
  • *****
  • Posts: 786
  • Giraffe meat, mmm
    • View Profile
Re: Checking battery status?
« Reply #17 on: January 11, 2007, 03:27:02 pm »
The idea behind a kernel is you customize it to meet the needs of your box. Otherwise your kernel has bloat and un-necessary crap.

And lol, aren't you glad Windows just tells you what percent of your battery is left? FreeBSD's apm does that too.

Yeah, it's things like this that discourage me from using Linux.  As much as I like it, I can never last long using it on my workstation.

It felt that way with FreeBSD until I discovered freshports.org ... this is a very easy-to-use website that searches the ports system for you (There is a make search but not nearly as nice).  While it shows the port's description and so forth, it also shows you vulnerabilities or breakages (if any) and the maintenance history.  A site like this beats google since it is tailored specifically for applications that are ported and known to work on FreeBSD, their problems, and maintenance history.  Maybe there is site like this for Slackware or Linux in a broader sense?  I know Gentoo has such a directory for its portage.

Misc sites:
http://www.freshports.org/ (nice web interface to ports)
http://www.freebsd.org/ports/ (web interface to ports)
http://pointyhat.freebsd.org/ (ports compilation/testing cluster)

An adorable giant isopod!

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: Checking battery status?
« Reply #18 on: January 11, 2007, 03:55:19 pm »
That's great (really, it is).  However, it's the fact that I have to go through this sort of trouble just to check the battery status.  It's not just this.  There are tons of trivial little things like this that add up frustration.  I like Linux (I know you don't, but I can't say anything about FreeBSD because I've never used it).  I've had it on my server for a number of years and have absolutely no plan to change that.

I can usually work myself through a given problem with linuxquestions, google and a few other references (like iago and Newby, but I usually consult them as a last resort.  being bothered constantly would be annoying, right, guys? :P).  I know that I'd get used to it and that I'd eventually come to ignore things like this, but until I see a significant advantage to using something other than windows on my workstation, I'm going to continue to do so.  I'm not trying to turn this into a debate and I'm not trying to be defensive; I'm just trying to convey my point.

I'm just saying I'd rather use Windows on my workstation (this includes my laptops) and have things "just work" without going through this sort of trouble.

Offline nslay

  • Hero Member
  • *****
  • Posts: 786
  • Giraffe meat, mmm
    • View Profile
Re: Checking battery status?
« Reply #19 on: January 11, 2007, 05:11:01 pm »
That's great (really, it is).  However, it's the fact that I have to go through this sort of trouble just to check the battery status.  It's not just this.  There are tons of trivial little things like this that add up frustration.  I like Linux (I know you don't, but I can't say anything about FreeBSD because I've never used it).  I've had it on my server for a number of years and have absolutely no plan to change that.

I can usually work myself through a given problem with linuxquestions, google and a few other references (like iago and Newby, but I usually consult them as a last resort.  being bothered constantly would be annoying, right, guys? :P).  I know that I'd get used to it and that I'd eventually come to ignore things like this, but until I see a significant advantage to using something other than windows on my workstation, I'm going to continue to do so.  I'm not trying to turn this into a debate and I'm not trying to be defensive; I'm just trying to convey my point.

I'm just saying I'd rather use Windows on my workstation (this includes my laptops) and have things "just work" without going through this sort of trouble.

Yeah, I dislike certain aspects of Linux, but it has its advantages.  I'm not sure what kind of trouble it is to check the battery or enable battery checking in Linux, but I tend to use wmbatteries to monitor my battery.  KDE offers a KLaptop Daemon, and I am sure Gnome has one too.
As to FreeBSD, if you have ACPI, the battery life can be queried through sysctl and the battery information can be queried through acpiconf.  APM has an apmconf command ... but I rarely have to do this checking from the command line.  ACPI is enabled on FreeBSD out of the box on systems that support it ... I imagine this is true on Linux too.

To those interested/curious:

Here's an example of checking battery life in FreeBSD with ACPI. 

Quote
%sysctl hw.acpi
hw.acpi.supported_sleep_state: S3 S4 S5
hw.acpi.power_button_state: S5
hw.acpi.sleep_button_state: S3
hw.acpi.lid_switch_state: NONE
hw.acpi.standby_state: S1
hw.acpi.suspend_state: S3
hw.acpi.sleep_delay: 3
hw.acpi.s4bios: 0
hw.acpi.verbose: 0
hw.acpi.reset_video: 1
hw.acpi.cpu.cx_supported: C1/1 C2/1 C3/85
hw.acpi.cpu.cx_lowest: C1
hw.acpi.cpu.cx_usage: 100.00% 0.00% 0.00%
hw.acpi.thermal.min_runtime: 0
hw.acpi.thermal.polling_rate: 10
hw.acpi.thermal.tz0.temperature: 50.0C
hw.acpi.thermal.tz0.active: -1
hw.acpi.thermal.tz0.passive_cooling: 1
hw.acpi.thermal.tz0.thermal_flags: 0
hw.acpi.thermal.tz0._PSV: 94.5C
hw.acpi.thermal.tz0._HOT: -1
hw.acpi.thermal.tz0._CRT: 99.0C
hw.acpi.thermal.tz0._ACx: -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
hw.acpi.battery.life: 100
hw.acpi.battery.time: -1
hw.acpi.battery.state: 0
hw.acpi.battery.units: 1
hw.acpi.battery.info_expire: 5
hw.acpi.acline: 1

Some of these values can be set while others are read-only for obvious reasons.

Here's an example to acquire battery information in FreeBSD.

Quote

%acpiconf -i 0
Design capacity:        77760 mWh
Last full capacity:     54560 mWh
Technology:             secondary (rechargeable)
Design voltage:         10800 mV
Capacity (warn):        2728 mWh
Capacity (low):         200 mWh
Low/warn granularity:   1 mWh
Warn/full granularity:  1 mWh
Model number:           IBM-92P1077
Serial number:            685
Type:                   LION
OEM info:               SANYO
State:                  high
Remaining capacity:     100%
Remaining time:         unknown
Present rate:           0 mW
Voltage:                12452 mV


Misc links:
An adorable giant isopod!

Offline Newby

  • Moderator
  • Hero Member
  • *****
  • Posts: 10877
  • Thrash!
    • View Profile
Re: Checking battery status?
« Reply #20 on: January 11, 2007, 06:15:40 pm »
I type "apm."
- Newby
http://www.x86labs.org

Quote
[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

I'd bet that you're currently bloated like a water ballon on a hot summer's day.

That analogy doesn't even make sense.  Why would a water balloon be especially bloated on a hot summer's day? For your sake, I hope there wasn't too much logic testing on your LSAT. 

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: Checking battery status?
« Reply #21 on: January 11, 2007, 08:23:48 pm »
Incidentally, if you install one of those commercial distros (Red Hat, Suse, Fedora, etc) on a laptop, you'll generally get a battery status automatically in KDE or Gnome. 

If you want your hand held (or at least, if you don't want to have to learn how things work), then don't use a distro like Slackware or Gentoo, and don't use FreeBSD -- they expect you to look after yourself a lot more.

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: Checking battery status?
« Reply #22 on: January 11, 2007, 08:45:55 pm »
Incidentally, if you install one of those commercial distros (Red Hat, Suse, Fedora, etc) on a laptop, you'll generally get a battery status automatically in KDE or Gnome. 

If you want your hand held (or at least, if you don't want to have to learn how things work), then don't use a distro like Slackware or Gentoo, and don't use FreeBSD -- they expect you to look after yourself a lot more.

I'm aware of that.  Like I said, this was a simple (probably bad) example. :P