This repository contains a Linux kernel driver for managing battery health features on Acer laptops via the WMI (Windows Management Interface) interface. The driver enables control of two key battery functions: a health mode that limits charge to 80% to prolong battery lifespan, and a calibration mode that performs a full charge-discharge cycle for accurate capacity reporting. It also provides battery temperature readings. Implemented as a single kernel module (acer-wmi-battery.c), it interacts with the laptop's firmware through WMI methods to query and set battery parameters, exposing these controls via sysfs attributes under /sys/bus/wmi/drivers/acer-wmi-battery/. The driver follows standard Linux kernel module practices, including proper error handling, version-dependent includes for compatibility, and sysfs attribute creation for user-space interaction. It includes reusable WMI helper functions that encapsulate the boilerplate for WMI method calls, buffer handling, and response validation. The project is actively maintained with recent commits, supports multiple Acer laptop models as documented in MODELS.md, and is licensed under GPL-2.0.
AlDente is a macOS menu bar application designed to extend MacBook battery lifespan by limiting the maximum charging percentage. The application consists of two main components: a user-facing interface that runs with standard user privileges, and a privileged helper tool that communicates with the System Management Controller (SMC) to enforce battery charge limits. When the user sets a charge limit (e.g., 80%), the helper tool writes to the BCLM SMC key to prevent charging beyond that percentage. The app also monitors battery state and can prevent system sleep to maintain the charge limit when AC power is connected. The architecture cleanly separates concerns between the privileged operations (handled by the helper tool) and the user interface. Communication between components occurs via NSXPCConnection with a well-defined protocol (HelperToolProtocol). The application demonstrates solid macOS development practices including proper use of delegates for status updates, efficient polling for battery state, and clean separation of UI logic from business logic. While the repository contains legacy code from an older open-source version (as noted in the README), it includes a particularly valuable reusable component in SMC.swift. This file provides a robust, well-encapsulated interface for accessing the SMC on Intel-based Macs, handling all the low-level IOKit interactions, data type conversions, and error handling. The SMC implementation correctly manages the SMCParamStruct structure, supports various data types (UInt8, UInt32, FPE2, SP78), and includes extensions for reading temperature, fan speeds, and other sensor data.