🐛 Gracefully handle errors scanning /dev

Solves an issue with Octo4a on some Android devices.
This commit is contained in:
Gina Häußge committed 2022-05-19 09:38:00 +02:00
1 parent 26aac1701f
commit 89fbcfd214
1 file changed
+9 -4
+9 -4
View File
@@ -198,10 +198,15 @@ def serialList():
else:
candidates = []
with os.scandir("/dev") as it:
for entry in it:
if regex_serial_devices.match(entry.name):
candidates.append(entry.path)
try:
with os.scandir("/dev") as it:
for entry in it:
if regex_serial_devices.match(entry.name):
candidates.append(entry.path)
except Exception:
logging.getLogger(__name__).exception(
"Could not scan /dev for serial ports on the system"
)
# additional ports
additionalPorts = settings().get(["serial", "additionalPorts"])