Optimizing laptop battery life with AcpiTool and PowerTOP

Charge!

© Lead Image © 25081972, 123RF.com

© Lead Image © 25081972, 123RF.com

Article from Issue 170/2015
Author(s):

AcpiTool and PowerTOP ensure a sustainable battery lifetime and guarantee low energy consumption of laptops running Linux by identifying power hogs and maintaining the battery.

Far from the next power outlet, many users look anxiously at their laptop's battery charge state. Although modern hardware relies on several tricks to save power, whether or not they actually work often depends on your hardware.

One option available to Linux users is managing power through the ACPI kernel modules (see the box titled "The ACPI Dilemma"). Recent machines also let you configure many components on the fly to reduce energy consumption. The small command-line programs AcpiTool and PowerTOP can help you keep track of your power demands and keep your laptop from shutting down when you really need it.

The ACPI Dilemma

The Advanced Configuration and Power Interface (ACPI) standard was created in 1996 as a successor to the APM standard. Since then, ACPI has evolved steadily and adopted new technologies, such as USB, PCIe, and SATA. Unlike ACPI's predecessor APM, the operating system rather than the BIOS controls ACPI, so the two standards are incompatible. ACPI relies on functions implemented in the respective hardware, which explains why only the old APM energy management standard is suitable for older computers without the appropriate routines.

Linux and other free operating systems typically use ACPICA (ACPI Component Architecture), an ACPI reference implementation developed by Intel. The operating system calls the DSDT (Differentiated System Description Table) built into the BIOS with parameters for individual components and controls the computer's individual operating states accordingly.

Soon after its original specification, ACPI became a key technology because of the ever-increasing spread of mobile computers. For this reason, in 1999 Microsoft launched its own Windows variant of ACPI, which is not fully compatible with the Intel specification. Hardware manufacturers mostly test their new components against the Microsoft specification because of the dominance of Windows, so errors may occur on systems that use the Intel implementation. As Bill Gates once revealed [1], Microsoft consciously caused this problem to make life difficult for alternative operating systems.

The Linux developer community, which Microsoft's efforts primarily targeted, has now solved many of the problems related to ACPI: Linux now supports Windows modes by pretending to be Windows when the BIOS asks. Developers correct problematic reactions to bad DSDT tables quickly after they become known, so in many cases, laptops that have been around for a few months can use most ACPI modes. Even if you have brand new hardware with many new components, all the ACPI techniques will typically work after a short period of time.

Specifics

AcpiTool resides in the repositories of virtually all the major distributions, and you can install it conveniently from there via the respective package manager. If it is missing from your choice of distribution, you can quite easily build the tool from the source code [2]. After installation, call acpitool in a terminal window. The software works in userspace, so you do not need root privileges (Figure 1). The program parses the contents of the /proc/acpi directory and converts it to a legible format.

Figure 1: A large number of options means a similar amount of information.

AcpiTool understands a large number of parameters, some of which, however, only work on ASUS, Toshiba, and Lenovo brand laptops, as well as older IBM devices. These features result from certain characteristics of the hardware, but most switches work properly on all laptops. For a list of the available options, you can type

acpitool --help

at the command line.

Info

In contrast to inxi [3], for example, acpitool is not used primarily to spit out comprehensive information about the hardware. Users are typically interested in the battery status and supported modes, and if you are battling a laptop that unexpectedly insists on running at full power all the time, information on the CPU and the thermal sensors can help, as well.

To view all the relevant data, type

acpitool -bcftv

at the command line. The software then lists the relevant information. If the output contains notes on an incomplete directory structure below /proc/acpi, this indicates that kernel modules are missing or that some functions are not supported by the hardware.

In the case of unsupported functions, you can call the sensors-detect command at the command line with root privileges.

The software is included in the lm-sensors package, which is found in the repositories of most distributions. It detects the sensors in the notebook and, if you allow this to happen, adds corresponding modules to your Linux configuration.

Battery Problems

You should pay special attention to the charge status of the battery when you call the software. Entering the

acpitool -Bv

command outputs detailed information. Of course, even the latest laptops with state-of-the-art lithium-ion and lithium-polymer batteries can suffer from a kind of "memory effect" after extended operation with many cycles, which often significantly reduces capacity [4].

This memory effect phenomenon occurs after many partial discharges with subsequent recharging. Notebooks that run almost exclusively on the power supply are especially vulnerable: The electronics controlled by the operating system automatically recharge the battery as of a specific discharge threshold. The resulting chemical processes involved in partial charging and discharging affect the voltage in cells over time.

The output from AcpiTool with the -Bv parameters gives you three important pieces of information on the battery status (Figure 2): the Remaining capacity (milliamp-hours, mAh), the Design capacity (i.e., the original maximum battery capacity), and the Last full capacity (i.e., the capacity that existed before the last charging).

Figure 2: The battery here is almost in mint condition.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • ACPI Tools

    Linux offers some useful command-line tools that leverage the ACPI power management framework to display detailed data on the status of a laptop battery.

  • Power Management Tools

    Linux offers several tools that help users analyze the power consumption of hardware components.

  • PowerTOP 2.0

    The PowerTOP tool developed by Intel helps you save power. In version 2.0, it can also handle GPUs and offers advanced tracking features.

  • PowerTOP

    Intel’s PowerTOP analysis tool helps optimize power usage and shows you the power guzzlers hiding out on your operating system.

  • Saving Power

    Save power by choosing the right system and software configuration.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News