-
Notifications
You must be signed in to change notification settings - Fork 133
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
Battery Care for Dell laptops (Kernel 6.12 required) #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 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)
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
@vkhodygo Topic here is setting the charge thresholds for Dell laptops. This requires test results as described in #379 (comment). Your post does not contain any test results. How you broke your system is offtopic in this issue. |
Linux 6.12 is out. @serycjon it's available in the Arch repos right now. So nothing is stopping you from testing :-). @AkechiShiro What about NixOS? |
@linrunner 6.12 is available in NixOS as well (in unstable), I'm just waiting for it to land in a new stable release (was planned the 22 November but currently delayed due to some regression in curl) |
This comment was marked as off-topic.
This comment was marked as off-topic.
@okarin69 Thank you for the info, but in this issue it is offtopic and distracting. |
Finally a bit of time to reboot and try it - seems ok? sudo tlp-stat -s -b -v
sudo ./charge-thresholds_dell
|
@serycjon looks perfect. Thank you for testing. |
Hi! Thank you for the amazing work! sudo tlp-stat -s -b -v--- TLP 1.7.0 --------------------------------------------
+++ System Info
System = Dell Inc. XPS 15 9560
BIOS = 1.31.0
OS Release = Ubuntu 24.04.1 LTS
Kernel = 6.12.4-serro #1 SMP PREEMPT_DYNAMIC Mon Dec 9 23:50:07 CET 2024 x86_64
/proc/cmdline = BOOT_IMAGE=/boot/vmlinuz-6.12.4-serro root=UUID=57a7eaba-23b9-4dbc-9def-e8737e17fea3 ro
Init system = systemd v255 (255.4-1ubuntu8.4)
Boot mode = UEFI
Suspend mode = s2idle [deep]
+++ TLP Status
State = enabled
RDW state = enabled
Last run = 10:07:23 PM, 14 sec(s) ago
Mode = AC
Power source = AC
+++ Battery Care
Plugin: dell
Supported features: charge thresholds
Driver usage:
* natacpi (dell_laptop) = active (charge thresholds)
Parameter value ranges:
* START_CHARGE_THRESH_BAT0/1: 50..95(default)
* STOP_CHARGE_THRESH_BAT0/1: 55..100(default)
+++ Battery Status: BAT0
/sys/class/power_supply/BAT0/manufacturer = SMP
/sys/class/power_supply/BAT0/model_name = DELL GPM0365
/sys/class/power_supply/BAT0/cycle_count = 0 (or not supported)
/sys/class/power_supply/BAT0/charge_full_design = 8509 [mAh]
/sys/class/power_supply/BAT0/charge_full = 7340 [mAh]
/sys/class/power_supply/BAT0/charge_now = 5827 [mAh]
/sys/class/power_supply/BAT0/current_now = 1 [mA]
/sys/class/power_supply/BAT0/status = Not charging
/sys/class/power_supply/BAT0/voltage_min_design = 11400 [mV]
/sys/class/power_supply/BAT0/voltage_now = 13015 [mV]
/sys/class/power_supply/BAT0/charge_control_start_threshold = 75 [%]
/sys/class/power_supply/BAT0/charge_control_end_threshold = 80 [%]
/sys/class/power_supply/BAT0/charge_types = Trickle Fast Standard Adaptive [Custom] [%]
Charge = 79.4 [%]
Capacity = 86.3 [%]
sudo ./charge-thresholds_dell#1 # +++ Dell laptops +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#2 #
#3 # --- tlp start
#4 sudo tlp start -- START_CHARGE_THRESH_BAT0= STOP_CHARGE_THRESH_BAT0= START_CHARGE_THRESH_BAT1= STOP_CHARGE_THRESH_BAT1=
#5 sudo tlp start -- START_CHARGE_THRESH_BAT0="60" STOP_CHARGE_THRESH_BAT0="100" START_CHARGE_THRESH_BAT1= STOP_CHARGE_THRESH_BAT1=
--------------------------------------------------------------------------------
[FAILED #5, line 14] sudo tlp start -- START_CHARGE_THRESH_BAT0="60" STOP_CHARGE_THRESH_BAT0="100" START_CHARGE_THRESH_BAT1= STOP_CHARGE_THRESH_BAT1=
@@ -1 +1,3 @@
+Error: writing start charge threshold for BAT0 failed.
+Error: writing stop charge threshold for BAT0 failed.
TLP started in AC mode (auto).
--------------------------------------------------------------------------------
#6 sudo tlp start -- START_CHARGE_THRESH_BAT0="100" STOP_CHARGE_THRESH_BAT0="100" START_CHARGE_THRESH_BAT1= STOP_CHARGE_THRESH_BAT1=
#7 sudo tlp start -- START_CHARGE_THRESH_BAT0="50" STOP_CHARGE_THRESH_BAT0="0" START_CHARGE_THRESH_BAT1= STOP_CHARGE_THRESH_BAT1=
#8 sudo tlp start -- START_CHARGE_THRESH_BAT0="50" STOP_CHARGE_THRESH_BAT0="101" START_CHARGE_THRESH_BAT1= STOP_CHARGE_THRESH_BAT1=
#9 sudo tlp start -- START_CHARGE_THRESH_BAT0="90" STOP_CHARGE_THRESH_BAT0="91" START_CHARGE_THRESH_BAT1= STOP_CHARGE_THRESH_BAT1=
#10 sudo tlp start -- START_CHARGE_THRESH_BAT0="90" STOP_CHARGE_THRESH_BAT0="95" START_CHARGE_THRESH_BAT1= STOP_CHARGE_THRESH_BAT1=
--------------------------------------------------------------------------------
[FAILED #10, line 28] sudo tlp start -- START_CHARGE_THRESH_BAT0="90" STOP_CHARGE_THRESH_BAT0="95" START_CHARGE_THRESH_BAT1= STOP_CHARGE_THRESH_BAT1=
@@ -1 +1,3 @@
+Error: writing stop charge threshold for BAT0 failed.
+Error: writing start charge threshold for BAT0 failed.
TLP started in AC mode (auto).
--------------------------------------------------------------------------------
#11 sudo tlp start -- START_CHARGE_THRESH_BAT0="DEF" STOP_CHARGE_THRESH_BAT0="DEF" START_CHARGE_THRESH_BAT1= STOP_CHARGE_THRESH_BAT1=
--------------------------------------------------------------------------------
[FAILED #11, line 30] sudo tlp start -- START_CHARGE_THRESH_BAT0="DEF" STOP_CHARGE_THRESH_BAT0="DEF" START_CHARGE_THRESH_BAT1= STOP_CHARGE_THRESH_BAT1=
@@ -1 +1,3 @@
+Error: writing stop charge threshold for BAT0 failed.
+Error: writing start charge threshold for BAT0 failed.
TLP started in AC mode (auto).
--------------------------------------------------------------------------------
#12 sudo tlp start -- NATACPI_ENABLE=0 START_CHARGE_THRESH_BAT0="DEF" STOP_CHARGE_THRESH_BAT0="DEF"
#13 #
#14 # --- tlp setcharge w/o arguments
#15 sudo tlp setcharge -- START_CHARGE_THRESH_BAT0="60" STOP_CHARGE_THRESH_BAT0="100" X_SOC_CHECK=0
--------------------------------------------------------------------------------
[FAILED #15, line 36] sudo tlp setcharge -- START_CHARGE_THRESH_BAT0="60" STOP_CHARGE_THRESH_BAT0="100" X_SOC_CHECK=0
@@ -1,3 +1,3 @@
Setting temporary charge thresholds for BAT0:
- start = 60
- stop = 100 (no change)
+ start = 60 (Error: write failed)
+ stop = 100 (Error: write failed)
--------------------------------------------------------------------------------
#16 sudo tlp setcharge -- START_CHARGE_THRESH_BAT0="100" STOP_CHARGE_THRESH_BAT0="100"
#17 sudo tlp setcharge -- START_CHARGE_THRESH_BAT0="50" STOP_CHARGE_THRESH_BAT0="0"
#18 sudo tlp setcharge -- START_CHARGE_THRESH_BAT0="50" STOP_CHARGE_THRESH_BAT0="101"
#19 sudo tlp setcharge -- START_CHARGE_THRESH_BAT0="90" STOP_CHARGE_THRESH_BAT0="91"
#20 sudo tlp setcharge -- START_CHARGE_THRESH_BAT0="90" STOP_CHARGE_THRESH_BAT0="95"
--------------------------------------------------------------------------------
[FAILED #20, line 48] sudo tlp setcharge -- START_CHARGE_THRESH_BAT0="90" STOP_CHARGE_THRESH_BAT0="95"
@@ -1,3 +1,3 @@
Setting temporary charge thresholds for BAT0:
- start = 90
- stop = 95
+ stop = 95 (Error: write failed)
+ start = 90 (Error: write failed)
--------------------------------------------------------------------------------
#21 sudo tlp setcharge -- START_CHARGE_THRESH_BAT0="90" STOP_CHARGE_THRESH_BAT0="95"
--------------------------------------------------------------------------------
[FAILED #21, line 52] sudo tlp setcharge -- START_CHARGE_THRESH_BAT0="90" STOP_CHARGE_THRESH_BAT0="95"
@@ -1,3 +1,3 @@
Setting temporary charge thresholds for BAT0:
- start = 90 (no change)
- stop = 95 (no change)
+ stop = 95 (Error: write failed)
+ start = 90 (Error: write failed)
--------------------------------------------------------------------------------
#22 sudo tlp setcharge -- START_CHARGE_THRESH_BAT0="DEF" STOP_CHARGE_THRESH_BAT0="DEF"
--------------------------------------------------------------------------------
[FAILED #22, line 56] sudo tlp setcharge -- START_CHARGE_THRESH_BAT0="DEF" STOP_CHARGE_THRESH_BAT0="DEF"
@@ -1,3 +1,3 @@
Setting temporary charge thresholds for BAT0:
- stop = 100
- start = 95
+ stop = 100 (Error: write failed)
+ start = 95 (Error: write failed)
--------------------------------------------------------------------------------
#23 sudo tlp setcharge -- NATACPI_ENABLE=0 START_CHARGE_THRESH_BAT0="DEF" STOP_CHARGE_THRESH_BAT0="DEF"
#24 #
#25 # --- tlp setcharge w/ arguments
#26 sudo tlp setcharge 60 100 -- X_SOC_CHECK=0
--------------------------------------------------------------------------------
[FAILED #26, line 64] sudo tlp setcharge 60 100 -- X_SOC_CHECK=0
@@ -1,3 +1,3 @@
Setting temporary charge thresholds for BAT0:
- start = 60
- stop = 100 (no change)
+ start = 60 (Error: write failed)
+ stop = 100 (Error: write failed)
--------------------------------------------------------------------------------
#27 sudo tlp setcharge 100 100 -- X_BAT_PLUGIN_SIMULATE=dell
#28 sudo tlp setcharge 50 0 -- X_BAT_PLUGIN_SIMULATE=dell
#29 sudo tlp setcharge 50 101 -- X_BAT_PLUGIN_SIMULATE=dell
#30 sudo tlp setcharge XYZZY 0 -- X_BAT_PLUGIN_SIMULATE=dell
#31 sudo tlp setcharge 50 XYZZY -- X_BAT_PLUGIN_SIMULATE=dell
#32 sudo tlp setcharge 90 91 -- X_BAT_PLUGIN_SIMULATE=dell
#33 sudo tlp setcharge 90 95 -- X_BAT_PLUGIN_SIMULATE=dell
--------------------------------------------------------------------------------
[FAILED #33, line 80] sudo tlp setcharge 90 95 -- X_BAT_PLUGIN_SIMULATE=dell
@@ -1,3 +1,3 @@
Setting temporary charge thresholds for BAT0:
- start = 90
- stop = 95
+ stop = 95 (Error: write failed)
+ start = 90 (Error: write failed)
--------------------------------------------------------------------------------
#34 sudo tlp setcharge 90 95 -- X_THRESH_SIMULATE_READERR="1"
#35 sudo tlp setcharge 90 95 -- X_BAT_PLUGIN_SIMULATE=dell
--------------------------------------------------------------------------------
[FAILED #35, line 86] sudo tlp setcharge 90 95 -- X_BAT_PLUGIN_SIMULATE=dell
@@ -1,3 +1,3 @@
Setting temporary charge thresholds for BAT0:
- start = 90 (no change)
- stop = 95 (no change)
+ stop = 95 (Error: write failed)
+ start = 90 (Error: write failed)
--------------------------------------------------------------------------------
#36 sudo tlp setcharge DEF DEF -- X_BAT_PLUGIN_SIMULATE=dell
--------------------------------------------------------------------------------
[FAILED #36, line 90] sudo tlp setcharge DEF DEF -- X_BAT_PLUGIN_SIMULATE=dell
@@ -1,3 +1,3 @@
Setting temporary charge thresholds for BAT0:
- stop = 100
- start = 95
+ stop = 100 (Error: write failed)
+ start = 95 (Error: write failed)
--------------------------------------------------------------------------------
#37 sudo tlp setcharge BAT1 -- X_BAT_PLUGIN_SIMULATE=dell
#38 sudo tlp setcharge 0 3 BAT1 -- X_BAT_PLUGIN_SIMULATE=dell
#39 sudo tlp setcharge XYZZY ABCDE BAT1 -- X_BAT_PLUGIN_SIMULATE=dell
#40 #
#41 # --- tlp-stat
#42 sudo tlp-stat -b | grep -E 'charge_(control|behaviour)'
--------------------------------------------------------------------------------
[FAILED #42, line 102] sudo tlp-stat -b | grep -E 'charge_(control|behaviour)'
@@ -1,2 +1,2 @@
-/sys/class/power_supply/BAT0/charge_control_start_threshold = 95 [%]
-/sys/class/power_supply/BAT0/charge_control_end_threshold = 100 [%]
+/sys/class/power_supply/BAT0/charge_control_start_threshold = 75 [%]
+/sys/class/power_supply/BAT0/charge_control_end_threshold = 80 [%]
--------------------------------------------------------------------------------
#43 sudo tlp-stat -b -- X_THRESH_SIMULATE_READERR=1 | grep -E 'charge_(control|behaviour)'
#44 #
#45 # --- Reset test machine to configured thresholds
#46 sudo tlp setcharge BAT0 > /dev/null 2>&1
#47 #
FAIL: 12 of 47 tests failed
grep . /sys/class/power_supply/BAT0/* 2> /dev/null | grep -v uevent/sys/class/power_supply/BAT0/alarm:0
/sys/class/power_supply/BAT0/capacity:79
/sys/class/power_supply/BAT0/capacity_level:Normal
/sys/class/power_supply/BAT0/charge_control_end_threshold:80
/sys/class/power_supply/BAT0/charge_control_start_threshold:75
/sys/class/power_supply/BAT0/charge_full:7340000
/sys/class/power_supply/BAT0/charge_full_design:8509000
/sys/class/power_supply/BAT0/charge_now:5827000
/sys/class/power_supply/BAT0/charge_types:Trickle Fast Standard Adaptive [Custom]
/sys/class/power_supply/BAT0/current_now:1000
/sys/class/power_supply/BAT0/cycle_count:0
/sys/class/power_supply/BAT0/manufacturer:SMP
/sys/class/power_supply/BAT0/model_name:DELL GPM0365
/sys/class/power_supply/BAT0/present:1
/sys/class/power_supply/BAT0/serial_number:1566
/sys/class/power_supply/BAT0/status:Not charging
/sys/class/power_supply/BAT0/technology:Li-ion
/sys/class/power_supply/BAT0/type:Battery
/sys/class/power_supply/BAT0/voltage_min_design:11400000
/sys/class/power_supply/BAT0/voltage_now:13017000
|
@Sempro97 looks as if the thresholds aren't writable at all. Please try manually:
|
@linrunner with this command i was able to change the thresholds: sudo ./unit-tests/charge-thresholds_dell #1 # +++ Dell laptops +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#2 #
#3 # --- tlp start
#4 sudo tlp start -- START_CHARGE_THRESH_BAT0= STOP_CHARGE_THRESH_BAT0= START_CHARGE_THRESH_BAT1= STOP_CHARGE_THRESH_BAT1=
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[FAILED #4, line 12] sudo tlp start -- START_CHARGE_THRESH_BAT0= STOP_CHARGE_THRESH_BAT0= START_CHARGE_THRESH_BAT1= STOP_CHARGE_THRESH_BAT1=
@@ -1 +1 @@
-TLP started in AC mode (auto).
+TLP started in battery mode (auto).
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#5 sudo tlp start -- START_CHARGE_THRESH_BAT0="60" STOP_CHARGE_THRESH_BAT0="100" START_CHARGE_THRESH_BAT1= STOP_CHARGE_THRESH_BAT1=
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[FAILED #5, line 14] sudo tlp start -- START_CHARGE_THRESH_BAT0="60" STOP_CHARGE_THRESH_BAT0="100" START_CHARGE_THRESH_BAT1= STOP_CHARGE_THRESH_BAT1=
@@ -1 +1 @@
-TLP started in AC mode (auto).
+TLP started in battery mode (auto).
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#6 sudo tlp start -- START_CHARGE_THRESH_BAT0="100" STOP_CHARGE_THRESH_BAT0="100" START_CHARGE_THRESH_BAT1= STOP_CHARGE_THRESH_BAT1=
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[FAILED #6, line 16] sudo tlp start -- START_CHARGE_THRESH_BAT0="100" STOP_CHARGE_THRESH_BAT0="100" START_CHARGE_THRESH_BAT1= STOP_CHARGE_THRESH_BAT1=
@@ -1,2 +1,2 @@
Error in configuration at START_CHARGE_THRESH_BAT0="100": not specified, invalid or out of range (50..95). Battery skipped.
-TLP started in AC mode (auto).
+TLP started in battery mode (auto).
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#7 sudo tlp start -- START_CHARGE_THRESH_BAT0="50" STOP_CHARGE_THRESH_BAT0="0" START_CHARGE_THRESH_BAT1= STOP_CHARGE_THRESH_BAT1=
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[FAILED #7, line 19] sudo tlp start -- START_CHARGE_THRESH_BAT0="50" STOP_CHARGE_THRESH_BAT0="0" START_CHARGE_THRESH_BAT1= STOP_CHARGE_THRESH_BAT1=
@@ -1,2 +1,2 @@
Error in configuration at STOP_CHARGE_THRESH_BAT0="0": not specified, invalid or out of range (55..100). Battery skipped.
-TLP started in AC mode (auto).
+TLP started in battery mode (auto).
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#8 sudo tlp start -- START_CHARGE_THRESH_BAT0="50" STOP_CHARGE_THRESH_BAT0="101" START_CHARGE_THRESH_BAT1= STOP_CHARGE_THRESH_BAT1=
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[FAILED #8, line 22] sudo tlp start -- START_CHARGE_THRESH_BAT0="50" STOP_CHARGE_THRESH_BAT0="101" START_CHARGE_THRESH_BAT1= STOP_CHARGE_THRESH_BAT1=
@@ -1,2 +1,2 @@
Error in configuration at STOP_CHARGE_THRESH_BAT0="101": not specified, invalid or out of range (55..100). Battery skipped.
-TLP started in AC mode (auto).
+TLP started in battery mode (auto).
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#9 sudo tlp start -- START_CHARGE_THRESH_BAT0="90" STOP_CHARGE_THRESH_BAT0="91" START_CHARGE_THRESH_BAT1= STOP_CHARGE_THRESH_BAT1=
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[FAILED #9, line 25] sudo tlp start -- START_CHARGE_THRESH_BAT0="90" STOP_CHARGE_THRESH_BAT0="91" START_CHARGE_THRESH_BAT1= STOP_CHARGE_THRESH_BAT1=
@@ -1,2 +1,2 @@
Error in configuration: START_CHARGE_THRESH_BAT0 > STOP_CHARGE_THRESH_BAT0 - 5. Battery skipped.
-TLP started in AC mode (auto).
+TLP started in battery mode (auto).
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#10 sudo tlp start -- START_CHARGE_THRESH_BAT0="90" STOP_CHARGE_THRESH_BAT0="95" START_CHARGE_THRESH_BAT1= STOP_CHARGE_THRESH_BAT1=
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[FAILED #10, line 28] sudo tlp start -- START_CHARGE_THRESH_BAT0="90" STOP_CHARGE_THRESH_BAT0="95" START_CHARGE_THRESH_BAT1= STOP_CHARGE_THRESH_BAT1=
@@ -1 +1 @@
-TLP started in AC mode (auto).
+TLP started in battery mode (auto).
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#11 sudo tlp start -- START_CHARGE_THRESH_BAT0="DEF" STOP_CHARGE_THRESH_BAT0="DEF" START_CHARGE_THRESH_BAT1= STOP_CHARGE_THRESH_BAT1=
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[FAILED #11, line 30] sudo tlp start -- START_CHARGE_THRESH_BAT0="DEF" STOP_CHARGE_THRESH_BAT0="DEF" START_CHARGE_THRESH_BAT1= STOP_CHARGE_THRESH_BAT1=
@@ -1 +1 @@
-TLP started in AC mode (auto).
+TLP started in battery mode (auto).
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#12 sudo tlp start -- NATACPI_ENABLE=0 START_CHARGE_THRESH_BAT0="DEF" STOP_CHARGE_THRESH_BAT0="DEF"
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[FAILED #12, line 32] sudo tlp start -- NATACPI_ENABLE=0 START_CHARGE_THRESH_BAT0="DEF" STOP_CHARGE_THRESH_BAT0="DEF"
@@ -1 +1 @@
-TLP started in AC mode (auto).
+TLP started in battery mode (auto).
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#13 #
#14 # --- tlp setcharge w/o arguments
#15 sudo tlp setcharge -- START_CHARGE_THRESH_BAT0="60" STOP_CHARGE_THRESH_BAT0="100" X_SOC_CHECK=0
#16 sudo tlp setcharge -- START_CHARGE_THRESH_BAT0="100" STOP_CHARGE_THRESH_BAT0="100"
#17 sudo tlp setcharge -- START_CHARGE_THRESH_BAT0="50" STOP_CHARGE_THRESH_BAT0="0"
#18 sudo tlp setcharge -- START_CHARGE_THRESH_BAT0="50" STOP_CHARGE_THRESH_BAT0="101"
#19 sudo tlp setcharge -- START_CHARGE_THRESH_BAT0="90" STOP_CHARGE_THRESH_BAT0="91"
#20 sudo tlp setcharge -- START_CHARGE_THRESH_BAT0="90" STOP_CHARGE_THRESH_BAT0="95"
#21 sudo tlp setcharge -- START_CHARGE_THRESH_BAT0="90" STOP_CHARGE_THRESH_BAT0="95"
#22 sudo tlp setcharge -- START_CHARGE_THRESH_BAT0="DEF" STOP_CHARGE_THRESH_BAT0="DEF"
#23 sudo tlp setcharge -- NATACPI_ENABLE=0 START_CHARGE_THRESH_BAT0="DEF" STOP_CHARGE_THRESH_BAT0="DEF"
#24 #
#25 # --- tlp setcharge w/ arguments
#26 sudo tlp setcharge 60 100 -- X_SOC_CHECK=0
#27 sudo tlp setcharge 100 100 -- X_BAT_PLUGIN_SIMULATE=dell
#28 sudo tlp setcharge 50 0 -- X_BAT_PLUGIN_SIMULATE=dell
#29 sudo tlp setcharge 50 101 -- X_BAT_PLUGIN_SIMULATE=dell
#30 sudo tlp setcharge XYZZY 0 -- X_BAT_PLUGIN_SIMULATE=dell
#31 sudo tlp setcharge 50 XYZZY -- X_BAT_PLUGIN_SIMULATE=dell
#32 sudo tlp setcharge 90 91 -- X_BAT_PLUGIN_SIMULATE=dell
#33 sudo tlp setcharge 90 95 -- X_BAT_PLUGIN_SIMULATE=dell
#34 sudo tlp setcharge 90 95 -- X_THRESH_SIMULATE_READERR="1"
#35 sudo tlp setcharge 90 95 -- X_BAT_PLUGIN_SIMULATE=dell
#36 sudo tlp setcharge DEF DEF -- X_BAT_PLUGIN_SIMULATE=dell
#37 sudo tlp setcharge BAT1 -- X_BAT_PLUGIN_SIMULATE=dell
#38 sudo tlp setcharge 0 3 BAT1 -- X_BAT_PLUGIN_SIMULATE=dell
#39 sudo tlp setcharge XYZZY ABCDE BAT1 -- X_BAT_PLUGIN_SIMULATE=dell
#40 #
#41 # --- tlp-stat
#42 sudo tlp-stat -b | grep -E 'charge_(control|behaviour)'
#43 sudo tlp-stat -b -- X_THRESH_SIMULATE_READERR=1 | grep -E 'charge_(control|behaviour)'
#44 #
#45 # --- Reset test machine to configured thresholds
#46 sudo tlp setcharge BAT0 > /dev/null 2>&1
#47 #
FAIL: 9 of 47 tests failed
sudo tlp-stat -s -b -v --- TLP 1.7.0 --------------------------------------------
+++ System Info
System = Dell Inc. XPS 15 9560
BIOS = 1.31.0
OS Release = Ubuntu 24.04.1 LTS
Kernel = 6.12.4-serro #1 SMP PREEMPT_DYNAMIC Mon Dec 9 23:50:07 CET 2024 x86_64
/proc/cmdline = BOOT_IMAGE=/boot/vmlinuz-6.12.4-serro root=UUID=57a7eaba-23b9-4dbc-9def-e8737e17fea3 ro
Init system = systemd v255 (255.4-1ubuntu8.4)
Boot mode = UEFI
Suspend mode = s2idle [deep]
+++ TLP Status
State = enabled
RDW state = enabled
Last run = 11:01:37 PM, 62 sec(s) ago
Mode = battery
Power source = battery
+++ Battery Care
Plugin: dell
Supported features: charge thresholds
Driver usage:
* natacpi (dell_laptop) = active (charge thresholds)
Parameter value ranges:
* START_CHARGE_THRESH_BAT0/1: 50..95(default)
* STOP_CHARGE_THRESH_BAT0/1: 55..100(default)
+++ Battery Status: BAT0
/sys/class/power_supply/BAT0/manufacturer = SMP
/sys/class/power_supply/BAT0/model_name = DELL GPM0365
/sys/class/power_supply/BAT0/cycle_count = 0 (or not supported)
/sys/class/power_supply/BAT0/charge_full_design = 8509 [mAh]
/sys/class/power_supply/BAT0/charge_full = 7340 [mAh]
/sys/class/power_supply/BAT0/charge_now = 4835 [mAh]
/sys/class/power_supply/BAT0/current_now = 743 [mA]
/sys/class/power_supply/BAT0/status = Discharging
/sys/class/power_supply/BAT0/voltage_min_design = 11400 [mV]
/sys/class/power_supply/BAT0/voltage_now = 12336 [mV]
/sys/class/power_supply/BAT0/charge_control_start_threshold = 95 [%]
/sys/class/power_supply/BAT0/charge_control_end_threshold = 100 [%]
/sys/class/power_supply/BAT0/charge_types = Trickle Fast Standard Adaptive [Custom] [%]
Charge = 65.9 [%]
Capacity = 86.3 [%]
EDIT: I was running tests without ac plugged. With the ac plugged all test pass! sudo ./unit-tests/charge-thresholds_dell#1 # +++ Dell laptops +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#2 #
#3 # --- tlp start
#4 sudo tlp start -- START_CHARGE_THRESH_BAT0= STOP_CHARGE_THRESH_BAT0= START_CHARGE_THRESH_BAT1= STOP_CHARGE_THRESH_BAT1=
#5 sudo tlp start -- START_CHARGE_THRESH_BAT0="60" STOP_CHARGE_THRESH_BAT0="100" START_CHARGE_THRESH_BAT1= STOP_CHARGE_THRESH_BAT1=
#6 sudo tlp start -- START_CHARGE_THRESH_BAT0="100" STOP_CHARGE_THRESH_BAT0="100" START_CHARGE_THRESH_BAT1= STOP_CHARGE_THRESH_BAT1=
#7 sudo tlp start -- START_CHARGE_THRESH_BAT0="50" STOP_CHARGE_THRESH_BAT0="0" START_CHARGE_THRESH_BAT1= STOP_CHARGE_THRESH_BAT1=
#8 sudo tlp start -- START_CHARGE_THRESH_BAT0="50" STOP_CHARGE_THRESH_BAT0="101" START_CHARGE_THRESH_BAT1= STOP_CHARGE_THRESH_BAT1=
#9 sudo tlp start -- START_CHARGE_THRESH_BAT0="90" STOP_CHARGE_THRESH_BAT0="91" START_CHARGE_THRESH_BAT1= STOP_CHARGE_THRESH_BAT1=
#10 sudo tlp start -- START_CHARGE_THRESH_BAT0="90" STOP_CHARGE_THRESH_BAT0="95" START_CHARGE_THRESH_BAT1= STOP_CHARGE_THRESH_BAT1=
#11 sudo tlp start -- START_CHARGE_THRESH_BAT0="DEF" STOP_CHARGE_THRESH_BAT0="DEF" START_CHARGE_THRESH_BAT1= STOP_CHARGE_THRESH_BAT1=
#12 sudo tlp start -- NATACPI_ENABLE=0 START_CHARGE_THRESH_BAT0="DEF" STOP_CHARGE_THRESH_BAT0="DEF"
#13 #
#14 # --- tlp setcharge w/o arguments
#15 sudo tlp setcharge -- START_CHARGE_THRESH_BAT0="60" STOP_CHARGE_THRESH_BAT0="100" X_SOC_CHECK=0
#16 sudo tlp setcharge -- START_CHARGE_THRESH_BAT0="100" STOP_CHARGE_THRESH_BAT0="100"
#17 sudo tlp setcharge -- START_CHARGE_THRESH_BAT0="50" STOP_CHARGE_THRESH_BAT0="0"
#18 sudo tlp setcharge -- START_CHARGE_THRESH_BAT0="50" STOP_CHARGE_THRESH_BAT0="101"
#19 sudo tlp setcharge -- START_CHARGE_THRESH_BAT0="90" STOP_CHARGE_THRESH_BAT0="91"
#20 sudo tlp setcharge -- START_CHARGE_THRESH_BAT0="90" STOP_CHARGE_THRESH_BAT0="95"
#21 sudo tlp setcharge -- START_CHARGE_THRESH_BAT0="90" STOP_CHARGE_THRESH_BAT0="95"
#22 sudo tlp setcharge -- START_CHARGE_THRESH_BAT0="DEF" STOP_CHARGE_THRESH_BAT0="DEF"
#23 sudo tlp setcharge -- NATACPI_ENABLE=0 START_CHARGE_THRESH_BAT0="DEF" STOP_CHARGE_THRESH_BAT0="DEF"
#24 #
#25 # --- tlp setcharge w/ arguments
#26 sudo tlp setcharge 60 100 -- X_SOC_CHECK=0
#27 sudo tlp setcharge 100 100 -- X_BAT_PLUGIN_SIMULATE=dell
#28 sudo tlp setcharge 50 0 -- X_BAT_PLUGIN_SIMULATE=dell
#29 sudo tlp setcharge 50 101 -- X_BAT_PLUGIN_SIMULATE=dell
#30 sudo tlp setcharge XYZZY 0 -- X_BAT_PLUGIN_SIMULATE=dell
#31 sudo tlp setcharge 50 XYZZY -- X_BAT_PLUGIN_SIMULATE=dell
#32 sudo tlp setcharge 90 91 -- X_BAT_PLUGIN_SIMULATE=dell
#33 sudo tlp setcharge 90 95 -- X_BAT_PLUGIN_SIMULATE=dell
#34 sudo tlp setcharge 90 95 -- X_THRESH_SIMULATE_READERR="1"
#35 sudo tlp setcharge 90 95 -- X_BAT_PLUGIN_SIMULATE=dell
#36 sudo tlp setcharge DEF DEF -- X_BAT_PLUGIN_SIMULATE=dell
#37 sudo tlp setcharge BAT1 -- X_BAT_PLUGIN_SIMULATE=dell
#38 sudo tlp setcharge 0 3 BAT1 -- X_BAT_PLUGIN_SIMULATE=dell
#39 sudo tlp setcharge XYZZY ABCDE BAT1 -- X_BAT_PLUGIN_SIMULATE=dell
#40 #
#41 # --- tlp-stat
#42 sudo tlp-stat -b | grep -E 'charge_(control|behaviour)'
#43 sudo tlp-stat -b -- X_THRESH_SIMULATE_READERR=1 | grep -E 'charge_(control|behaviour)'
#44 #
#45 # --- Reset test machine to configured thresholds
#46 sudo tlp setcharge BAT0 > /dev/null 2>&1
#47 #
OK: 47 of 47 tests passed
|
This is of little help here because the
//--- Nonsense deleted
|
TLP 1.8.0 Beta 1 has been released. Please test again if it works for you -> #781 |
This is probably in the wrong issue now, but I'm not sure which should be used... My charge type was always set to custom using smbios, which I use until TLP is ready and available in Fedora Stable. # uname -a
TLP/unit-tests# ./test-bc_cros-ec-v2.sh
# tlp-stat -s -b -v
# grep . /sys/class/power_supply/BAT0/* 2> /dev/null | grep -v ueven
TLP/unit-tests# ./charge-thresholds_dell
|
No problem :-)
Waving the fencepost: there's a beta repo.
Good to know as an alternative to cctk but from regular distribution repositories. 👍
Fedora is still stuck at 1.6.1, I don't know why the maintainer stopped working on it.
Wrong test. test-bc_cros-ec-v2.sh is for testing on Chromebooks and Frameworks only. Since these laptops also use charge_control_*_threshold, it partially works on Dell too.
Perfect. Thank you very much for testing. |
Thank for the pointing me to the beta repo, I was not aware that :) Once a stable release is made I will contact the tlp maintainers and ask for the update. I assume TLP 'just works' for most people so no upgrade might be necessary. With the option to control charge on Dell I hope I can provide a reason to upgrade the package soon :) |
I have just released TLP 1.8.0. Thanks for your contributions. Have fun! |
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: