Skip to content

Commit 5f6c0b4

Browse files
committed
rewrite tt_toggle
1 parent 5d1211b commit 5f6c0b4

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/hhd/device/generic/base.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,16 @@ def plugin_run(
6666
first = False
6767
continue
6868

69-
# copy from handygccs
69+
# Use the oxp-platform driver if available
7070
if os.path.exists("/sys/devices/platform/oxp-platform/tt_toggle"):
71-
command = f"echo 1 > /sys/devices/platform/oxp-platform/tt_toggle"
72-
os.popen(command, "r", 1).read().strip()
71+
try:
72+
with open("/sys/devices/platform/oxp-platform/tt_toggle", "w") as f:
73+
f.write("1")
74+
except Exception:
75+
logger.warn(
76+
f"Turbo takeover failed. Ensure you have the latest oxp-sensors driver installed."
77+
)
7378
logger.info(f"Turbo button takeover enabled")
74-
else:
75-
logger.warn(
76-
f"Turbo takeover failed. Ensure you have the latest oxp-sensors driver installed."
77-
)
7879

7980
try:
8081
logger.info("Launching emulated controller.")

0 commit comments

Comments
 (0)