On 2023-08-09, Sasha <sa...@fastmail.com> wrote: > Hi all, > > This is my first time writing to this list, so forgive me if I miss > something. This is also my first time using OpenBSD. > > I'm running OpenBSD 7.3 on a Thinkpad T460, which has two batteries. One > internal battery, and one removable battery. The expected behavior (e.g. > on Linux) is that the removable battery discharges first until it > reaches 5%, then the internal battery begins to discharge. > > On OpenBSD when I run apm it shows only the charge of the "current" > battery. This means the removable battery if it is plugged in, or the > internal battery if the removable battery is not plugged in. This also > means that the system attempts to hibernate/cleanly shut down when the > charge of the removable battery becomes very low.
Unless you use apmd -z / -Z, which I think is fairly uncommon, I believe (though could be mistaken) that any auto suspend is handled by the embedded controller in the laptop. If you do use -z/-Z, you could stop doing that and either use default laptop behaviour if it does something sensible for you, or handle things yourself via sensorsd. > Another symptom of this is that the % charge showed by apm goes *up* > when I unplug the removable battery. > > Is there a way to check the percent charge of each battery individually? > I would like apm to show me something like "80% 30%" instead of the > current "30%". > > Both batteries are detected by acpibat and show up in sysctl: > > hw.sensors.acpibat0.volt0=11.10 VDC (voltage) > hw.sensors.acpibat0.volt1=10.92 VDC (current voltage) > hw.sensors.acpibat0.power0=0.00 W (rate) > hw.sensors.acpibat0.watthour0=7.95 Wh (last full capacity) > hw.sensors.acpibat0.watthour1=0.40 Wh (warning capacity) > hw.sensors.acpibat0.watthour2=0.20 Wh (low capacity) > hw.sensors.acpibat0.watthour3=0.37 Wh (remaining capacity), WARNING > hw.sensors.acpibat0.watthour4=20.54 Wh (design capacity) > hw.sensors.acpibat0.raw0=0 (battery idle), OK > hw.sensors.acpibat1.volt0=10.80 VDC (voltage) > hw.sensors.acpibat1.volt1=11.57 VDC (current voltage) > hw.sensors.acpibat1.power0=23.74 W (rate) > hw.sensors.acpibat1.watthour0=unknown (last full capacity), UNKNOWN > hw.sensors.acpibat1.watthour1=0.00 Wh (warning capacity) > hw.sensors.acpibat1.watthour2=0.00 Wh (low capacity) > hw.sensors.acpibat1.watthour3=0.67 Wh (remaining capacity), OK > hw.sensors.acpibat1.watthour4=unknown (design capacity), UNKNOWN > hw.sensors.acpibat1.raw0=unknown (battery unknown), UNKNOWN Not directly as %, and not from the apm subsystem, but you could calculate it from the hw.sensors subsystem (though I'm not sure whether the wanted value would be remaining/last full or whether it would be remaining/design). (apm(4) has a relatively simple API that doesn't cater for reporting status of multiple batteries separately).