Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import subprocess
- from pathlib import Path
- import sys
- assert(len(sys.argv) == 2)
- assert(sys.argv[1] in ["normal", "low"])
- index = 1 if sys.argv[1] == "normal" else 2
- values = [
- ["RX1 Digital Volume", "88", "62"],
- ["RX2 Digital Volume", "88", "62"],
- ["EAR PA Gain", "POS_6_DB", "POS_1P5_DB"],
- ]
- tinymix_path = bytes(Path.home() / "tinyalsa/utils/tinymix")
- script = []
- for row in values:
- script.append(
- b"%s set \"%s\" \"%s\"\n" % (
- tinymix_path,
- row[0].encode("utf-8"),
- row[index].encode("utf-8")
- )
- )
- script = b"".join(script)
- su = subprocess.Popen(["su"], stdin = subprocess.PIPE, stderr = subprocess.PIPE, stdout = subprocess.PIPE)
- print(su.communicate(script, timeout = 20))
Advertisement
Add Comment
Please, Sign In to add comment