≡ Menu

FreeBSD Laptop: Find Out Battery Life Status Command

I know how to find out battery life status using Linux operating system. How do I monitor battery status on a laptop running FreeBSD version 9.x?

You can use any one of the following commands to get battery status, remaining battery life and more:
Tutorial details
DifficultyEasy (rss)
Root privilegesNo
Requirementsamp/sysctl
hwstat
Estimated completion timeN/A

  1. apm command : The apm utility controls the Intel / Microsoft APM (Advanced Power Management) BIOS and displays the current status of APM on laptop PCs.
  2. sysctl command : The sysctl utility retrieves kernel state.
  3. hwstat command : Another command line tool to display CPU temp and battery info.
  4. acpiconf command : The acpiconf command allows the user control of the ACPI power management functions and query laptop battery status.

amp command example

The syntax is:

apm
apm [options]

Type the following command:
$ apm
Sample outputs:

Fig.01: FreeBSD apm command in action

Fig.01: FreeBSD apm command in action

sysctl command example

Type the following command:
$ sysctl hw.acpi.battery
Sample outputs:

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

hwstat command

The hwstat command is not part of the base system. Type the following command to install hwstat using pkg_add command:
# pkg_add -rv hwstat
Sample outputs:

 
scheme:   [ftp]
user:     []
password: []
host:     [ftp.freebsd.org]
port:     [0]
document: [/pub/FreeBSD/ports/amd64/packages-9.0-release/Latest/hwstat.tbz]
---> ftp.freebsd.org:21
looking up ftp.freebsd.org
connecting to ftp.freebsd.org:21
<<< 220 beastie.tdk.net FTP server (Version 6.00LS) ready.
 >>> USER anonymous
<<< 331 Guest login ok, send your email address as password.
 >>> PASS vivek@fdbsd9
<<< 230 Guest login ok, access restrictions apply.
 >>> PWD
<<< 257 "/" is current directory.
 >>> CWD pub/FreeBSD/ports/amd64/packages-9.0-release/Latest
<<< 250 CWD command successful.
 >>> MODE S
<<< 200 MODE S accepted.
 >>> TYPE I
<<< 200 Type set to I.
 setting passive mode
 >>> PASV
<<< 227 Entering Passive Mode (193,162,146,4,226,183)
 opening data connection
 initiating transfer
 >>> RETR hwstat.tbz
<<< 150 Opening BINARY mode data connection for 'hwstat.tbz' (8779 bytes).
 Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9.0-release/Latest/hwstat.tbz...Waiting for final status
 <<< 226 Transfer complete.
 x +CONTENTS
 x +COMMENT
 x +DESC
 x +MTREE_DIRS
 x bin/hwstat
 x share/licenses/hwstat-0.5.1/catalog.mk
 x share/licenses/hwstat-0.5.1/LICENSE
 x share/licenses/hwstat-0.5.1/BSD
 x man/man1/hwstat.1.gz
 tar command returns 0 status
  Done.
 extract: Package name is hwstat-0.5.1
 extract: CWD to /usr/local
 extract: /usr/local/bin/hwstat
 extract: /usr/local/share/licenses/hwstat-0.5.1/catalog.mk
 extract: /usr/local/share/licenses/hwstat-0.5.1/LICENSE
 extract: /usr/local/share/licenses/hwstat-0.5.1/BSD
 extract: /usr/local/man/man1/hwstat.1.gz
 extract: CWD to /usr/local
 Running mtree for hwstat-0.5.1..
 mtree -U -f +MTREE_DIRS -d -e -p /usr/local >/dev/null
Attempting to record package into /var/db/pkg/hwstat-0.5.1..
Package hwstat-0.5.1 registered in /var/db/pkg/hwstat-0.5.1
 

Type the following command to see CPU temperature and battery information under FreeBSD operating system:
$ hwstat
Sample outputs:

Fig.02: hwstat in action

Fig.02: hwstat in action

acpiconf command example

To see information about the specified battery, enter:
$ acpiconf -i batt#
$ acpiconf -i 0 | grep capacity
$ acpiconf -i 0

Sample outputs:

Design capacity:	50000 mWh
Last full capacity:	50000 mWh
Technology:		secondary (rechargeable)
Design voltage:		10000 mV
Capacity (warn):	100 mWh
Capacity (low):		50 mWh
Low/warn granularity:	1 mWh
Warn/full granularity:	1 mWh
Model number:		1
Serial number:		0
Type:			VBOX
OEM info:		innotek
State:			high
Remaining capacity:	100%
Remaining time:		unknown
Present rate:		0 mW
Present voltage:	10000 mV
Tweet itFacebook itGoogle+ itPDF itFound an error/typo on this page?

{ 0 comments… add one }

Leave a Comment