From 7d4d0d517f0b8725eede3e59234015c2f1ead713 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 22 Feb 2026 17:20:44 -0500 Subject: [PATCH] Implement OS version check in transmit.py from master-b-cam Add OS version check and update os_status based on command output. --- transmit.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/transmit.py b/transmit.py index 3dbcd5c1..958985af 100644 --- a/transmit.py +++ b/transmit.py @@ -481,6 +481,24 @@ if __name__ == "__main__": # print(1) setup(txLed, "out") + query = ["grep", "VERSION_CODENAME=bullseye", "/etc/os-release"] + try: + result = subprocess.run(query, capture_output=True, text=True, check=True) + print(f"Command run was: {query}") + os_status = result.stdout.strip() + print(f"Output of the command (stdout): {os_status}") + except subprocess.CalledProcessError as e: +# print(f"Command failed with return code: {e.returncode}") + print(f"Command run was: {e.cmd}") + os_status = e.stdout.strip() + print(f"Output of the command (stdout): {e.stdout}") +# print(f"Error output of the command (stderr): {e.stderr}") + if os_status != "VERSION_CODENAME=bullseye": + os_status = "bookworm" + else: + os_status = "bullseye" + print (os_status) + card = "Headphones" # default using pcm audio output of Pi Zero # card = "Device" # using USB sound card for audio output