adjustor 3.6.4__tar.gz → 3.7.0__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.6.4/src/adjustor.egg-info → adjustor-3.7.0}/PKG-INFO +2 -2
  2. {adjustor-3.6.4 → adjustor-3.7.0}/pyproject.toml +1 -1
  3. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor/core/const.py +1 -0
  4. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor/drivers/lenovo/__init__.py +44 -23
  5. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor/drivers/lenovo/settings.yml +3 -2
  6. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor/events.py +3 -2
  7. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor/hhd.py +11 -2
  8. {adjustor-3.6.4 → adjustor-3.7.0/src/adjustor.egg-info}/PKG-INFO +2 -2
  9. {adjustor-3.6.4 → adjustor-3.7.0}/LICENSE +0 -0
  10. {adjustor-3.6.4 → adjustor-3.7.0}/MANIFEST.in +0 -0
  11. {adjustor-3.6.4 → adjustor-3.7.0}/readme.md +0 -0
  12. {adjustor-3.6.4 → adjustor-3.7.0}/setup.cfg +0 -0
  13. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor/__init__.py +0 -0
  14. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor/__main__.py +0 -0
  15. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor/core/__init__.py +0 -0
  16. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor/core/acpi.py +0 -0
  17. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor/core/alib.py +0 -0
  18. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor/core/fan/__init__.py +0 -0
  19. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor/core/fan/__main__.py +0 -0
  20. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor/core/fan/alg.py +0 -0
  21. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor/core/fan/core.py +0 -0
  22. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor/core/fan/utils.py +0 -0
  23. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor/core/lenovo.py +0 -0
  24. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor/core/platform.py +0 -0
  25. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor/drivers/__init__.py +0 -0
  26. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor/drivers/amd/__init__.py +0 -0
  27. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor/drivers/amd/power-profiles-daemon.dbus.xml.in +0 -0
  28. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor/drivers/amd/ppd.py +0 -0
  29. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor/drivers/amd/settings.yml +0 -0
  30. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor/drivers/asus/__init__.py +0 -0
  31. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor/drivers/asus/settings.yml +0 -0
  32. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor/drivers/general/__init__.py +0 -0
  33. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor/drivers/general/settings.yml +0 -0
  34. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor/drivers/smu/__init__.py +0 -0
  35. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor/drivers/smu/qam.yml +0 -0
  36. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor/drivers/smu/smu.yml +0 -0
  37. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor/fuse/__init__.py +0 -0
  38. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor/fuse/driver.py +0 -0
  39. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor/fuse/gpu.py +0 -0
  40. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor/fuse/utils.py +0 -0
  41. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor/i18n.py +0 -0
  42. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor/settings.yml +0 -0
  43. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor.egg-info/SOURCES.txt +0 -0
  44. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor.egg-info/dependency_links.txt +0 -0
  45. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor.egg-info/entry_points.txt +0 -0
  46. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor.egg-info/requires.txt +0 -0
  47. {adjustor-3.6.4 → adjustor-3.7.0}/src/adjustor.egg-info/top_level.txt +0 -0
  48. {adjustor-3.6.4 → adjustor-3.7.0}/usr/share/dbus-1/system.d/hhd-net.hadess.PowerProfiles.conf +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: adjustor
3
- Version: 3.6.4
3
+ Version: 3.7.0
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.6.4"
3
+ version = "3.7.0"
4
4
  authors = [
5
5
  { name="Kapenekakis Antheas", email="pypi@antheas.dev" },
6
6
  ]
@@ -131,6 +131,7 @@ CPU_DATA: dict[str, tuple[dict[str, DeviceParams], dict[str, AlibParams]]] = {
131
131
  # GPD Win 4
132
132
  # model name : AMD Ryzen 7 6800U with Radeon Graphics
133
133
  # 28W works fine, 30W is pushing it
134
+ "AMD Ryzen 7 5700U": (DEV_PARAMS_6000, ALIB_PARAMS_6040),
134
135
  "AMD Ryzen 7 5800U": (DEV_PARAMS_6000, ALIB_PARAMS_6040),
135
136
  "AMD Ryzen 7 6800U": (DEV_PARAMS_6000, ALIB_PARAMS_6040),
136
137
  "AMD Ryzen 7 7840U": (DEV_PARAMS_7040, ALIB_PARAMS_7040),
@@ -9,7 +9,6 @@ from adjustor.core.lenovo import (
9
9
  MIN_CURVE,
10
10
  TdpMode,
11
11
  get_bios_version,
12
- get_charge_limit,
13
12
  get_full_fan_speed,
14
13
  get_power_light,
15
14
  get_power_light_v1,
@@ -33,7 +32,7 @@ TDP_DELAY = 0
33
32
 
34
33
 
35
34
  class LenovoDriverPlugin(HHDPlugin):
36
- def __init__(self) -> None:
35
+ def __init__(self, legion_s=False) -> None:
37
36
  self.name = f"adjustor_lenovo"
38
37
  self.priority = 6
39
38
  self.log = "adjl"
@@ -42,13 +41,25 @@ class LenovoDriverPlugin(HHDPlugin):
42
41
  self.enforce_limits = True
43
42
  self.startup = True
44
43
  self.old_conf = None
44
+ self.prev_charge_limit = None
45
45
  self.sys_tdp = False
46
46
  self.fan_curve_set = False
47
- self.notify_tdp = False
47
+ self.legion_s = legion_s
48
+ if legion_s:
49
+ self.max_watts = 33
50
+ self.max_watts_sppt = 33
51
+ self.max_watts_fppt = 35
52
+ else:
53
+ self.max_watts = 30
54
+ self.max_watts_sppt = 32
55
+ self.max_watts_fppt = 41
48
56
 
49
57
  bios_version = get_bios_version()
50
- logger.info(f"Lenovo BIOS version: {bios_version}")
51
- self.power_light_v2 = bios_version >= 35
58
+ if legion_s:
59
+ self.power_light_v2 = False
60
+ else:
61
+ logger.info(f"Lenovo BIOS version: {bios_version}")
62
+ self.power_light_v2 = bios_version >= 35
52
63
 
53
64
  self.queue_fan = None
54
65
  self.queue_tdp = None
@@ -65,12 +76,22 @@ class LenovoDriverPlugin(HHDPlugin):
65
76
 
66
77
  self.initialized = True
67
78
  out = {"tdp": {"lenovo": load_relative_yaml("settings.yml")}}
79
+ if self.legion_s:
80
+ out["tdp"]["lenovo"]["children"]["power_light"]["title"] = _("Power Light")
68
81
  if not self.power_light_v2:
69
82
  del out["tdp"]["lenovo"]["children"]["power_light_sleep"]
70
83
  if not self.enforce_limits:
71
84
  out["tdp"]["lenovo"]["children"]["tdp"]["modes"]["custom"]["children"][
72
85
  "tdp"
73
86
  ]["max"] = 40
87
+ else:
88
+ out["tdp"]["lenovo"]["children"]["tdp"]["modes"]["custom"]["children"][
89
+ "tdp"
90
+ ]["max"] = self.max_watts
91
+ if self.max_watts > 30:
92
+ out["tdp"]["lenovo"]["children"]["tdp"]["modes"]["custom"][
93
+ "unit"
94
+ ] = f"→ {self.max_watts}W"
74
95
  return out
75
96
 
76
97
  def open(
@@ -106,8 +127,6 @@ class LenovoDriverPlugin(HHDPlugin):
106
127
  else:
107
128
  conf["tdp.lenovo.power_light"] = get_power_light_v1()
108
129
 
109
- conf["tdp.lenovo.charge_limit"] = get_charge_limit()
110
-
111
130
  # If not old config, exit, as values can not be set
112
131
  if not self.old_conf:
113
132
  self.old_conf = conf["tdp.lenovo"]
@@ -138,11 +157,10 @@ class LenovoDriverPlugin(HHDPlugin):
138
157
  ):
139
158
  set_power_light(power_light_sleep, suspend=True)
140
159
 
141
- charge_limit = conf["tdp.lenovo.charge_limit"].to(bool)
142
- if charge_limit is not None and charge_limit != self.old_conf[
143
- "charge_limit"
144
- ].to(bool):
160
+ charge_limit = conf.get("tdp.lenovo.charge_limit", False)
161
+ if charge_limit != self.prev_charge_limit:
145
162
  set_charge_limit(charge_limit)
163
+ self.prev_charge_limit = charge_limit
146
164
 
147
165
  #
148
166
  # TDP
@@ -153,6 +171,7 @@ class LenovoDriverPlugin(HHDPlugin):
153
171
  new_tdp = self.new_tdp
154
172
  self.new_tdp = None
155
173
  new_mode = self.new_mode
174
+ notify_tdp = False
156
175
  self.new_mode = None
157
176
  if new_tdp:
158
177
  # For TDP values received from steam, set the appropriate
@@ -181,6 +200,7 @@ class LenovoDriverPlugin(HHDPlugin):
181
200
  if not new_tdp:
182
201
  self.sys_tdp = False
183
202
  tdp_reset = True
203
+ notify_tdp = True
184
204
  conf["tdp.lenovo.tdp.mode"] = new_mode
185
205
 
186
206
  # Reset fan curve on mode change
@@ -215,7 +235,7 @@ class LenovoDriverPlugin(HHDPlugin):
215
235
 
216
236
  old_steady = steady
217
237
  if self.enforce_limits:
218
- steady = min(max(steady, 4), 30)
238
+ steady = min(max(steady, 4), self.max_watts)
219
239
  else:
220
240
  steady = min(max(steady, 0), 50)
221
241
  if old_steady != steady:
@@ -227,12 +247,12 @@ class LenovoDriverPlugin(HHDPlugin):
227
247
  if steady_updated and not new_tdp:
228
248
  self.sys_tdp = False
229
249
 
230
- if self.startup and (steady > 30 or steady < 7):
250
+ if self.startup and (steady > self.max_watts or steady < 7):
231
251
  logger.warning(
232
252
  f"TDP ({steady}) outside the device spec. Resetting for stability reasons."
233
253
  )
234
- steady = 30
235
- conf["tdp.lenovo.tdp.custom.tdp"] = 30
254
+ steady = self.max_watts
255
+ conf["tdp.lenovo.tdp.custom.tdp"] = self.max_watts
236
256
  steady_updated = True
237
257
 
238
258
  boost = conf["tdp.lenovo.tdp.custom.boost"].to(bool)
@@ -248,9 +268,14 @@ class LenovoDriverPlugin(HHDPlugin):
248
268
  if boost:
249
269
  set_steady_tdp(steady)
250
270
  time.sleep(TDP_DELAY)
251
- set_slow_tdp(steady + 2)
271
+ set_slow_tdp(steady + (self.max_watts_sppt - self.max_watts))
252
272
  time.sleep(TDP_DELAY)
253
- set_fast_tdp(min(42, int(steady * 41 / 30)))
273
+ set_fast_tdp(
274
+ min(
275
+ self.max_watts_fppt,
276
+ int(steady * self.max_watts_fppt / self.max_watts),
277
+ )
278
+ )
254
279
  else:
255
280
  set_steady_tdp(steady)
256
281
  time.sleep(TDP_DELAY)
@@ -327,9 +352,8 @@ class LenovoDriverPlugin(HHDPlugin):
327
352
  # Save current config
328
353
  self.old_conf = conf["tdp.lenovo"]
329
354
 
330
- if self.notify_tdp:
331
- self.notify_tdp = False
332
- print(new_mode)
355
+ if notify_tdp:
356
+ notify_tdp = False
333
357
  if conf.get("tdp.lenovo.tdp_rgb", False):
334
358
  self.emit({"type": "special", "event": f"tdp_cycle_{new_mode}"}) # type: ignore
335
359
 
@@ -349,9 +373,6 @@ class LenovoDriverPlugin(HHDPlugin):
349
373
  self.new_mode = "balanced"
350
374
  case "performance":
351
375
  self.new_mode = "performance"
352
- print(ev)
353
- if ev["type"] == "acpi" and ev.get("event", None) == "tdp":
354
- self.notify_tdp = True
355
376
 
356
377
  def close(self):
357
378
  pass
@@ -147,14 +147,15 @@ children:
147
147
  type: bool
148
148
  title: Show TDP changes with RGB
149
149
  tags: [non-essential]
150
- default: False
150
+ default: True
151
151
 
152
152
  charge_limit:
153
153
  tags: [advanced]
154
154
  type: bool
155
155
  title: Charge Limit (80%)
156
+ default: False
156
157
  hint: >-
157
- Limits device charging to 80%. Lenovo EC method. Available since BIOSv29.
158
+ Limits device charging to 80%.
158
159
 
159
160
  power_light:
160
161
  tags: [advanced]
@@ -15,10 +15,11 @@ EVENT_MATCHES: Sequence[tuple[dict[str, Any], str]] = [
15
15
  ({"device_class": b"button/power"}, "powerbutton"),
16
16
  # Legion GO TDP event
17
17
  ({"bus_id": b"D320289E-8FEA-"}, "tdp"),
18
- ({"device_class": b"wmi", "bus_id": b"PNP0C14:01"}, "tdp"), # Legion go
18
+ ({"device_class": b"wmi", "bus_id": b"PNP0C14:01"}, "tdp"), # Legion go
19
+ ({"device_class": b"wmi", "bus_id": b"PNP0C14:00"}, "tdp"), # Legion go s
19
20
  # GPD Force hibernate thermal event
20
21
  # , 'type': 0xf100, 'data': 0x0100 ignore these attrs for now...
21
- ({"device_class": b"thermal_zone", "bus_id": b"LNXTHERM:00"}, "hibernate-thermal"),
22
+ # ({"device_class": b"thermal_zone", "bus_id": b"LNXTHERM:00"}, "hibernate-thermal"),
22
23
  ]
23
24
 
24
25
  GUARD_DELAY = 0.5
@@ -231,6 +231,10 @@ class AdjustorPlugin(HHDPlugin):
231
231
  self._stop()
232
232
 
233
233
 
234
+ LEGION_GO_DMI = "83E1"
235
+ LEGION_GO_S_DMIS = ["83L3"]
236
+
237
+
234
238
  def autodetect(existing: Sequence[HHDPlugin]) -> Sequence[HHDPlugin]:
235
239
  if len(existing):
236
240
  return existing
@@ -256,10 +260,15 @@ def autodetect(existing: Sequence[HHDPlugin]) -> Sequence[HHDPlugin]:
256
260
  default_tdp = 15
257
261
  max_tdp = 30
258
262
 
259
- if prod == "83E1" and not bool(os.environ.get("HHD_ADJ_ALLY")):
260
- drivers.append(LenovoDriverPlugin())
263
+ legion_s = prod in LEGION_GO_S_DMIS
264
+ if (prod == LEGION_GO_DMI or legion_s) and not bool(
265
+ os.environ.get("HHD_ADJ_ALLY")
266
+ ):
267
+ drivers.append(LenovoDriverPlugin(legion_s=legion_s))
261
268
  drivers_matched = True
262
269
  use_acpi_call = True
270
+ if legion_s:
271
+ max_tdp = 33
263
272
 
264
273
  if (
265
274
  "ROG Ally RC71L" in prod
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: adjustor
3
- Version: 3.6.4
3
+ Version: 3.7.0
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