-
Notifications
You must be signed in to change notification settings - Fork 128
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 Wear Control #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:
|
I have only used the I reckon this will become all much easier once there is support for this in the kernel which is currently work-in-progress, see: https://lkml.org/lkml/2020/7/29/87. There is also an open issue in libsmbios which has some further information, but no progress on the libsmbios side yet since the kernel interface is still missing obviously. |
@raduburla Wow, this is very good. Thank you! I think I will get a dell laptop! |
@awehrfritz I see it now. Thank you for your link. After some research. I found that the battery threshold is closely related to battery firmware which is much more closesource compared to the host driver. Maybe that is reason why it is so hard to implement. |
@cheng3100 But I'm using it standalone, without tlp. |
@marmistrz Thanks, I will try it after my new dell laptop arrive. |
This is actually a super cool script! Would it be possible for you to explain it? |
Hi, Sure, to use it save it as a .sh file then The script supports 2 main options that you want to change:
If you have set a Bios password it will ask for the password. I did not test without a password, if it does not work try replace the following line in the script
You will need cctk (https://www.dell.com/support/kbdoc/ro-ro/000178000/dell-command-configure) and smbios (https://github.com/dell/libsmbios) installed If you get errors you might need to change some Bios configurations. I had to disable some security features from the Bios for the charge settings to work, I can't remember exactly what settings. Can post a list of my actual settings if needed. Hope this help |
Current state of things is: I would love to support Dell, but not by means of an external tool (or external kernel module). I had my fair share of experience with that in > 10 years on ThinkPads. So the prerequisite is mainline kernel support for
Let's see what happens here: |
Thanks!!! I've dell vostro originally with Win11. Changed to ubuntu 20.04 LTS with UEFI. TLP is not supported. Following commands worked:
|
Unplug charger, then the config is lost !
I have Any idea why the config did not persist? |
@linrunner |
@zalaps : no problem, no need to delete. I only wanted to sharpen the topic with my hint :-) |
I have asked Dell an update about kernel support on dell/libsmbios#84. FYI the employees working on the driver seem to have left the company 5 months ago, so support for a proper kernel interface might still take a while. As of today, one has to use |
Light at the end of the tunnel? https://patchwork.kernel.org/project/platform-driver-x86/patch/20240820033005.09e03af1@5400/ |
Released with 6.11 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. Kernel 6.11 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 Branch feature/bat.d/dell. 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 |
EDIT by @linrunner
The wait is over: an initial version of the Dell plugin is ready to test.
Kernel 6.11 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: