Fix Linux Serial port selection

This commit is contained in:
Rames The Generic committed 2025-01-29 18:02:43 -05:00
1 parent 72b48235f5
commit 296bc078eb
2 files changed
+7 -4

No files matched your search

+3 -2
View File
@@ -86,7 +86,8 @@ class Camera:
self.config.capture_source is not None
and self.config.capture_source != ""
):
if "COM" in str(self.config.capture_source):
ports = ("COM", "/dev/ttyACM")
if any(x in str(self.config.capture_source) for x in ports):
if (
self.serial_connection is None
or self.camera_status == CameraState.DISCONNECTED
@@ -150,7 +151,7 @@ class Camera:
if should_push and not self.capture_event.wait(timeout=0.02):
continue
if self.config.capture_source is not None:
ports = ("COM", "/dev/tty")
ports = ("COM", "/dev/ttyACM")
if any(x in str(self.config.capture_source) for x in ports):
self.get_serial_camera_picture(should_push)
else:
+4 -2
View File
@@ -319,8 +319,10 @@ class CameraWidget:
# if value not in self.camera_list:
# self.config.capture_source = value
# if "COM" not in value:
ports = ("COM", "/dev/tty")
ports = ("COM", "/dev/ttyACM")
print(f"Value: {value}")
if any(x in str(value) for x in ports):
print("SERIAL PORT")
self.config.capture_source = value
else:
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 @@ class CameraWidget:
and ".mp4" not in value
and "udp" not in value
and "COM" not in value
and "/dev/tty" not in value
and "/dev/ttyACM" not in value
and value not in self.camera_list
): # If http is not in camera address, add it.
self.config.capture_source = (