Open farinc opened 2 years ago
Thanks for pointing out this issue. I've never had similar errors, but I'll look into that as I have more time.
Sadly, battmngr
doesn't support your laptop model yet, you can try and use this fork while I work on the support for Ideapad 14 laptops.
On a side note, I don't know how to do that because I'm not a windows user, but if you could try and monitor the ACPI calls lenovo vantage makes, I'm sure we could have a full support for your model of laptop.
On an Ideapad 5 14are05 here, and I can report that while sudo battmngr -sc 1 and sudo battmngr -sc 2 return the same errors as those seen by @farinc, the battery charge mode is successfully changed. Using -sc 3 and -sc 4 also successfully changes the state with no output.
Similarly, reading the battery mode and the charge mode does not work (Unrecognized battery mode, please retry and Unrecognized battery charge mode, please retry), as the bits to check are different (see https://wiki.archlinux.org/title/Lenovo_IdeaPad_5_14are05).
I made a simple script for the 14are05 today, taking some inspiration from your script, but some things are different - notably, instead of requiring sudo, I've made a udev rule to make /proc/acpi/call writeable for users of the 'wheel' group. I also dislike allowing the option of leaving both Rapid Charge and Battery Conservation on at the same time, so I've explicitly disallowed it. The script probably lacks other functionality etc. Will be uploading to https://github.com/korikori/ideapad-perf.
On an Ideapad 5 14are05 here, and I can report that while sudo battmngr -sc 1 and sudo battmngr -sc 2 return the same errors as those seen by @farinc, the battery charge mode is successfully changed. Using -sc 3 and -sc 4 also successfully changes the state with no output.
Please post the output of dmidecode -s system-product-name
so I know the exact model of laptop we are talking about. Have you tried the experimental_support branch? It should support your laptop model (please let me know how it works in case you try it!).
I also think it's better than the main branch since the check bits and ACPI calls are parametrized.
I made a simple script for the 14are05 today, taking some inspiration from your script, but some things are different - notably, instead of requiring sudo, I've made a udev rule to make /proc/acpi/call writeable for users of the 'wheel' group.
I've thought about this but never implemented it, it's an elegant solution!
The output of sudo dmidecode -s system-product-name
is 81YM
. I think that in some markets its known as the Ideapad Flex and other places it's just Ideapad 5 but can't really confirm - it could well be a different model. In any case, everything from the ArchWiki page on the 14are05 applies for this computer.
Just downloaded the experimental branch and it still returns errors when trying to read or set the battery charge mode, but this time it does not actually change them (whereas with the main branch, it sometimes returns errors, but also changes the state). The experimental branch also returns errors on all -sc options (1 to 4) whereas it previously only did so on 1 and 2.
Thanks for the quick answer. The problem with the experimental branch is that every supported model needs to be explicitly declared in the config.json file.
If you are willing to test the experimental_support branch on your laptop, please try and replace the default config.json
file with the one you find in the attached zip archive.
config.zip
This should do the trick!
There was some formatting issue with the provided json that I couldn't resolve (error "parse error: Expected another key-value pair at line 157, column 1"), however I then tried to edit the provided configs.json file (this one) and simply replaced line 54:
from
82LM
to
81YM
I can confirm that with this change, all functions of batmngr seem to work on my model.
Yeah, sorry about that. I was in a hurry and edited the file and sent it without trying to use it first.
This is great! I will update the config.json file in the experimental branch and officially support your laptop model, thank you for testing battmngr!
Output of
dmidecode -s system-product-name
:81SS
acpidump: https://controlc.com/29bad0df This laptop does have fast charging and conservation mode (works fine using ideapad-cm), but I get errors like the following:This is the same msg for
sudo battmngr -sc 2
For conservation mode, issuingsudo battmngr -sc 4
returns no output (my device is currently in rapid charge mode/no conservation mode). As a final note: idk much about acpid and related material, but since I am dual booting windows which has working control over battery modes, I'll be happy to help sort this out if that is helpful.