Set default capacity to -1

Signed-off-by: AnErrupTion <anerruption+codeberg@disroot.org>
This commit is contained in:
AnErrupTion 2026-07-05 21:09:04 +02:00
commit 7346b4343d

View file

@ -2320,7 +2320,7 @@ fn getBatteryPercentage(io: std.Io, battery_id: []const u8) !u8 {
// battery_id is unused on FreeBSD; sysctl exposes a single aggregate value.
// For multi-battery systems the MIB would be hw.acpi.battery.N.life,
// but hw.acpi.battery.life is the standard single-battery interface.
var capacity: c_int = undefined;
var capacity: c_int = -1;
var size: usize = @sizeOf(c_int);
const ret = sysctl.sysctlbyname("hw.acpi.battery.life", &capacity, &size, null, 0);