From b05acbd4a56c90cfc5f0386bf08f58748d6bf11a Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 18 Apr 2024 08:29:55 +0200 Subject: [PATCH] Add camera to list only if it supports controls --- CollimationCircles/Services/CameraControlService.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/CollimationCircles/Services/CameraControlService.cs b/CollimationCircles/Services/CameraControlService.cs index fdc67e0..469348a 100644 --- a/CollimationCircles/Services/CameraControlService.cs +++ b/CollimationCircles/Services/CameraControlService.cs @@ -202,7 +202,7 @@ public static async Task> GetV4L2CameraControls(Camera camer var matches = Regex.Matches(result, pattern); - logger.Info($"Parsed {matches.Count} controls for '{camera.Name}'"); + logger.Info($"Parsed {matches.Count} controls for '{camera.Name} {camera.Path}'"); foreach (Match m in matches.Cast()) { @@ -318,7 +318,7 @@ public static async Task> GetV4L2Cameras() if (match.Success) { - string name = match.Groups[2].Value.Trim(); + string name = match.Groups[1].Value.Trim(); string[] camStr = match.Groups[3].Value.Trim().Split("\t"); @@ -338,9 +338,11 @@ public static async Task> GetV4L2Cameras() c.Controls = await GetV4L2CameraControls(c); - cameras.Add(c); - - logger.Info($"Adding camera: '{c.Name} {c.Path}'"); + if (c.Controls.Count > 0) + { + cameras.Add(c); + logger.Info($"Adding camera: '{c.Name} {c.Path}'"); + } } } else