Skip to content

Commit

Permalink
add fallback to Asus Armory wmi, if it is present on the device
Browse files Browse the repository at this point in the history
  • Loading branch information
aarron-lee committed Oct 17, 2024
1 parent 3daa2e6 commit 11024ca
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions py_modules/devices/rog_ally.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
SLOW_WMI_PATH = '/sys/devices/platform/asus-nb-wmi/ppt_pl2_sppt'
STAPM_WMI_PATH = '/sys/devices/platform/asus-nb-wmi/ppt_pl1_spl'

ASUS_ARMORY_FAST_WMI_PATH = "cat /sys/class/firmware-attributes/asus-armoury/attributes/ppt_fppt/current_value"
ASUS_ARMORY_SLOW_WMI_PATH = "cat /sys/class/firmware-attributes/asus-armoury/attributes/ppt_pl2_sppt/current_value"
ASUS_ARMORY_STAPM_WMI_PATH = "cat /sys/class/firmware-attributes/asus-armoury/attributes/ppt_pl1_spl/current_value"

# def set_asusctl_platform_profile(tdp):
# current_value = ''
# if os.path.exists(PLATFORM_PROFILE_PATH):
Expand Down Expand Up @@ -90,6 +94,23 @@ def set_tdp(tdp):
cmd = f'fwupdmgr set-bios-setting {wmi_method} {target_tdp}'
subprocess.run(cmd, timeout=1, shell=True, check=True, text=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
sleep(0.1)

elif os.path.exists(ASUS_ARMORY_FAST_WMI_PATH) and os.path.exists(ASUS_ARMORY_SLOW_WMI_PATH) and os.path.exists(ASUS_ARMORY_STAPM_WMI_PATH):
# fast limit
with open(ASUS_ARMORY_FAST_WMI_PATH, 'w') as file:
file.write(f'{tdp+2}')
sleep(0.1)

# slow limit
with open(ASUS_ARMORY_SLOW_WMI_PATH, 'w') as file:
file.write(f'{tdp}')
sleep(0.1)

# stapm limit
with open(ASUS_ARMORY_STAPM_WMI_PATH, 'w') as file:
file.write(f'{tdp}')
sleep(0.1)

else:
# fast limit
with open(FAST_WMI_PATH, 'w') as file:
Expand Down

0 comments on commit 11024ca

Please sign in to comment.