adjustor 2.1.4__tar.gz → 2.1.5__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. {adjustor-2.1.4/src/adjustor.egg-info → adjustor-2.1.5}/PKG-INFO +1 -1
  2. {adjustor-2.1.4 → adjustor-2.1.5}/pyproject.toml +1 -1
  3. {adjustor-2.1.4 → adjustor-2.1.5}/src/adjustor/drivers/asus/__init__.py +38 -0
  4. {adjustor-2.1.4 → adjustor-2.1.5}/src/adjustor/drivers/asus/settings.yml +29 -1
  5. {adjustor-2.1.4 → adjustor-2.1.5}/src/adjustor/drivers/smu/smu.yml +0 -1
  6. {adjustor-2.1.4 → adjustor-2.1.5}/src/adjustor/hhd.py +8 -7
  7. adjustor-2.1.5/src/adjustor/i18n.py +2 -0
  8. {adjustor-2.1.4 → adjustor-2.1.5/src/adjustor.egg-info}/PKG-INFO +1 -1
  9. {adjustor-2.1.4 → adjustor-2.1.5}/src/adjustor.egg-info/SOURCES.txt +1 -0
  10. {adjustor-2.1.4 → adjustor-2.1.5}/LICENSE +0 -0
  11. {adjustor-2.1.4 → adjustor-2.1.5}/MANIFEST.in +0 -0
  12. {adjustor-2.1.4 → adjustor-2.1.5}/readme.md +0 -0
  13. {adjustor-2.1.4 → adjustor-2.1.5}/setup.cfg +0 -0
  14. {adjustor-2.1.4 → adjustor-2.1.5}/src/adjustor/__init__.py +0 -0
  15. {adjustor-2.1.4 → adjustor-2.1.5}/src/adjustor/__main__.py +0 -0
  16. {adjustor-2.1.4 → adjustor-2.1.5}/src/adjustor/core/__init__.py +0 -0
  17. {adjustor-2.1.4 → adjustor-2.1.5}/src/adjustor/core/acpi.py +0 -0
  18. {adjustor-2.1.4 → adjustor-2.1.5}/src/adjustor/core/alib.py +0 -0
  19. {adjustor-2.1.4 → adjustor-2.1.5}/src/adjustor/core/const.py +0 -0
  20. {adjustor-2.1.4 → adjustor-2.1.5}/src/adjustor/core/lenovo.py +0 -0
  21. {adjustor-2.1.4 → adjustor-2.1.5}/src/adjustor/core/platform.py +0 -0
  22. {adjustor-2.1.4 → adjustor-2.1.5}/src/adjustor/drivers/__init__.py +0 -0
  23. {adjustor-2.1.4 → adjustor-2.1.5}/src/adjustor/drivers/lenovo/__init__.py +0 -0
  24. {adjustor-2.1.4 → adjustor-2.1.5}/src/adjustor/drivers/lenovo/settings.yml +0 -0
  25. {adjustor-2.1.4 → adjustor-2.1.5}/src/adjustor/drivers/smu/__init__.py +0 -0
  26. {adjustor-2.1.4 → adjustor-2.1.5}/src/adjustor/drivers/smu/qam.yml +0 -0
  27. {adjustor-2.1.4 → adjustor-2.1.5}/src/adjustor/events.py +0 -0
  28. {adjustor-2.1.4 → adjustor-2.1.5}/src/adjustor/settings.yml +0 -0
  29. {adjustor-2.1.4 → adjustor-2.1.5}/src/adjustor/utils.py +0 -0
  30. {adjustor-2.1.4 → adjustor-2.1.5}/src/adjustor.egg-info/dependency_links.txt +0 -0
  31. {adjustor-2.1.4 → adjustor-2.1.5}/src/adjustor.egg-info/entry_points.txt +0 -0
  32. {adjustor-2.1.4 → adjustor-2.1.5}/src/adjustor.egg-info/requires.txt +0 -0
  33. {adjustor-2.1.4 → adjustor-2.1.5}/src/adjustor.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: adjustor
3
- Version: 2.1.4
3
+ Version: 2.1.5
4
4
  Summary: Adjustor, a userspace program for managing the TDP of handheld devices.
5
5
  Author-email: Kapenekakis Antheas <pypi@antheas.dev>
6
6
  Project-URL: Homepage, https://github.com/hhd-dev/adjustor
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "adjustor"
3
- version = "2.1.4"
3
+ version = "2.1.5"
4
4
  authors = [
5
5
  { name="Kapenekakis Antheas", email="pypi@antheas.dev" },
6
6
  ]
@@ -32,6 +32,20 @@ MIN_CURVE = [2, 5, 17, 17, 17, 17, 17, 17]
32
32
  DEFAULT_CURVE = [5, 10, 20, 35, 55, 75, 75, 75]
33
33
 
34
34
 
35
+ def set_charge_limit(lim: int):
36
+ try:
37
+ # FIXME: Hardcoded path, should match using another characteristic
38
+ logger.info(f"Setting charge limit to {lim:d} %.")
39
+ with open(
40
+ "/sys/class/power_supply/BAT0/charge_control_end_threshold", "w"
41
+ ) as f:
42
+ f.write(f"{lim}\n")
43
+ return True
44
+ except Exception as e:
45
+ logger.error(f"Failed to write battery limit with error:\n{e}")
46
+ return False
47
+
48
+
35
49
  def set_tdp(pretty: str, fn: str, val: int):
36
50
  logger.info(f"Setting tdp value '{pretty}' to {val} by writing to:\n{fn}")
37
51
  try:
@@ -148,6 +162,30 @@ class AsusDriverPlugin(HHDPlugin):
148
162
 
149
163
  curr = time.time()
150
164
 
165
+ # Charge limit
166
+ lim = conf["tdp.asus.charge_limit"].to(str)
167
+ if (self.startup and lim != "disabled") or (
168
+ lim != self.old_conf["charge_limit"].to(str)
169
+ ):
170
+ match lim:
171
+ case "p65":
172
+ set_charge_limit(65)
173
+ case "p70":
174
+ set_charge_limit(70)
175
+ case "p80":
176
+ set_charge_limit(80)
177
+ case "p85":
178
+ set_charge_limit(85)
179
+ case "p90":
180
+ set_charge_limit(90)
181
+ case "p95":
182
+ set_charge_limit(95)
183
+ case "disabled":
184
+ # Avoid writing charge limit on startup if
185
+ # disabled
186
+ if not self.startup:
187
+ set_charge_limit(100)
188
+
151
189
  #
152
190
  # TDP
153
191
  #
@@ -95,4 +95,32 @@ children:
95
95
  type: display
96
96
  default: >-
97
97
  Asus hardware limits the minimum fan curve depending on TDP.
98
- The minimums are 25%, 50%, and 75% for low, middle, and high TDPs.
98
+ The minimums are 25%, 50%, and 75% for low, medium, and high TDPs.
99
+
100
+ charge_limit:
101
+ type: multiple
102
+ title: Charge Limit (%)
103
+ tags: [ non-essential ]
104
+ hint: >-
105
+ Applies a charge limit to the battery, 75% and up.
106
+ options:
107
+ disabled: Disabled
108
+ p65: 65%
109
+ p70: 70%
110
+ p80: 80%
111
+ p85: 85%
112
+ p90: 90%
113
+ p95: 95%
114
+ default: disabled
115
+
116
+ disclaimer:
117
+ title: Sleep Bug
118
+ type: display
119
+ tags: [ non-essential ]
120
+ default: >-
121
+ There is an Asus kernel/BIOS bug that will sometimes limit TDP to 10W
122
+ after sleep.
123
+ As the kernel driver is used, this is unfixable from within
124
+ Handheld Daemon (currently investigated).
125
+ As an alternative, use SimpleDeckyTDP with RyzenAdj after
126
+ disabling TDP controls from "Settings".
@@ -1,7 +1,6 @@
1
1
  type: container
2
2
  title: Advanced Configurator
3
3
  tags: [advanced, expert]
4
- hint: >-
5
4
  children:
6
5
  apply:
7
6
  type: action
@@ -1,16 +1,18 @@
1
1
  import logging
2
2
  import os
3
- from threading import Event as TEvent, Thread
3
+ from threading import Event as TEvent
4
+ from threading import Thread
4
5
  from typing import Sequence
5
6
 
6
- from hhd.utils import expanduser
7
7
  from hhd.plugins import Context, HHDPlugin, HHDSettings, load_relative_yaml
8
8
  from hhd.plugins.conf import Config
9
9
  from hhd.plugins.plugin import Emitter
10
+ from hhd.utils import expanduser
10
11
 
11
12
  from adjustor.core.acpi import check_perms, initialize
12
13
  from adjustor.core.const import CPU_DATA, DEV_DATA, ROG_ALLY_PP_MAP
13
14
 
15
+ from .i18n import _
14
16
  from .utils import exists_sentinel, install_sentinel, remove_sentinel
15
17
 
16
18
  logger = logging.getLogger(__name__)
@@ -55,7 +57,7 @@ class AdjustorInitPlugin(HHDPlugin):
55
57
  conf["hhd.settings.tdp_enable"] = False
56
58
  if self.safe_mode:
57
59
  logger.warning(f"Due to a sentinel error, auto-start is disabled.")
58
- conf["tdp.tdp.tdp_error"] = (
60
+ conf["tdp.tdp.tdp_error"] = _(
59
61
  "Due to a suspected crash, auto-start was disabled."
60
62
  )
61
63
  conf["hhd.settings.tdp_enable"] = False
@@ -68,9 +70,8 @@ class AdjustorInitPlugin(HHDPlugin):
68
70
 
69
71
  for name, path in CONFLICTING_PLUGINS.items():
70
72
  if os.path.exists(expanduser(path, self.context)):
71
- err = (
72
- f'Found plugin "{name}" at the following path:\n{path}\n'
73
- + "TDP Controls can not be enabled while other TDP plugins are installed."
73
+ err = f'Found plugin "{name}" at the following path:\n{path}\n' + _(
74
+ "TDP Controls can not be enabled while other TDP plugins are installed."
74
75
  )
75
76
  conf["tdp.tdp.tdp_error"] = err
76
77
  conf["hhd.settings.tdp_enable"] = False
@@ -169,8 +170,8 @@ def autodetect(existing: Sequence[HHDPlugin]) -> Sequence[HHDPlugin]:
169
170
  if len(existing):
170
171
  return existing
171
172
 
172
- from .drivers.lenovo import LenovoDriverPlugin
173
173
  from .drivers.asus import AsusDriverPlugin
174
+ from .drivers.lenovo import LenovoDriverPlugin
174
175
  from .drivers.smu import SmuDriverPlugin, SmuQamPlugin
175
176
 
176
177
  drivers = []
@@ -0,0 +1,2 @@
1
+ def _(arg: str):
2
+ return arg
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: adjustor
3
- Version: 2.1.4
3
+ Version: 2.1.5
4
4
  Summary: Adjustor, a userspace program for managing the TDP of handheld devices.
5
5
  Author-email: Kapenekakis Antheas <pypi@antheas.dev>
6
6
  Project-URL: Homepage, https://github.com/hhd-dev/adjustor
@@ -6,6 +6,7 @@ src/adjustor/__init__.py
6
6
  src/adjustor/__main__.py
7
7
  src/adjustor/events.py
8
8
  src/adjustor/hhd.py
9
+ src/adjustor/i18n.py
9
10
  src/adjustor/settings.yml
10
11
  src/adjustor/utils.py
11
12
  src/adjustor.egg-info/PKG-INFO
File without changes
File without changes
File without changes
File without changes
File without changes