• Re: laptop battery charging control?

    From Andreas Kempe@21:1/5 to All on Sun Dec 31 13:04:59 2023
    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andreas Kempe@21:1/5 to All on Mon Jan 1 09:19:56 2024
    Den 2024-01-01 skrev David Chmelik <dchmelik@gmail.com>:
    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

    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andreas Kempe@21:1/5 to All on Tue Jan 2 23:15:14 2024
    Den 2024-01-02 skrev David Chmelik <dchmelik@gmail.com>:
    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...

    On my X280, the computer remembers the setting as long as I don't
    completely discharge the battery.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)