adjustor 3.5.0__tar.gz → 3.5.2__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. {adjustor-3.5.0/src/adjustor.egg-info → adjustor-3.5.2}/PKG-INFO +1 -1
  2. {adjustor-3.5.0 → adjustor-3.5.2}/pyproject.toml +1 -1
  3. {adjustor-3.5.0 → adjustor-3.5.2}/src/adjustor/drivers/amd/__init__.py +3 -1
  4. {adjustor-3.5.0 → adjustor-3.5.2}/src/adjustor/drivers/asus/__init__.py +14 -7
  5. {adjustor-3.5.0 → adjustor-3.5.2}/src/adjustor/drivers/general/__init__.py +69 -0
  6. {adjustor-3.5.0 → adjustor-3.5.2/src/adjustor.egg-info}/PKG-INFO +1 -1
  7. {adjustor-3.5.0 → adjustor-3.5.2}/LICENSE +0 -0
  8. {adjustor-3.5.0 → adjustor-3.5.2}/MANIFEST.in +0 -0
  9. {adjustor-3.5.0 → adjustor-3.5.2}/readme.md +0 -0
  10. {adjustor-3.5.0 → adjustor-3.5.2}/setup.cfg +0 -0
  11. {adjustor-3.5.0 → adjustor-3.5.2}/src/adjustor/__init__.py +0 -0
  12. {adjustor-3.5.0 → adjustor-3.5.2}/src/adjustor/__main__.py +0 -0
  13. {adjustor-3.5.0 → adjustor-3.5.2}/src/adjustor/core/__init__.py +0 -0
  14. {adjustor-3.5.0 → adjustor-3.5.2}/src/adjustor/core/acpi.py +0 -0
  15. {adjustor-3.5.0 → adjustor-3.5.2}/src/adjustor/core/alib.py +0 -0
  16. {adjustor-3.5.0 → adjustor-3.5.2}/src/adjustor/core/const.py +0 -0
  17. {adjustor-3.5.0 → adjustor-3.5.2}/src/adjustor/core/lenovo.py +0 -0
  18. {adjustor-3.5.0 → adjustor-3.5.2}/src/adjustor/core/platform.py +0 -0
  19. {adjustor-3.5.0 → adjustor-3.5.2}/src/adjustor/drivers/__init__.py +0 -0
  20. {adjustor-3.5.0 → adjustor-3.5.2}/src/adjustor/drivers/amd/power-profiles-daemon.dbus.xml.in +0 -0
  21. {adjustor-3.5.0 → adjustor-3.5.2}/src/adjustor/drivers/amd/ppd.py +0 -0
  22. {adjustor-3.5.0 → adjustor-3.5.2}/src/adjustor/drivers/amd/settings.yml +0 -0
  23. {adjustor-3.5.0 → adjustor-3.5.2}/src/adjustor/drivers/asus/settings.yml +0 -0
  24. {adjustor-3.5.0 → adjustor-3.5.2}/src/adjustor/drivers/general/settings.yml +0 -0
  25. {adjustor-3.5.0 → adjustor-3.5.2}/src/adjustor/drivers/lenovo/__init__.py +0 -0
  26. {adjustor-3.5.0 → adjustor-3.5.2}/src/adjustor/drivers/lenovo/settings.yml +0 -0
  27. {adjustor-3.5.0 → adjustor-3.5.2}/src/adjustor/drivers/smu/__init__.py +0 -0
  28. {adjustor-3.5.0 → adjustor-3.5.2}/src/adjustor/drivers/smu/qam.yml +0 -0
  29. {adjustor-3.5.0 → adjustor-3.5.2}/src/adjustor/drivers/smu/smu.yml +0 -0
  30. {adjustor-3.5.0 → adjustor-3.5.2}/src/adjustor/events.py +0 -0
  31. {adjustor-3.5.0 → adjustor-3.5.2}/src/adjustor/fuse/__init__.py +0 -0
  32. {adjustor-3.5.0 → adjustor-3.5.2}/src/adjustor/fuse/driver.py +0 -0
  33. {adjustor-3.5.0 → adjustor-3.5.2}/src/adjustor/fuse/gpu.py +0 -0
  34. {adjustor-3.5.0 → adjustor-3.5.2}/src/adjustor/fuse/utils.py +0 -0
  35. {adjustor-3.5.0 → adjustor-3.5.2}/src/adjustor/hhd.py +0 -0
  36. {adjustor-3.5.0 → adjustor-3.5.2}/src/adjustor/i18n.py +0 -0
  37. {adjustor-3.5.0 → adjustor-3.5.2}/src/adjustor/settings.yml +0 -0
  38. {adjustor-3.5.0 → adjustor-3.5.2}/src/adjustor.egg-info/SOURCES.txt +0 -0
  39. {adjustor-3.5.0 → adjustor-3.5.2}/src/adjustor.egg-info/dependency_links.txt +0 -0
  40. {adjustor-3.5.0 → adjustor-3.5.2}/src/adjustor.egg-info/entry_points.txt +0 -0
  41. {adjustor-3.5.0 → adjustor-3.5.2}/src/adjustor.egg-info/requires.txt +0 -0
  42. {adjustor-3.5.0 → adjustor-3.5.2}/src/adjustor.egg-info/top_level.txt +0 -0
  43. {adjustor-3.5.0 → adjustor-3.5.2}/usr/share/dbus-1/system.d/hhd-net.hadess.PowerProfiles.conf +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: adjustor
3
- Version: 3.5.0
3
+ Version: 3.5.2
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 = "3.5.0"
3
+ version = "3.5.2"
4
4
  authors = [
5
5
  { name="Kapenekakis Antheas", email="pypi@antheas.dev" },
6
6
  ]
@@ -142,11 +142,13 @@ class AmdGPUPlugin(HHDPlugin):
142
142
 
143
143
  if self.ppd_conflict and os.environ.get("HHD_PPD_MASK", None):
144
144
  logger.warning(
145
- "PPD conflict detected but HHD_PPD_MASK is set. Masking PPD."
145
+ "PPD conflict detected but HHD_PPD_MASK is set. Masking PPD/TuneD."
146
146
  )
147
147
  # Mask and disable
148
148
  os.system("systemctl mask power-profiles-daemon.service")
149
149
  os.system("systemctl disable --now power-profiles-daemon.service")
150
+ os.system("systemctl mask tuned.service")
151
+ os.system("systemctl disable --now tuned.service")
150
152
  # Keep going without check to avoid obscure errors
151
153
  self.ppd_conflict = False
152
154
 
@@ -24,6 +24,7 @@ CTDP_FN = "/sys/devices/platform/asus-nb-wmi/ppt_pl1_spl"
24
24
  EXTREME_FN = "/sys/devices/platform/asus-nb-wmi/mcu_powersave"
25
25
  EXTREME_ENABLE = bool(os.environ.get("HHD_ALLY_POWERSAVE", None))
26
26
  # This setting can really mess up the controller
27
+ EXTREME_STARTUP_DELAY = 12
27
28
  EXTREME_DELAY = 3.8
28
29
 
29
30
  FAN_CURVE_ENDPOINT = "/sys/class/hwmon"
@@ -147,7 +148,7 @@ class AsusDriverPlugin(HHDPlugin):
147
148
  self.queue_fan = None
148
149
  self.queue_tdp = None
149
150
  self.queue_charge_limit = None
150
- self.queue_extreme = None
151
+ self.queue_extreme = time.perf_counter() + EXTREME_STARTUP_DELAY
151
152
  self.new_tdp = None
152
153
  self.new_mode = None
153
154
  self.old_target = None
@@ -216,7 +217,7 @@ class AsusDriverPlugin(HHDPlugin):
216
217
  self.old_conf = conf["tdp.asus"]
217
218
  return
218
219
 
219
- curr = time.time()
220
+ curr = time.perf_counter()
220
221
 
221
222
  # Charge limit
222
223
  lim = conf["tdp.asus.charge_limit"].to(str)
@@ -461,16 +462,22 @@ class AsusDriverPlugin(HHDPlugin):
461
462
  # Extreme standby
462
463
  if self.extreme_supported:
463
464
  standby = conf["tdp.asus.extreme_standby"].to(bool)
464
- if standby != self.extreme_standby:
465
- self.extreme_standby = standby
465
+ if self.extreme_standby is not None and self.extreme_standby != standby:
466
466
  self.queue_extreme = curr + EXTREME_DELAY
467
+ self.extreme_standby = standby
467
468
 
468
469
  if self.queue_extreme and self.queue_extreme < curr:
469
470
  self.queue_extreme = None
470
471
  try:
471
- logger.info (f"Setting extreme standby to '{standby}'")
472
- with open(EXTREME_FN, "w") as f:
473
- f.write("1" if standby == "enabled" else "0")
472
+ nval = standby == "enabled"
473
+ with open(EXTREME_FN, "r") as f:
474
+ cval = f.read().strip() == "1"
475
+ if nval != cval:
476
+ logger.info (f"Setting extreme standby to '{standby}'")
477
+ with open(EXTREME_FN, "w") as f:
478
+ f.write("1" if standby == "enabled" else "0")
479
+ else:
480
+ logger.info(f"Extreme standby already set to '{standby}'")
474
481
  except Exception as e:
475
482
  logger.error(f"Could not set extreme standby. Error:\n{e}")
476
483
 
@@ -27,6 +27,7 @@ class GeneralPowerPlugin(HHDPlugin):
27
27
  self.old_sched = None
28
28
  self.sched_proc = None
29
29
  self.ppd_supported = None
30
+ self.tuned_supported = None
30
31
  self.is_steamdeck = is_steamdeck
31
32
  self.ovr_enabled = False
32
33
  self.should_exit = Event()
@@ -54,6 +55,26 @@ class GeneralPowerPlugin(HHDPlugin):
54
55
  except Exception as e:
55
56
  logger.warning(f"powerprofilectl returned with error:\n{e}")
56
57
 
58
+ # TuneD
59
+ if self.tuned_supported is None:
60
+ self.tuned_supported = False
61
+ if tuned := shutil.which('tuned-adm'):
62
+ try:
63
+ if os.environ.get("HHD_PPD_MASK", None):
64
+ logger.info("Unmasking TuneD in the case it was masked.")
65
+ os.system('systemctl unmask tuned')
66
+ subprocess.run(
67
+ [tuned],
68
+ check=True,
69
+ stdin=subprocess.DEVNULL,
70
+ stdout=subprocess.DEVNULL,
71
+ stderr=subprocess.DEVNULL,
72
+ )
73
+ self.tuned_supported = True
74
+ except Exception as e:
75
+ logger.warning(f"tuned-adm returned with error:\n{e}")
76
+
77
+
57
78
  if not self.ppd_supported:
58
79
  del sets["children"]["profile"]
59
80
 
@@ -122,6 +143,54 @@ class GeneralPowerPlugin(HHDPlugin):
122
143
  logger.warning(f"powerprofilectl returned with error:\n{e}")
123
144
  self.ppd_supported = False
124
145
 
146
+ # Handle TuneD
147
+ if self.tuned_supported:
148
+ curr = time.time()
149
+ ppd_tuned_mapping = {
150
+ "power-saver": "powersave",
151
+ "balanced": "balanced",
152
+ "performance": "throughput-performance"
153
+ }
154
+ new_profile = ppd_tuned_mapping.get(conf.get("tdp.general.profile", self.target))
155
+ if new_profile != self.target and new_profile and self.target:
156
+ logger.info(f"Setting TuneD profile to '{new_profile}'")
157
+ self.target = new_profile
158
+ try:
159
+ subprocess.run(
160
+ [shutil.which('tuned-adm'), "profile", new_profile],
161
+ check=True,
162
+ stdout=subprocess.PIPE,
163
+ stderr=subprocess.PIPE,
164
+ )
165
+ except Exception as e:
166
+ self.tuned_supported = False
167
+ logger.warning(f"tuned-adm returned with error:\n{e}")
168
+ self.tuned_supported = False
169
+ elif not self.last_check or curr - self.last_check > 2:
170
+ # Update profile every 2 seconds
171
+ self.last_check = curr
172
+ try:
173
+ res = subprocess.run(
174
+ [shutil.which('tuned-adm'), "active"],
175
+ check=True,
176
+ stdout=subprocess.PIPE,
177
+ stderr=subprocess.PIPE,
178
+ )
179
+
180
+ tuned_ppd_mapping = {
181
+ "powersave": "power-saver",
182
+ "balanced": "balanced",
183
+ "throughput-performance": "performance"
184
+ }
185
+ self.target = tuned_ppd_mapping.get(res.stdout.decode().split(":")[1].strip()) # type: ignore
186
+
187
+ if self.target != conf["tdp.general.profile"].to(str):
188
+ conf["tdp.general.profile"] = self.target
189
+ except Exception as e:
190
+ self.tuned_supported = False
191
+ logger.warning(f"powerprofilectl returned with error:\n{e}")
192
+ self.tuned_supported = False
193
+
125
194
  # Handle sched
126
195
  if self.avail_scheds:
127
196
  # Check health and print error
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: adjustor
3
- Version: 3.5.0
3
+ Version: 3.5.2
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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes