adjustor 3.7.6__tar.gz → 3.7.7__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. {adjustor-3.7.6/src/adjustor.egg-info → adjustor-3.7.7}/PKG-INFO +1 -1
  2. {adjustor-3.7.6 → adjustor-3.7.7}/pyproject.toml +1 -1
  3. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor/core/const.py +46 -31
  4. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor/drivers/amd/ppd.py +37 -15
  5. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor/drivers/smu/__init__.py +26 -33
  6. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor/hhd.py +7 -7
  7. {adjustor-3.7.6 → adjustor-3.7.7/src/adjustor.egg-info}/PKG-INFO +1 -1
  8. {adjustor-3.7.6 → adjustor-3.7.7}/LICENSE +0 -0
  9. {adjustor-3.7.6 → adjustor-3.7.7}/MANIFEST.in +0 -0
  10. {adjustor-3.7.6 → adjustor-3.7.7}/readme.md +0 -0
  11. {adjustor-3.7.6 → adjustor-3.7.7}/setup.cfg +0 -0
  12. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor/__init__.py +0 -0
  13. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor/__main__.py +0 -0
  14. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor/core/__init__.py +0 -0
  15. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor/core/acpi.py +0 -0
  16. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor/core/alib.py +0 -0
  17. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor/core/fan/__init__.py +0 -0
  18. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor/core/fan/__main__.py +0 -0
  19. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor/core/fan/alg.py +0 -0
  20. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor/core/fan/core.py +0 -0
  21. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor/core/fan/utils.py +0 -0
  22. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor/core/lenovo.py +0 -0
  23. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor/core/platform.py +0 -0
  24. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor/drivers/__init__.py +0 -0
  25. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor/drivers/amd/__init__.py +0 -0
  26. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor/drivers/amd/power-profiles-daemon.dbus.xml.in +0 -0
  27. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor/drivers/amd/settings.yml +0 -0
  28. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor/drivers/asus/__init__.py +0 -0
  29. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor/drivers/asus/settings.yml +0 -0
  30. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor/drivers/general/__init__.py +0 -0
  31. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor/drivers/general/settings.yml +0 -0
  32. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor/drivers/lenovo/__init__.py +0 -0
  33. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor/drivers/lenovo/settings.yml +0 -0
  34. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor/drivers/smu/qam.yml +0 -0
  35. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor/drivers/smu/smu.yml +0 -0
  36. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor/events.py +0 -0
  37. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor/fuse/__init__.py +0 -0
  38. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor/fuse/driver.py +0 -0
  39. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor/fuse/gpu.py +0 -0
  40. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor/fuse/utils.py +0 -0
  41. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor/i18n.py +0 -0
  42. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor/settings.yml +0 -0
  43. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor.egg-info/SOURCES.txt +0 -0
  44. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor.egg-info/dependency_links.txt +0 -0
  45. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor.egg-info/entry_points.txt +0 -0
  46. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor.egg-info/requires.txt +0 -0
  47. {adjustor-3.7.6 → adjustor-3.7.7}/src/adjustor.egg-info/top_level.txt +0 -0
  48. {adjustor-3.7.6 → adjustor-3.7.7}/usr/share/dbus-1/system.d/hhd-net.hadess.PowerProfiles.conf +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: adjustor
3
- Version: 3.7.6
3
+ Version: 3.7.7
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.7.6"
3
+ version = "3.7.7"
4
4
  authors = [
5
5
  { name="Kapenekakis Antheas", email="pypi@antheas.dev" },
6
6
  ]
@@ -27,17 +27,17 @@ class DevideProfile(TypedDict):
27
27
  alib: dict[str, AlibParams]
28
28
  dev: dict[str, DeviceParams]
29
29
 
30
-
31
- PLATFORM_PROFILE_MAP = [
32
- ("low-power", 0),
33
- ("quiet", 0),
34
- ("balanced", 13),
35
- ("performance", 20),
36
- ]
30
+ # internal name for ppd, platform_profile choices, min TDP for
31
+ # profile to apply, tdp target to apply when selecting profile
37
32
  ENERGY_MAP = [
38
- ("power", 0),
39
- ("balanced", 13),
40
- ("performance", 20),
33
+ ("power", ["low-power", "quiet"], 0, 8),
34
+ ("balanced", ["balanced"], 13, 15),
35
+ ("performance", ["performance"], 20, 25),
36
+ ]
37
+ ENERGY_MAP_18W = [
38
+ ("low-power", ["low-power", "quiet"], 0, 5),
39
+ ("balanced", ["balanced"], 8, 12),
40
+ ("performance", ["performance"], 13, 18),
41
41
  ]
42
42
 
43
43
  ALIB_PARAMS = {
@@ -112,33 +112,48 @@ DEV_PARAMS_8040: dict[str, DeviceParams] = DEV_PARAMS_30W
112
112
  DEV_PARAMS_HX370: dict[str, DeviceParams] = DEV_PARAMS_30W
113
113
  DEV_PARAMS_LEGO = DEV_PARAMS_30W
114
114
 
115
- DEV_DATA: dict[str, tuple[dict[str, DeviceParams], dict[str, AlibParams], bool]] = {
116
- "NEO-01": (DEV_PARAMS_28W, ALIB_PARAMS_7040, False),
117
- "V3": (DEV_PARAMS_28W, ALIB_PARAMS_8040, False),
118
- "83E1": (DEV_PARAMS_LEGO, ALIB_PARAMS_7040, False),
119
- "ONEXPLAYER F1Pro": (DEV_PARAMS_HX370, ALIB_PARAMS_HX370, False),
120
- "ONEXPLAYER F1 EVA-02": (DEV_PARAMS_HX370, ALIB_PARAMS_HX370, False),
115
+ DEV_DATA: dict[
116
+ str,
117
+ tuple[
118
+ dict[str, DeviceParams],
119
+ dict[str, AlibParams],
120
+ bool,
121
+ list[tuple[str, list[str], int, int]],
122
+ ],
123
+ ] = {
124
+ "NEO-01": (DEV_PARAMS_28W, ALIB_PARAMS_7040, False, ENERGY_MAP),
125
+ "V3": (DEV_PARAMS_28W, ALIB_PARAMS_8040, False, ENERGY_MAP),
126
+ "83E1": (DEV_PARAMS_LEGO, ALIB_PARAMS_7040, False, ENERGY_MAP),
127
+ "ONEXPLAYER F1Pro": (DEV_PARAMS_HX370, ALIB_PARAMS_HX370, False, ENERGY_MAP),
128
+ "ONEXPLAYER F1 EVA-02": (DEV_PARAMS_HX370, ALIB_PARAMS_HX370, False, ENERGY_MAP),
121
129
  # GPD Devices are 28W max
122
- "G1618-04": (DEV_PARAMS_28W, ALIB_PARAMS_7040, False),
123
- "G1617-01": (DEV_PARAMS_28W, ALIB_PARAMS_7040, False),
124
- "G1619-04": (DEV_PARAMS_28W, ALIB_PARAMS_7040, False),
125
- "G1619-05": (DEV_PARAMS_28W, ALIB_PARAMS_7040, False),
130
+ "G1618-04": (DEV_PARAMS_28W, ALIB_PARAMS_7040, False, ENERGY_MAP),
131
+ "G1617-01": (DEV_PARAMS_28W, ALIB_PARAMS_7040, False, ENERGY_MAP),
132
+ "G1619-04": (DEV_PARAMS_28W, ALIB_PARAMS_7040, False, ENERGY_MAP),
133
+ "G1619-05": (DEV_PARAMS_28W, ALIB_PARAMS_7040, False, ENERGY_MAP),
126
134
  }
127
135
 
128
- CPU_DATA: dict[str, tuple[dict[str, DeviceParams], dict[str, AlibParams]]] = {
129
- "AMD Ryzen Z1 Extreme": (DEV_PARAMS_7040, ALIB_PARAMS_7040),
130
- "AMD Ryzen Z1": (DEV_PARAMS_7040, ALIB_PARAMS_7040),
136
+ CPU_DATA: dict[
137
+ str,
138
+ tuple[
139
+ dict[str, DeviceParams],
140
+ dict[str, AlibParams],
141
+ list[tuple[str, list[str], int, int]],
142
+ ],
143
+ ] = {
144
+ "AMD Ryzen Z1 Extreme": (DEV_PARAMS_7040, ALIB_PARAMS_7040, ENERGY_MAP),
145
+ "AMD Ryzen Z1": (DEV_PARAMS_7040, ALIB_PARAMS_7040, ENERGY_MAP),
131
146
  # Ayaneo AIR Pro, max is 18W
132
- "AMD Ryzen 5 5560U": (DEV_PARAMS_18W, ALIB_PARAMS_5040),
147
+ "AMD Ryzen 5 5560U": (DEV_PARAMS_18W, ALIB_PARAMS_5040, ENERGY_MAP_18W),
133
148
  # 28W works fine, 30W is pushing it
134
- "AMD Ryzen 7 5700U": (DEV_PARAMS_5000, ALIB_PARAMS_5040),
135
- "AMD Ryzen 7 5800U": (DEV_PARAMS_5000, ALIB_PARAMS_5040),
149
+ "AMD Ryzen 7 5700U": (DEV_PARAMS_5000, ALIB_PARAMS_5040, ENERGY_MAP),
150
+ "AMD Ryzen 7 5800U": (DEV_PARAMS_5000, ALIB_PARAMS_5040, ENERGY_MAP),
136
151
  # GPD Win 4
137
152
  # model name : AMD Ryzen 7 6800U with Radeon Graphics
138
- "AMD Ryzen 7 6800U": (DEV_PARAMS_6000, ALIB_PARAMS_6040),
139
- "AMD Ryzen 7 7840U": (DEV_PARAMS_7040, ALIB_PARAMS_7040),
140
- "AMD Ryzen 7 8840U": (DEV_PARAMS_8040, ALIB_PARAMS_8040),
153
+ "AMD Ryzen 7 6800U": (DEV_PARAMS_6000, ALIB_PARAMS_6040, ENERGY_MAP),
154
+ "AMD Ryzen 7 7840U": (DEV_PARAMS_7040, ALIB_PARAMS_7040, ENERGY_MAP),
155
+ "AMD Ryzen 7 8840U": (DEV_PARAMS_8040, ALIB_PARAMS_8040, ENERGY_MAP),
141
156
  # AMD Athlon Silver 3050e (Win600, will it support tdp?)
142
- "AMD Ryzen AI 9 HX 370": (DEV_PARAMS_HX370, ALIB_PARAMS_HX370),
143
- "AMD Ryzen AI HX 360": (DEV_PARAMS_HX370, ALIB_PARAMS_HX370),
157
+ "AMD Ryzen AI 9 HX 370": (DEV_PARAMS_HX370, ALIB_PARAMS_HX370, ENERGY_MAP),
158
+ "AMD Ryzen AI HX 360": (DEV_PARAMS_HX370, ALIB_PARAMS_HX370, ENERGY_MAP),
144
159
  }
@@ -138,22 +138,24 @@ def create_interface(legacy: bool):
138
138
  # TODO
139
139
  return handle
140
140
 
141
- def update_profile(self):
142
- for line in sys.stdin:
143
- if not line:
144
- break
145
- profile = line.strip()
146
- if profile not in SUPPORTED_PROFILES_REVERSE:
147
- continue
141
+ def set_profile(self, profile):
142
+ if profile not in SUPPORTED_PROFILES_REVERSE:
143
+ return
148
144
 
149
- self.profile = profile
150
- self.PropertiesChanged(
151
- iface(legacy), {"ActiveProfile": self.profile}, []
152
- )
153
- return True
145
+ self.profile = SUPPORTED_PROFILES_REVERSE[profile]
146
+ self.PropertiesChanged(iface(legacy), {"ActiveProfile": self.profile}, [])
154
147
 
155
148
  return HhdPpd
156
149
 
150
+ def update_profile(services):
151
+ for line in sys.stdin:
152
+ if not line:
153
+ break
154
+ profile = line.strip()
155
+
156
+ for s in services:
157
+ s.set_profile(profile)
158
+ return True
157
159
 
158
160
  if __name__ == "__main__":
159
161
  mainloop = None
@@ -166,10 +168,30 @@ if __name__ == "__main__":
166
168
 
167
169
  legacy = False
168
170
  session_bus = dbus.SystemBus()
169
- name = dbus.service.BusName(iface(legacy), session_bus)
170
- object = create_interface(legacy)(session_bus)
171
+
172
+ claimed = False
173
+ try:
174
+ name1 = dbus.service.BusName(iface(False), session_bus)
175
+ claimed = True
176
+ except Exception:
177
+ pass
178
+
179
+ try:
180
+ name2 = dbus.service.BusName(iface(True), session_bus)
181
+ claimed = True
182
+ except Exception:
183
+ pass
184
+
185
+ if not claimed:
186
+ sys.exit(1)
187
+
188
+ services = [
189
+ create_interface(False)(session_bus),
190
+ create_interface(True)(session_bus),
191
+ ]
192
+
193
+ GLib.timeout_add(100, lambda: update_profile(services))
171
194
 
172
- GLib.timeout_add(100, object.update_profile)
173
195
  mainloop = GLib.MainLoop()
174
196
  mainloop.run()
175
197
  except KeyboardInterrupt:
@@ -44,8 +44,8 @@ class SmuQamPlugin(HHDPlugin):
44
44
  def __init__(
45
45
  self,
46
46
  dev: dict[str, DeviceParams],
47
- pp_map: list[tuple[str, int]] | None,
48
- energy_map: list[tuple[str, int]] | None,
47
+ pp_map: list[tuple[str, list[str], int, int]] | None,
48
+ pp_enable: bool = True,
49
49
  init_tdp: bool = True,
50
50
  ) -> None:
51
51
  self.name = f"adjustor_smu_qam"
@@ -80,19 +80,15 @@ class SmuQamPlugin(HHDPlugin):
80
80
  # startup
81
81
  self.init_tdp = init_tdp
82
82
 
83
- self.energy_map = energy_map
84
- if pp_map:
83
+ self.pp_map = pp_map
84
+ if pp_enable and pp_map:
85
85
  self.pps = get_platform_choices() or []
86
- if self.pps:
87
- self.pp_map = pp_map
88
- else:
86
+ if not self.pps:
89
87
  logger.warning(
90
88
  f"Platform profile map was provided but device does not have platform profiles."
91
89
  )
92
- self.pp_map = None
93
90
  else:
94
91
  self.pps = []
95
- self.pp_map = None
96
92
 
97
93
  def settings(self):
98
94
  if not self.enabled:
@@ -205,18 +201,16 @@ class SmuQamPlugin(HHDPlugin):
205
201
  conf["tdp.smu.std.skin_limit"] = new_tdp
206
202
  conf["tdp.smu.std.stapm_limit"] = new_tdp
207
203
 
208
- if self.pp_map and conf["tdp.smu.platform_profile"].to(str) != "disabled":
209
- pp = self.pp_map[0][0]
210
- for npp, tdp in self.pp_map:
211
- if tdp < new_tdp and npp in self.pps:
212
- pp = npp
213
- conf["tdp.smu.platform_profile"] = pp
214
-
215
- if self.energy_map:
216
- ep = self.energy_map[0][0]
217
- for nep, tdp in self.energy_map:
204
+ if self.pp_map:
205
+ pp = ep = self.pp_map[0][0]
206
+ for nep, npps, tdp, target in self.pp_map:
218
207
  if tdp < new_tdp:
219
208
  ep = nep
209
+ for npp in npps:
210
+ if npp in self.pps:
211
+ pp = npp
212
+ if self.pps and conf.get("tdp.smu.platform_profile", "disabled") != "disabled":
213
+ conf["tdp.smu.platform_profile"] = pp
220
214
  conf["tdp.smu.energy_policy"] = ep
221
215
 
222
216
  if new_boost:
@@ -310,15 +304,13 @@ class SmuQamPlugin(HHDPlugin):
310
304
  self.new_tdp = ev["tdp"]
311
305
  self.sys_tdp = ev["tdp"] is not None
312
306
 
313
- if ev["type"] == "ppd":
314
- # TODO: Make tunable per device
315
- match ev["status"]:
316
- case "power":
317
- self.new_tdp = 8
318
- case "balanced":
319
- self.new_tdp = 15
320
- case "performance":
321
- self.new_tdp = 25
307
+ if ev["type"] == "ppd" and self.pp_map:
308
+ for ep, pps, tdp, target in self.pp_map:
309
+ if ep == ev["status"]:
310
+ self.new_tdp = target
311
+ break
312
+ else:
313
+ logger.warning(f"Energy profile '{ev['status']}' not found in map.")
322
314
 
323
315
  if ev["type"] == "special" and ev.get("event", None) == "wakeup":
324
316
  logger.info(
@@ -462,6 +454,12 @@ class SmuDriverPlugin(HHDPlugin):
462
454
  self.is_set = False
463
455
  self.old_pp = new_pp
464
456
 
457
+ # Inform ppd instantly to avoid lag in slider
458
+ new_target = conf["tdp.smu.energy_policy"].to(str)
459
+ if new_target != self.old_target:
460
+ self.old_target = new_target
461
+ self.emit({"type": "energy", "status": new_target}) # type: ignore
462
+
465
463
  if conf["tdp.smu.apply"].to(bool):
466
464
  conf["tdp.smu.apply"] = False
467
465
 
@@ -471,11 +469,6 @@ class SmuDriverPlugin(HHDPlugin):
471
469
  set_platform_profile(cpp)
472
470
  time.sleep(PP_DELAY)
473
471
 
474
- new_target = conf["tdp.smu.energy_policy"].to(str)
475
- if new_target != self.old_target:
476
- self.old_target = new_target
477
- self.emit({"type": "energy", "status": new_target}) # type: ignore
478
-
479
472
  alib(
480
473
  new_vals,
481
474
  self.cpu,
@@ -10,7 +10,7 @@ from hhd.plugins.plugin import Emitter
10
10
  from hhd.utils import expanduser
11
11
 
12
12
  from adjustor.core.acpi import check_perms, initialize
13
- from adjustor.core.const import CPU_DATA, DEV_DATA, PLATFORM_PROFILE_MAP, ENERGY_MAP
13
+ from adjustor.core.const import CPU_DATA, DEV_DATA
14
14
 
15
15
  from .i18n import _
16
16
 
@@ -284,7 +284,7 @@ def autodetect(existing: Sequence[HHDPlugin]) -> Sequence[HHDPlugin]:
284
284
  drivers_matched = False
285
285
 
286
286
  if not drivers_matched and prod in DEV_DATA:
287
- dev, cpu, pp_enable = DEV_DATA[prod]
287
+ dev, cpu, pp_enable, energy_map = DEV_DATA[prod]
288
288
 
289
289
  try:
290
290
  # Set values for the steam slider
@@ -308,8 +308,8 @@ def autodetect(existing: Sequence[HHDPlugin]) -> Sequence[HHDPlugin]:
308
308
  drivers.append(
309
309
  SmuQamPlugin(
310
310
  dev,
311
- PLATFORM_PROFILE_MAP if pp_enable else None,
312
- ENERGY_MAP,
311
+ energy_map,
312
+ pp_enable=pp_enable,
313
313
  init_tdp=not prod == "83E1",
314
314
  ),
315
315
  )
@@ -317,7 +317,7 @@ def autodetect(existing: Sequence[HHDPlugin]) -> Sequence[HHDPlugin]:
317
317
  use_acpi_call = True
318
318
 
319
319
  if not drivers_matched:
320
- for name, (dev, cpu) in CPU_DATA.items():
320
+ for name, (dev, cpu, energy_map) in CPU_DATA.items():
321
321
  if name in cpuinfo:
322
322
  drivers.append(
323
323
  SmuDriverPlugin(
@@ -327,7 +327,7 @@ def autodetect(existing: Sequence[HHDPlugin]) -> Sequence[HHDPlugin]:
327
327
  )
328
328
  )
329
329
  drivers.append(
330
- SmuQamPlugin(dev, PLATFORM_PROFILE_MAP, ENERGY_MAP),
330
+ SmuQamPlugin(dev, energy_map),
331
331
  )
332
332
  use_acpi_call = True
333
333
  break
@@ -336,7 +336,7 @@ def autodetect(existing: Sequence[HHDPlugin]) -> Sequence[HHDPlugin]:
336
336
  from .drivers.general import GeneralPowerPlugin
337
337
 
338
338
  logger.info(f"No tdp drivers found for this device, using generic plugin.")
339
-
339
+
340
340
  is_steamdeck = "Jupiter" in prod or "Galileo" in prod
341
341
  return [GeneralPowerPlugin(is_steamdeck=is_steamdeck)]
342
342
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: adjustor
3
- Version: 3.7.6
3
+ Version: 3.7.7
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