fix(radxa): use typing.Optional for Python 3.9 compatibility on Debian 11

This commit is contained in:
bleackstorm committed 2026-11-16 19:33:15 +01:00
1 parent fabcfc1a9b
commit 8ec5fb1fec
1 file changed
+3 -2
+3 -2
View File
@@ -12,6 +12,7 @@ import socket
import sys import sys
import termios import termios
import time import time
from typing import Optional
BAUD_RATE = termios.B460800 BAUD_RATE = termios.B460800
CASQUE_IP = os.environ.get("STEAMFRAME_CASQUE_IP", "192.168.1.10") CASQUE_IP = os.environ.get("STEAMFRAME_CASQUE_IP", "192.168.1.10")
@@ -44,7 +45,7 @@ def open_serial(dev_path: str) -> int:
return fd return fd
def find_serial_device() -> str | None: def find_serial_device() -> Optional[str]:
forced = os.environ.get("G29_SERIAL_DEV") forced = os.environ.get("G29_SERIAL_DEV")
if forced and os.path.exists(forced): if forced and os.path.exists(forced):
return forced return forced
@@ -61,7 +62,7 @@ def main() -> None:
sock.setblocking(False) sock.setblocking(False)
print(f"[radxa_g29_relay] UDP :0.0.0.0:{UDP_PORT} <-> {CASQUE_IP}:{UDP_PORT}", flush=True) print(f"[radxa_g29_relay] UDP :0.0.0.0:{UDP_PORT} <-> {CASQUE_IP}:{UDP_PORT}", flush=True)
serial_fd: int | None = None serial_fd: Optional[int] = None
serial_buf = bytearray() serial_buf = bytearray()
last_casque_addr = (CASQUE_IP, UDP_PORT) last_casque_addr = (CASQUE_IP, UDP_PORT)