Skip to contentSkip to conversation

system call to check battery energy?

DISCUSSION Vinod 2 participants 2 messages Jul 11, 2005

lore
Share & tools
lore

Vinod

author
#0 lore raw

Hi All.

Would anyone know if i could make a simple system call and find the battery energy remaining?

I am relatively new to linux, but i have uncovered that apm and acpi are power management tools. trying apm gives me the lifetime ,not in terms of energy say in terms of mAh. acpi on the other hand does seem(havent tried it yet) to give me values in terms of energy. But i was wondering if there is a way i can just do a system call and find the energy value than having to configure acpi. Would appreciate any pointers.

Thanks,
Vinod

____________________________________________________
Sell on Yahoo! Auctions – no fees. Bid on great items.
http://auctions.yahoo.com/
-
To unsubscribe from this list: send the line "unsubscribe linux-laptop" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#1 lore raw

Hi Vinod,

Quoted 4 lines

Hi All.

Would anyone know if i could make a simple system call and find the battery energy remaining?

You could read the file "/proc/apm". The number with the "%" after it is the battery level. The two hex numbers before it are flags, such as whether or not AC power is present, etc. You could either read the doc, read the Kernel source, etc. to determine the meanings of these flags or experiment.

Quoted 10 lines

I am relatively new to linux, but i have uncovered that apm and acpi are power management tools. trying apm gives me the lifetime ,not in terms of energy say in terms of mAh. acpi on the other hand does seem(havent tried it yet) to give me values in terms of energy. But i was wondering if there is a way i can just do a system call and find the energy value than having to configure acpi. Would appreciate any pointers.

Quoted 2 lines

Thanks,
Vinod

Best regards,

Bob Toxen, CTO
Fly-By-Day Consulting, Inc.
d/b/a Horizon Network Security
"Your expert in Firewalls, Virus and Spam Filters, VPNs, Network Monitoring, and Network Security consulting"

http://www.verysecurelinux.com [Network & Linux/Unix Security Consulting]
http://www.realworldlinuxsecurity.com [My 5* book: "Real World Linux Security"]
http://www.verysecurelinux.com/sunset.html [Sunset Computer]
[email protected] (e-mail)