Skip to content

Commit 296bc07

Browse files
Fix Linux Serial port selection
1 parent 72b4823 commit 296bc07

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

BabbleApp/camera.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ def run(self):
8686
self.config.capture_source is not None
8787
and self.config.capture_source != ""
8888
):
89-
if "COM" in str(self.config.capture_source):
89+
ports = ("COM", "/dev/ttyACM")
90+
if any(x in str(self.config.capture_source) for x in ports):
9091
if (
9192
self.serial_connection is None
9293
or self.camera_status == CameraState.DISCONNECTED
@@ -150,7 +151,7 @@ def run(self):
150151
if should_push and not self.capture_event.wait(timeout=0.02):
151152
continue
152153
if self.config.capture_source is not None:
153-
ports = ("COM", "/dev/tty")
154+
ports = ("COM", "/dev/ttyACM")
154155
if any(x in str(self.config.capture_source) for x in ports):
155156
self.get_serial_camera_picture(should_push)
156157
else:

BabbleApp/camera_widget.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,10 @@ def render(self, window, event, values):
319319
# if value not in self.camera_list:
320320
# self.config.capture_source = value
321321
# if "COM" not in value:
322-
ports = ("COM", "/dev/tty")
322+
ports = ("COM", "/dev/ttyACM")
323+
print(f"Value: {value}")
323324
if any(x in str(value) for x in ports):
325+
print("SERIAL PORT")
324326
self.config.capture_source = value
325327
else:
326328
cam = get_camera_index_by_name(value) # Set capture_source to the UVC index. Otherwise treat value like an ipcam if we return none
@@ -344,7 +346,7 @@ def render(self, window, event, values):
344346
and ".mp4" not in value
345347
and "udp" not in value
346348
and "COM" not in value
347-
and "/dev/tty" not in value
349+
and "/dev/ttyACM" not in value
348350
and value not in self.camera_list
349351
): # If http is not in camera address, add it.
350352
self.config.capture_source = (

0 commit comments

Comments
 (0)