Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

laptop battery charging control?

10 views
Skip to first unread message

David Chmelik

unread,
Dec 31, 2023, 5:32:44 AM12/31/23
to
Is there laptop battery charging control for FreeBSD UNIX? I have two
Lenovo ThinkPad X1 Yoga 20s (FR, UB) and read it's possible, but an
article I read was for older ThinkPads (maybe IBM) so those instructions
didn't work. I'd like to keep them plugged-in with battery to stop
charging at 70% and restart at 50%.

Andreas Kempe

unread,
Dec 31, 2023, 8:05:02 AM12/31/23
to
I've been using the patch from
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=234403 that adds
this functionality to the acpi_ibm module. It gives you two sysctls,
dev.acpi_ibm.0.bat0_charge_stop and dev.acpi_ibm.0.bat0_charge_start
that can be set to you desired percentages to start and stop charging.

It works well on my X280, but I don't know if it applies on the X1 as
well.

David Chmelik

unread,
Dec 31, 2023, 10:41:05 PM12/31/23
to
Looked at that report and found a script to set charge thresholds, but got
the following errors (not clear to me yet if I have to load some module/
driver).

root@microcosmos:~ # battery_ctrl.sh
acpi_call kernel modules not loaded.
loading acpi_call ...
kldload: can't load acpi_call: No such file or directory
acpi_call kernel modules failed to load.

David Chmelik

unread,
Dec 31, 2023, 11:14:54 PM12/31/23
to
Loaded that then it said the below (so apparently not dev.acpi_ibm
anymore, but I don't know what replaces it after Lenovo took over from
IBM).

root@microcosmos:~/freebsd.sys/etc # battery_ctrl.sh 50 70
sysctl: unknown oid 'dev.acpi_ibm.0.%location'
[: Unknown: unexpected operator
start threshold was set to : 50
[: Unknown: unexpected operator
stop threshold was set to : 70

Andreas Kempe

unread,
Jan 1, 2024, 4:19:58 AM1/1/24
to
acpi_ibm is not just for IBM ThinkPads, the historical name just stuck
around. Try kldload acpi_ibm and dev.acpi_ibm.0.%location should
become available.

David Chmelik

unread,
Jan 2, 2024, 1:32:46 AM1/2/24
to
That works; thanks! Just wondering if I need to do these after reboot or
put in some /etc configuration file...

Andreas Kempe

unread,
Jan 2, 2024, 6:15:18 PM1/2/24
to
On my X280, the computer remembers the setting as long as I don't
completely discharge the battery.
0 new messages