-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Dell] Battery Care (as of Linux 6.12) #379
Comments
These are Windows binaries, dear. If you want things moving, implement a kernel interface e.g. driver for your hardware. See: #321 |
I'm afraid you are mistaken, there are Linux binaries available as well: https://www.dell.com/support/article/us/en/04/sln311302/dell-command-configure?lang=en |
I see. --PrimaryBattChargeCfg seems do to charge thresholds. Did you spot something like force_discharge (for recalibration)? Contras:
|
Yesterday I stumbled over smbios-utils: https://github.com/dell/libsmbios/ Any volunteers to check out and document how to use it? Command line args are a bit cryptic. ps. I don't have Dell hardware within reach. |
My daily machine is a Dell XPS running openSUSE with TLP. So what do you exactly need? |
General question: are Dell battery features similar enough to the ThinkPad approach so one can integrate them into the existing TLP commands (setcharge/discharge/recalibrate):
|
Ok. I've got the latest smbios installed. It's shipped with openSUSE, so that's the good news. The bad news is that I get nothing out of it. For example, a 'sudo smbios-battery-ctl --battery-charge' results in this:
No difference what so ever with AC plugged in or not. So I'm not sure if this libsmbios is actually bringing something to the table... |
Dead end? Just for the record: could you post the output of
|
As for the first three points: the relevant option is described in the manual here I'm also getting NILs from smbios, I'm going to report it in the libsmbios repository. In any case, smbios-battery-ctl is pretty low-level could do the trick, but on the other hand, I'm not sure if it wouldn't conflict with the BIOS settings.
|
Thanks. Just for the record:
|
/remark: the reply was substantially edited On the other hand, I have second thoughts about introducing a proprietary opt-dependency to tlp. It appears that smbios already exposes the API using the low-level token API: token_list.csv
prints the token as a bool, which is clearly invalid
Trying to access the token directly using the Python bindings is weird but feasible - they numeric values are encoded as 2-byte little-endian integers.
Probably the best idea would be to contribute the API to While I can't guarantee code contributions to this one (I'll see what I can do), I can promise I'll test the changes related to power-management on Dell laptops. For reference, here's the issue about |
However, i'm not going to include code that calls a proprietary tool. ps. and i would definitely prefer a kernel solution that uses the natacpi framework laid out in #321. |
What I meant was that So we can either use libsmbios (GPL2) or natacpi. It looks like I've already solved the major obstacles, so I think I can extend I won't be able to help with natacpi in any other way than testing. You may consider contacting the Dell developers. (I'm not affiliated with Dell in any way, I'm just using a laptop produced by the company) |
@linrunner let me know if you're ok with this CLI |
@linrunner the pull request to dell/libsmbios has been merged. You can now use it to implement |
OK, then let's get started. I'll need a bit more than just the description of the CLI because the routines in func.d/35-tlp-func-batt do a lot of checks before actually writing anything - and I don't have the hardware of course ... I need the exact commands and their corresponding outputs / return codes for the following: (1) Is libsmbios installed and is it supporting the new CLI? OK, i'll guess we just have to check for smbios-battery-ctl in the PATH. (2) Does the laptop actually support thresholds? (3) Reading the thresholds (4) Writing the thresholds (+ what happens with invalid param values?) (5) Checking for batteries: are Dell laptops BAT0 only or are there models with two batteries? For reference: I'll call the feature dellsm in TLP. |
What happened here? I was very interested in this work as I am thinking in buying a dell device |
@linrunner and @marmistrz: did you start implementing this somewhere? For instance, is there a branch that contains the initial pluming for using smbios rather than one of the kernel modules? I have a Dell Latitude laptop that supports setting the thresholds in the bios or via the |
Sorry, I completely forgot about it. Unfortunately, smbios didn't have a new release after my changes accepted, so you need to patch
You can probably grep
I don't know, but I guess that
I don't know what happens if params are invalid.
No idea. For all those things I don't know about it's probably best to ask in dell/libsmbios (e.g. through github issues) See also this fragment from
|
I have no plans to implement this myself. Reasons are:
|
Will be released with [EDIT] 6.12 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/platform/x86/dell?id=ab58016c68cc5b8c3622e38b7db64994e4833d9f Anybody willing to test if I supply a plugin? |
Will see if I can test, thanks a lot for the work done here EDIT: Sorry read your message a little too fast, I skipped that you needed to write a plugin, will wait for it, thanks ! |
@AkechiShiro Wait a minute. I have to write the plugin first. Stay tuned and thanks for your help. |
@AkechiShiro I would need the output of |
Under Linux 6.11's kernel right ? EDIT : Is there a specific commit I should use to build tlp befire running this command ? I'm aware the command is working on the latest release I'll upload the output from the release I have installed at the moment, if that is enough, I'll let you check |
@AkechiShiro if you already run 6.11 then I'd prefer
Otherwise
suffices atm. |
@AkechiShiro You shall/need not build anything atm. Just show the output requested above, works with any recent TLP version. I just need some facts about Dell laptops. Thanks. |
Here is the output : --- TLP 1.6.1 -------------------------------------------- |
* Supports Dell laptops * Requires dell_laptop module as of Linux 6.11 * Start and stop threshold * Force discharge not supported * charge_control_start_threshold: - Valid values: 50..95 - Default value: 95 * charge_control_end_threshold: - Valid values: 55..100 - Default value: 100 References: * https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/platform/x86/dell?id=ab58016c68cc5b8c3622e38b7db64994e4833d9f * https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/platform/x86/dell/dell-laptop.c * #379 (comment)
The wait is over: an initial version of the Dell plugin is ready to test. [EDIT] Kernel 6.12 is required. For the test you either need TLP 1.7.0, supplemented by the download of /usr/share/tlp/bat.d/65-dell, or you can build a package for your distribution based on [EDIT] main branch (Arch users may use tlp-git from AUR). I need at least the output of
Please also run the automatic test script (with sudo or as root) and show the output: It requires the tool clitest to be installed. Should be available as a package in most distributions. @hyperfekt @cheng3100 @gagath @marmistrz @awehrfritz @zalaps @spockfish @raduburla @AkechiShiro |
@AkechiShiro Is something keeping you from testing? |
Hi, here are my outputs. tlp-stat results
unit test results
|
@serycjon thanks for testing. Something fundamental seems to be missing. The sources of the driver say something about an attribute
|
I didn't do anything except what was mentioned in #379 (comment) Output of
|
The necessary module dell_laptop is loaded, otherwise the plugin would not be activated at all. I will email the kernel dev. |
Oops. I think I was wrong about the kernel version in which the feature is merged. Seems to be coming with 6.12: Then we'll just have to wait. Unless you want to install an 6.12-rc1. |
Sorry @linrunner, I just couldn't find the time to test yet, I will probably wait for 6.12 as well |
@linrunner I have never tweaked with kernel, so I will probably wait. The 6.12 will be probably released quite soon - maybe in a month or so? Judging only from the historical data (https://en.wikipedia.org/wiki/Linux_kernel_version_history#Releases_6.x.y). |
Hi, best regrads # tlp-stat -s -b
# grep . /sys/class/power_supply/BAT0/* 2> /dev/null | grep -v ueven
# lsmod | grep dell
# unit-tests/charge-thresholds_dell
|
@langemar looks promising. Could you please enable the service
then run the automatic test again
|
Of course: If have enabled and started the service # unit-tests/charge-thresholds_dell
|
@langemar Looks perfect now. Thank your very much for testing. Finally, you could check whether the thresholds work as set. ps. The service did not have to be started. It was just a matter of activating it so that the warning message does not interfere with the target/actual comparison of the output. Of course, it must also be activated for regular operation of TLP. |
I made a quick test using `tlp set charge x y BAT0` and `smbios-battery-ctl - - get-charging-cfg`. Once I set a value smbios shows the set values.
The values shown by smbios are followed, I'm using it for some weeks now. Therefore I expect tlp is working now too.
Sorry I already left office so I can't provide a log until tomorrow.
Let me know if I can provide further information. And thank you very much for your great work :)
|
@langemar Please don't bother any further, that information is enough for me. |
* Supports Dell laptops * Requires dell_laptop module as of Linux 6.12 * Start and stop threshold * Force discharge not supported * charge_control_start_threshold: - Valid values: 50..95 - Default value: 95 * charge_control_end_threshold: - Valid values: 55..100 - Default value: 100 References: * https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/platform/x86/dell?id=ab58016c68cc5b8c3622e38b7db64994e4833d9f * https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/platform/x86/dell/dell-laptop.c * #379 (comment)
EDIT by @linrunner
The wait is over: an initial version of the Dell plugin is ready to test.
[EDIT] Kernel 6.12 is required.
Testing instructions -> #379 (comment)
===============================================================================================
My understanding is that currently only ThinkPad devices have advanced battery features available, due to the existence of tp_smapi.
For Dell devices there exists the 'Dell Command | Configure' which appears to provide similar functionality in regards to battery management, for example running off AC power and express charging, even though the interface is rather suboptimal.
That's all the more reason to build a tool for it, but the question is if it should be this one.
The text was updated successfully, but these errors were encountered: