File tree Expand file tree Collapse file tree 2 files changed +17
-23
lines changed Expand file tree Collapse file tree 2 files changed +17
-23
lines changed Original file line number Diff line number Diff line change 1
1
import os
2
- from plugin_enums import AcPowerPaths
3
- import device_utils
2
+ import decky_plugin
4
3
5
- ACAD_DEVICES = [
6
- # device_utils.Devices.GPD_WIN4.value,
7
- device_utils .Devices .MINISFORUM_V3 .value ,
8
- device_utils .Devices .LEGION_GO .value
9
- ]
10
- ADP1_DEVICES = [
11
- # device_utils.Devices.GPD_WM2.value
12
- ]
4
+ AC_POWER_PATH = None
13
5
14
6
def custom_ac_power_management_path ():
15
- device_name = device_utils . get_device_name ()
7
+ global AC_POWER_PATH
16
8
17
- ac_power_online_path = None
9
+ if bool (AC_POWER_PATH ):
10
+ return AC_POWER_PATH
18
11
19
- if device_name in ACAD_DEVICES :
20
- ac_power_online_path = AcPowerPaths .ACAD .value
21
- if device_name in ADP1_DEVICES :
22
- ac_power_online_path = AcPowerPaths .ADP1 .value
12
+ filename = None
13
+ try :
14
+ for n in os .listdir ("/sys/class/power_supply" ):
15
+ if n .startswith ("AC" ) or n .startswith ("ADP" ):
16
+ filename = n
23
17
24
- return ac_power_online_path
18
+ if filename is None :
19
+ return None
20
+ AC_POWER_PATH = f'/sys/class/power_supply/{ filename } /online'
21
+ return AC_POWER_PATH
22
+ except Exception as e :
23
+ decky_plugin .logger .error (f"{ __name__ } custom ac power path error { e } " )
24
+ return None
25
25
26
26
def supports_custom_ac_power_management ():
27
27
ac_power_path = custom_ac_power_management_path ()
Original file line number Diff line number Diff line change @@ -11,9 +11,3 @@ class GpuRange(Enum):
11
11
MIN = "minGpuFrequency"
12
12
MAX = "maxGpuFrequency"
13
13
FIXED = "fixedGpuFrequency"
14
-
15
- class AcPowerPaths (Enum ):
16
- # Minisforum V3, LGO, Win 4
17
- ACAD = '/sys/class/power_supply/ACAD/online'
18
- # GPD WM2
19
- ADP1 = '/sys/class/power_supply/ADP1/online'
You can’t perform that action at this time.
0 commit comments