Adjust timeout for auto detection. I forgot these devices would be slow because most of them are very old with much less speed than would be expected today.

This commit is contained in:
Storm Dragon
2026-05-23 18:41:42 -04:00
parent 604221a29d
commit 618987546a
3 changed files with 84 additions and 5 deletions
@@ -322,31 +322,42 @@ class hardware_serial_driver(speech_driver):
)
return [device]
devices = []
seen_devices = set()
for pattern in (
"/dev/serial/by-id/*",
"/dev/ttyACM*",
"/dev/ttyUSB*",
"/dev/ttyS0",
"/dev/ttyS1",
):
matches = sorted(glob.glob(pattern))
unique_matches = []
for match in matches:
real_device = os.path.realpath(match)
if real_device in seen_devices:
continue
seen_devices.add(real_device)
unique_matches.append(match)
self._debug(
f"Hardware speech auto scan {pattern}: {matches}",
debug.DebugLevel.INFO,
on_any_level=True,
)
if matches:
if len(matches) > 1:
if unique_matches:
if len(unique_matches) > 1:
self._debug(
"Hardware speech auto found multiple devices for "
f"{pattern}: {matches}; probing in order",
f"{pattern}: {unique_matches}; probing in order",
debug.DebugLevel.WARNING,
on_any_level=True,
)
self._debug(
f"Hardware speech auto candidate devices: {matches}",
"Hardware speech auto candidate devices: "
f"{unique_matches}",
debug.DebugLevel.INFO,
on_any_level=True,
)
devices.extend(matches)
devices.extend(unique_matches)
return devices
def _termios_baud_rate(self, baud_rate):
@@ -12,6 +12,7 @@ from fenrirscreenreader.speechDriver.hardwareSerialDriver import (
class driver(hardware_serial_driver):
cancel_command = b"\x18"
hardware_probe_command = b"\x01I"
hardware_probe_timeout = 3.5
def _speak_bytes(self, text):
return self._clean_text(text).encode("ascii", errors="replace") + b"\r"