LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Laptop and Netbook
User Name
Password
Linux - Laptop and Netbook Having a problem installing or configuring Linux on your laptop? Need help running Linux on your netbook? This forum is for you. This forum is for any topics relating to Linux and either traditional laptops or netbooks (such as the Asus EEE PC, Everex CloudBook or MSI Wind).

Notices


Reply
  Search this Thread
Old 10-26-2006, 07:26 AM   #1
Siva4Linux
Member
 
Registered: Sep 2006
Posts: 31
Blog Entries: 1

Rep: Reputation: 15
Remaining Battery Energy/Lifetime Detection


Hello there,

I am wondering whether there exists any way for me to periodically estimate the remaining battery energy level of a notebook running FC 5. Let me put it in a different way. Suppose that a notebook is disconnected from the main
power supply and hence it relies on its remaining battery energy for its operation. For my protocol to work, it needs to periodically check the power level, and if a notebook has sufficient energy only, it can be used. Having explained the requirement, my question now is how to access/grab such
low-level information under Fedora Core 5.

Thanks in advance for taking your invaluable time to answer my question.

Cheers

Siva
===============================
Dr. Siva Sivavakeesar
 
Old 10-26-2006, 08:25 AM   #2
Lenard
Senior Member
 
Registered: Dec 2005
Location: Indiana
Distribution: RHEL/CentOS/SL 5 i386 and x86_64 pata for IDE in use
Posts: 4,790

Rep: Reputation: 57
Have a look at the cat /proc/acpi/battery/BATX/state[and info] files where X can be 0 or better.
 
Old 10-27-2006, 03:00 AM   #3
Siva4Linux
Member
 
Registered: Sep 2006
Posts: 31

Original Poster
Blog Entries: 1

Rep: Reputation: 15
Thanks for your information. Do you think getting the information through HAL is efficient ?
 
Old 12-19-2006, 03:23 AM   #4
Siva4Linux
Member
 
Registered: Sep 2006
Posts: 31

Original Poster
Blog Entries: 1

Rep: Reputation: 15
Dear All,

I have been trying to let my Routing protocol that runs as a daemaon in the user-space open and read the "state" file that appears under the directory /proc/acpi/battery/BATO/ in FC5 (I am not sure whether I can call it as a file per se). As you know, my objective is to read the remaining life-time of a battery by manipulating the rate
at which current is drawn and the total capacity. However, I find it difficult to open the required file/device probably because system continuously writes into "state" and as a result another thread cannot open it simultaneously. I have tried with fopen() and open() - both of them didn't work.

Does anybody have an idea as to how I can get around with this problem ?

Thanks in advance for taking your invaluable time to answer my question.

Best Regards,

Siva
 
Old 12-19-2006, 04:47 AM   #5
Lenard
Senior Member
 
Registered: Dec 2005
Location: Indiana
Distribution: RHEL/CentOS/SL 5 i386 and x86_64 pata for IDE in use
Posts: 4,790

Rep: Reputation: 57
Have a look at the acpitool package, from man acpitool;

Code:
DESCRIPTION
       acpitool is a Linux ACPI client. It simply reads /proc/acpi entries and
       presents the output in a meaningfull, human-readable format.

       It  provides  a.o.  information on battery status, AC adapter presence,
       thermal reading, etc. This command is most useful on  laptops  with  an
       ACPI compliant BIOS and a Linux kernel, preferably from the 2.6 series,
       with ACPI enabled.
The source code could prove helpful.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Solutions for the Energy Crises -- Part 1: Alternate Energy and Conservation LXer Syndicated Linux News 0 02-03-2006 10:16 AM
Wireless mouse battery level detection? daihard Linux - Hardware 2 09-27-2005 04:04 AM
How to check the remaining battery power in linux icoming Linux - Laptop and Netbook 2 10-14-2004 03:51 AM
Lifetime membership Dirty_Ink Linspire/Freespire 7 05-12-2004 11:41 PM
RedHat 9 on Dell inspiron 2650 : Battery Remaining spawgi Linux - Newbie 1 03-14-2004 05:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Laptop and Netbook

All times are GMT -5. The time now is 11:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration