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%.
On Mon, 1 Jan 2024 03:41:02 -0000 (UTC), David Chmelik wrote:
On Sun, 31 Dec 2023 13:04:59 -0000 (UTC), Andreas Kempe wrote:
Den 2023-12-31 skrev David Chmelik <dchmelik@gmail.com>:
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%.
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.
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.
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
On Mon, 1 Jan 2024 09:19:56 -0000 (UTC), Andreas Kempe wrote:
Den 2024-01-01 skrev David Chmelik <dchmelik@gmail.com>:
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
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.
That works; thanks! Just wondering if I need to do these after reboot or
put in some /etc configuration file...
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 379 |
Nodes: | 16 (2 / 14) |
Uptime: | 43:13:24 |
Calls: | 8,141 |
Calls today: | 4 |
Files: | 13,085 |
Messages: | 5,857,853 |