Parse the settings correctly lol.
This commit is contained in:
@@ -46,8 +46,8 @@ class hardware_serial_driver(speech_driver):
|
||||
self.env = environment
|
||||
self._is_initialized = False
|
||||
settings_manager = self.env["runtime"]["SettingsManager"]
|
||||
self.device = settings_manager.get_setting(
|
||||
"speech", "hardware_device"
|
||||
self.device = self._clean_device_setting(
|
||||
settings_manager.get_setting("speech", "hardware_device")
|
||||
)
|
||||
self.baud_rate = settings_manager.get_setting_as_int(
|
||||
"speech", "hardware_baud_rate"
|
||||
@@ -69,6 +69,12 @@ class hardware_serial_driver(speech_driver):
|
||||
)
|
||||
self.worker_thread.start()
|
||||
|
||||
def _clean_device_setting(self, device):
|
||||
if not isinstance(device, str):
|
||||
return "auto"
|
||||
device = device.split("#", 1)[0].split(";", 1)[0].strip()
|
||||
return device or "auto"
|
||||
|
||||
def shutdown(self):
|
||||
if not self._is_initialized:
|
||||
return
|
||||
@@ -207,7 +213,7 @@ class hardware_serial_driver(speech_driver):
|
||||
attrs[0] &= ~(termios.IXON | termios.IXOFF | termios.IXANY)
|
||||
termios.tcsetattr(port, termios.TCSANOW, attrs)
|
||||
return port
|
||||
except OSError as error:
|
||||
except (OSError, termios.error) as error:
|
||||
self._debug(
|
||||
f"Hardware speech device open failed: {device}: {error}",
|
||||
debug.DebugLevel.ERROR,
|
||||
|
||||
Reference in New Issue
Block a user