adjustor 3.4.5__tar.gz → 3.4.6__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.4.5/src/adjustor.egg-info → adjustor-3.4.6}/PKG-INFO +1 -1
  2. {adjustor-3.4.5 → adjustor-3.4.6}/pyproject.toml +1 -1
  3. {adjustor-3.4.5 → adjustor-3.4.6}/src/adjustor/core/const.py +20 -5
  4. {adjustor-3.4.5 → adjustor-3.4.6}/src/adjustor/drivers/asus/__init__.py +5 -0
  5. {adjustor-3.4.5 → adjustor-3.4.6}/src/adjustor/drivers/asus/settings.yml +1 -1
  6. {adjustor-3.4.5 → adjustor-3.4.6}/src/adjustor/drivers/general/__init__.py +30 -0
  7. {adjustor-3.4.5 → adjustor-3.4.6}/src/adjustor/drivers/general/settings.yml +9 -0
  8. {adjustor-3.4.5 → adjustor-3.4.6}/src/adjustor/drivers/smu/qam.yml +1 -1
  9. {adjustor-3.4.5 → adjustor-3.4.6}/src/adjustor/fuse/driver.py +16 -3
  10. {adjustor-3.4.5 → adjustor-3.4.6}/src/adjustor/fuse/utils.py +12 -5
  11. {adjustor-3.4.5 → adjustor-3.4.6}/src/adjustor/hhd.py +3 -1
  12. {adjustor-3.4.5 → adjustor-3.4.6/src/adjustor.egg-info}/PKG-INFO +1 -1
  13. {adjustor-3.4.5 → adjustor-3.4.6}/LICENSE +0 -0
  14. {adjustor-3.4.5 → adjustor-3.4.6}/MANIFEST.in +0 -0
  15. {adjustor-3.4.5 → adjustor-3.4.6}/readme.md +0 -0
  16. {adjustor-3.4.5 → adjustor-3.4.6}/setup.cfg +0 -0
  17. {adjustor-3.4.5 → adjustor-3.4.6}/src/adjustor/__init__.py +0 -0
  18. {adjustor-3.4.5 → adjustor-3.4.6}/src/adjustor/__main__.py +0 -0
  19. {adjustor-3.4.5 → adjustor-3.4.6}/src/adjustor/core/__init__.py +0 -0
  20. {adjustor-3.4.5 → adjustor-3.4.6}/src/adjustor/core/acpi.py +0 -0
  21. {adjustor-3.4.5 → adjustor-3.4.6}/src/adjustor/core/alib.py +0 -0
  22. {adjustor-3.4.5 → adjustor-3.4.6}/src/adjustor/core/lenovo.py +0 -0
  23. {adjustor-3.4.5 → adjustor-3.4.6}/src/adjustor/core/platform.py +0 -0
  24. {adjustor-3.4.5 → adjustor-3.4.6}/src/adjustor/drivers/__init__.py +0 -0
  25. {adjustor-3.4.5 → adjustor-3.4.6}/src/adjustor/drivers/amd/__init__.py +0 -0
  26. {adjustor-3.4.5 → adjustor-3.4.6}/src/adjustor/drivers/amd/power-profiles-daemon.dbus.xml.in +0 -0
  27. {adjustor-3.4.5 → adjustor-3.4.6}/src/adjustor/drivers/amd/ppd.py +0 -0
  28. {adjustor-3.4.5 → adjustor-3.4.6}/src/adjustor/drivers/amd/settings.yml +0 -0
  29. {adjustor-3.4.5 → adjustor-3.4.6}/src/adjustor/drivers/lenovo/__init__.py +0 -0
  30. {adjustor-3.4.5 → adjustor-3.4.6}/src/adjustor/drivers/lenovo/settings.yml +0 -0
  31. {adjustor-3.4.5 → adjustor-3.4.6}/src/adjustor/drivers/smu/__init__.py +0 -0
  32. {adjustor-3.4.5 → adjustor-3.4.6}/src/adjustor/drivers/smu/smu.yml +0 -0
  33. {adjustor-3.4.5 → adjustor-3.4.6}/src/adjustor/events.py +0 -0
  34. {adjustor-3.4.5 → adjustor-3.4.6}/src/adjustor/fuse/__init__.py +0 -0
  35. {adjustor-3.4.5 → adjustor-3.4.6}/src/adjustor/fuse/gpu.py +0 -0
  36. {adjustor-3.4.5 → adjustor-3.4.6}/src/adjustor/i18n.py +0 -0
  37. {adjustor-3.4.5 → adjustor-3.4.6}/src/adjustor/settings.yml +0 -0
  38. {adjustor-3.4.5 → adjustor-3.4.6}/src/adjustor.egg-info/SOURCES.txt +0 -0
  39. {adjustor-3.4.5 → adjustor-3.4.6}/src/adjustor.egg-info/dependency_links.txt +0 -0
  40. {adjustor-3.4.5 → adjustor-3.4.6}/src/adjustor.egg-info/entry_points.txt +0 -0
  41. {adjustor-3.4.5 → adjustor-3.4.6}/src/adjustor.egg-info/requires.txt +0 -0
  42. {adjustor-3.4.5 → adjustor-3.4.6}/src/adjustor.egg-info/top_level.txt +0 -0
  43. {adjustor-3.4.5 → adjustor-3.4.6}/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.4.5
3
+ Version: 3.4.6
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.4.5"
3
+ version = "3.4.6"
4
4
  authors = [
5
5
  { name="Kapenekakis Antheas", email="pypi@antheas.dev" },
6
6
  ]
@@ -25,11 +25,12 @@ ALIB_PARAMS = {
25
25
  "temp_target": A(0x03, 0, 105),
26
26
  }
27
27
 
28
+ ALIB_PARAMS_5040: dict[str, AlibParams] = ALIB_PARAMS
28
29
  ALIB_PARAMS_7040: dict[str, AlibParams] = ALIB_PARAMS
29
30
  ALIB_PARAMS_6040: dict[str, AlibParams] = ALIB_PARAMS
30
31
  ALIB_PARAMS_8040: dict[str, AlibParams] = ALIB_PARAMS
31
32
 
32
- DEV_PARAMS_7040: dict[str, DeviceParams] = {
33
+ DEV_PARAMS_30W: dict[str, DeviceParams] = {
33
34
  "stapm_limit": D(0, 4, 15, 30, 40),
34
35
  "skin_limit": D(0, 4, 15, 30, 40),
35
36
  "slow_limit": D(0, 4, 20, 32, 43),
@@ -52,10 +53,23 @@ DEV_PARAMS_28W: dict[str, DeviceParams] = {
52
53
  # Temp
53
54
  "temp_target": D(60, 70, 85, 90, 100),
54
55
  }
56
+ DEV_PARAMS_25W: dict[str, DeviceParams] = {
57
+ "stapm_limit": D(0, 4, 15, 25, 32),
58
+ "skin_limit": D(0, 4, 15, 25, 32),
59
+ "slow_limit": D(0, 4, 20, 27, 35),
60
+ "fast_limit": D(0, 4, 25, 30, 37),
61
+ # Times
62
+ "slow_time": D(5, 5, 10, 10, 10),
63
+ "stapm_time": D(100, 100, 100, 200, 200),
64
+ # Temp
65
+ "temp_target": D(60, 70, 85, 90, 100),
66
+ }
55
67
 
56
- DEV_PARAMS_6040: dict[str, DeviceParams] = DEV_PARAMS_7040
57
- DEV_PARAMS_8040: dict[str, DeviceParams] = DEV_PARAMS_7040
58
- DEV_PARAMS_LEGO = DEV_PARAMS_7040
68
+ DEV_PARAMS_5000: dict[str, DeviceParams] = DEV_PARAMS_25W
69
+ DEV_PARAMS_6000: dict[str, DeviceParams] = DEV_PARAMS_30W
70
+ DEV_PARAMS_7040: dict[str, DeviceParams] = DEV_PARAMS_30W
71
+ DEV_PARAMS_8040: dict[str, DeviceParams] = DEV_PARAMS_30W
72
+ DEV_PARAMS_LEGO = DEV_PARAMS_30W
59
73
 
60
74
  DEV_DATA: dict[str, tuple[dict[str, DeviceParams], dict[str, AlibParams], bool]] = {
61
75
  "NEO-01": (DEV_PARAMS_28W, ALIB_PARAMS_7040, False),
@@ -69,7 +83,8 @@ CPU_DATA: dict[str, tuple[dict[str, DeviceParams], dict[str, AlibParams]]] = {
69
83
  # GPD Win 4
70
84
  # model name : AMD Ryzen 7 6800U with Radeon Graphics
71
85
  # 28W works fine, 30W is pushing it
72
- "AMD Ryzen 7 6800U": (DEV_PARAMS_6040, ALIB_PARAMS_6040),
86
+ "AMD Ryzen 7 5800U": (DEV_PARAMS_6000, ALIB_PARAMS_6040),
87
+ "AMD Ryzen 7 6800U": (DEV_PARAMS_6000, ALIB_PARAMS_6040),
73
88
  "AMD Ryzen 7 7840U": (DEV_PARAMS_7040, ALIB_PARAMS_7040),
74
89
  "AMD Ryzen 7 8840U": (DEV_PARAMS_8040, ALIB_PARAMS_8040),
75
90
  # AMD Athlon Silver 3050e (Win600, will it support tdp?)
@@ -139,6 +139,7 @@ class AsusDriverPlugin(HHDPlugin):
139
139
 
140
140
  self.queue_fan = None
141
141
  self.queue_tdp = None
142
+ self.queue_charge_limit = None
142
143
  self.new_tdp = None
143
144
  self.new_mode = None
144
145
  self.old_target = None
@@ -206,6 +207,10 @@ class AsusDriverPlugin(HHDPlugin):
206
207
  if (self.startup and lim != "disabled") or (
207
208
  lim != self.old_conf["charge_limit"].to(str)
208
209
  ):
210
+ self.queue_charge_limit = curr + APPLY_DELAY
211
+
212
+ if self.queue_charge_limit and self.queue_charge_limit < curr:
213
+ self.queue_charge_limit = None
209
214
  match lim:
210
215
  case "p65":
211
216
  set_charge_limit(65)
@@ -48,7 +48,7 @@ children:
48
48
  sys_tdp:
49
49
  type: display
50
50
  title: " "
51
- tags: [non-essential]
51
+ tags: []
52
52
 
53
53
  cycle_tdp:
54
54
  type: bool
@@ -7,6 +7,7 @@ import time
7
7
  import signal
8
8
  from hhd.plugins import Context, HHDPlugin, load_relative_yaml
9
9
  from hhd.plugins.conf import Config
10
+ from threading import Event
10
11
  import logging
11
12
 
12
13
  logger = logging.getLogger(__name__)
@@ -16,6 +17,7 @@ class GeneralPowerPlugin(HHDPlugin):
16
17
 
17
18
  def __init__(
18
19
  self,
20
+ is_steamdeck: bool = False,
19
21
  ) -> None:
20
22
  self.name = f"adjustor_general"
21
23
  self.priority = 8
@@ -25,6 +27,10 @@ class GeneralPowerPlugin(HHDPlugin):
25
27
  self.old_sched = None
26
28
  self.sched_proc = None
27
29
  self.ppd_supported = None
30
+ self.is_steamdeck = is_steamdeck
31
+ self.ovr_enabled = False
32
+ self.should_exit = Event()
33
+ self.t_sys = None
28
34
 
29
35
  def settings(self):
30
36
  sets = load_relative_yaml("./settings.yml")
@@ -71,6 +77,9 @@ class GeneralPowerPlugin(HHDPlugin):
71
77
  else:
72
78
  del sets["children"]["sched"]
73
79
 
80
+ if not self.is_steamdeck:
81
+ del sets["children"]["steamdeck_ovr"]
82
+
74
83
  self.logged_boost = True
75
84
  return {
76
85
  "tdp": {"general": sets},
@@ -134,6 +143,24 @@ class GeneralPowerPlugin(HHDPlugin):
134
143
  stderr=subprocess.DEVNULL,
135
144
  stdout=subprocess.DEVNULL,
136
145
  )
146
+
147
+ # Handle steamdeck_ovr
148
+ if self.is_steamdeck:
149
+ new_ovr = conf.get("tdp.general.steamdeck_ovr", False)
150
+ if new_ovr and not self.ovr_enabled:
151
+ self.ovr_enabled = True
152
+ logger.info("Starting FUSE mount for /sys (Overclock).")
153
+ from ...fuse import prepare_tdp_mount, start_tdp_client
154
+
155
+ stat = prepare_tdp_mount(passhtrough=True)
156
+ if stat:
157
+ self.t_sys = start_tdp_client(
158
+ self.should_exit,
159
+ None,
160
+ 1,
161
+ 15,
162
+ 20,
163
+ )
137
164
 
138
165
  def close_sched(self):
139
166
  if self.sched_proc is not None:
@@ -144,3 +171,6 @@ class GeneralPowerPlugin(HHDPlugin):
144
171
 
145
172
  def close(self):
146
173
  self.close_sched()
174
+ if self.t_sys:
175
+ self.should_exit.set()
176
+ self.t_sys.join()
@@ -25,3 +25,12 @@ children:
25
25
  scx_bpfland: bpfland
26
26
  scx_rusty: rusty
27
27
  default: disabled
28
+
29
+ steamdeck_ovr:
30
+ type: bool
31
+ tags: [advanced,expert]
32
+ title: Steamdeck Overclock (Requires Reboot)
33
+ hint: >-
34
+ Allows setting the Steam TDP slider from 1-20W instead of 4-15W.
35
+ Unchecked, it is still setting TDP to 15W.
36
+ default: False
@@ -18,4 +18,4 @@ children:
18
18
  sys_tdp:
19
19
  type: display
20
20
  title: " "
21
- tags: [non-essential]
21
+ tags: []
@@ -157,7 +157,7 @@ class Xmp(Fuse):
157
157
  def fsinit(self):
158
158
  os.chdir(self.root)
159
159
 
160
- def main(self, *a, **kw):
160
+ def main(self, *a, passthrough=False, **kw):
161
161
  os.makedirs(FUSE_MOUNT_DIR, exist_ok=True)
162
162
  sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
163
163
  sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
@@ -167,6 +167,7 @@ class Xmp(Fuse):
167
167
  self.file_class = XmpFile
168
168
  XmpFile.h = Handler(sock)
169
169
  XmpFile.cache = {}
170
+ XmpFile.passthrough = passthrough
170
171
 
171
172
  code = Fuse.main(self, *a, **kw)
172
173
  sock.close()
@@ -196,10 +197,15 @@ class Handler:
196
197
  class XmpFile:
197
198
  h: Handler
198
199
  cache: dict[str, bytes]
200
+ passthrough: bool
199
201
 
200
202
  def __init__(self, path, flags, *mode):
201
203
  self.path = path
202
- if "power1_cap" in path or "power2_cap" in path:
204
+ power_attr = "power1_cap" in path or "power2_cap" in path
205
+ # Allow passing through writes if we are the steam deck
206
+ passthrough = XmpFile.passthrough and path.endswith("_cap")
207
+
208
+ if power_attr and not passthrough:
203
209
  print(f"GPU Attribute access: {path} {flags} {mode}")
204
210
 
205
211
  # Receive file contents from hhd
@@ -373,6 +379,13 @@ def main():
373
379
  default="/",
374
380
  help="GPU device private bind mount point",
375
381
  )
382
+ server.parser.add_option(
383
+ mountopt="passthrough",
384
+ metavar="PASSTHROUGH",
385
+ action="store_true",
386
+ default=False,
387
+ help="Allow tdp write passthrough, e.g., for the Steam Deck.",
388
+ )
376
389
  server.parse(values=server, errex=1)
377
390
 
378
391
  try:
@@ -382,7 +395,7 @@ def main():
382
395
  print("can't enter root of underlying filesystem", file=sys.stderr)
383
396
  sys.exit(1)
384
397
 
385
- server.main()
398
+ server.main(passthrough=getattr(server, "passthrough", False))
386
399
  except KeyboardInterrupt:
387
400
  pass
388
401
  finally:
@@ -37,7 +37,7 @@ def find_igpu():
37
37
  return None
38
38
 
39
39
 
40
- def prepare_tdp_mount(debug: bool = False):
40
+ def prepare_tdp_mount(debug: bool = False, passhtrough: bool = False):
41
41
  try:
42
42
  gpu = find_igpu()
43
43
  logger.info(f"Found GPU at:\n'{gpu}'")
@@ -53,9 +53,13 @@ def prepare_tdp_mount(debug: bool = False):
53
53
 
54
54
  if not os.path.ismount(TDP_MOUNT):
55
55
  logger.info(f"Creating bind mount for:\n'{gpu}'\nto:\n'{TDP_MOUNT}'")
56
- os.system(f"mount --bind '{gpu}' '{TDP_MOUNT}'")
56
+ cmd = f"mount --bind '{gpu}' '{TDP_MOUNT}'"
57
+ r = os.system(cmd)
58
+ assert not r, f"Failed:\n{cmd}"
57
59
  logger.info(f"Making bind mount private.")
58
- os.system(f"mount --make-private '{TDP_MOUNT}'")
60
+ cmd = f"mount --make-private '{TDP_MOUNT}'"
61
+ r = os.system(cmd)
62
+ assert not r, f"Failed:\n{cmd}"
59
63
  else:
60
64
  logger.info(f"Bind mount already exists at:\n'{TDP_MOUNT}'")
61
65
 
@@ -68,9 +72,12 @@ def prepare_tdp_mount(debug: bool = False):
68
72
  f"{exe_python} -m adjustor.fuse.driver '{gpu}'"
69
73
  + f" -o root={TDP_MOUNT} -o nonempty -o allow_other"
70
74
  )
75
+ if passhtrough:
76
+ cmd += " -o passthrough"
71
77
  if debug:
72
78
  cmd += " -f"
73
- os.system(cmd)
79
+ r = os.system(cmd)
80
+ assert not r, f"Failed:\n{cmd}"
74
81
  except Exception as e:
75
82
  logger.error(f"Error preparing fuse mount:\n{e}")
76
83
  return False
@@ -156,7 +163,7 @@ def _tdp_client(should_exit: Event, set_tdp, min_tdp, default_tdp, max_tdp):
156
163
  def start_tdp_client(
157
164
  should_exit: Event, emit, min_tdp: int, default_tdp: int, max_tdp: int
158
165
  ):
159
- set_tdp = lambda tdp: emit({"type": "tdp", "tdp": tdp})
166
+ set_tdp = lambda tdp: emit and emit({"type": "tdp", "tdp": tdp})
160
167
 
161
168
  logger.info(f"Starting TDP client on socket:\n'{FUSE_MOUNT_SOCKET}'")
162
169
  t = Thread(
@@ -326,7 +326,9 @@ def autodetect(existing: Sequence[HHDPlugin]) -> Sequence[HHDPlugin]:
326
326
  from .drivers.general import GeneralPowerPlugin
327
327
 
328
328
  logger.info(f"No tdp drivers found for this device, using generic plugin.")
329
- return [GeneralPowerPlugin()]
329
+
330
+ is_steamdeck = "Jupiter" in prod or "Galileo" in prod
331
+ return [GeneralPowerPlugin(is_steamdeck=is_steamdeck)]
330
332
 
331
333
  return [
332
334
  *drivers,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: adjustor
3
- Version: 3.4.5
3
+ Version: 3.4.6
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