diff --git a/src/modules/powerdisplay/PowerDisplay.Lib/Drivers/DDC/DdcCiController.cs b/src/modules/powerdisplay/PowerDisplay.Lib/Drivers/DDC/DdcCiController.cs index 6087350d8f..024fb276ed 100644 --- a/src/modules/powerdisplay/PowerDisplay.Lib/Drivers/DDC/DdcCiController.cs +++ b/src/modules/powerdisplay/PowerDisplay.Lib/Drivers/DDC/DdcCiController.cs @@ -370,43 +370,38 @@ namespace PowerDisplay.Common.Drivers.DDC /// public async Task> DiscoverMonitorsAsync(CancellationToken cancellationToken = default) { - return await Task.Run( - async () => + try + { + // Get monitor display info from QueryDisplayConfig, keyed by device path (unique per target) + var allMonitorDisplayInfo = DdcCiNative.GetAllMonitorDisplayInfo(); + + // Phase 1: Collect candidate monitors + var monitorHandles = EnumerateMonitorHandles(); + if (monitorHandles.Count == 0) { - try - { - // Get monitor display info from QueryDisplayConfig, keyed by device path (unique per target) - var allMonitorDisplayInfo = DdcCiNative.GetAllMonitorDisplayInfo(); + return Enumerable.Empty(); + } - // Phase 1: Collect candidate monitors - var monitorHandles = EnumerateMonitorHandles(); - if (monitorHandles.Count == 0) - { - return Enumerable.Empty(); - } + var candidateMonitors = await CollectCandidateMonitorsAsync( + monitorHandles, allMonitorDisplayInfo, cancellationToken); - var candidateMonitors = await CollectCandidateMonitorsAsync( - monitorHandles, allMonitorDisplayInfo, cancellationToken); + if (candidateMonitors.Count == 0) + { + return Enumerable.Empty(); + } - if (candidateMonitors.Count == 0) - { - return Enumerable.Empty(); - } + // Phase 2: Fetch capabilities in parallel + var fetchResults = await FetchCapabilitiesInParallelAsync( + candidateMonitors, cancellationToken); - // Phase 2: Fetch capabilities in parallel - var fetchResults = await FetchCapabilitiesInParallelAsync( - candidateMonitors, cancellationToken); - - // Phase 3: Create monitor objects - return CreateValidMonitors(fetchResults); - } - catch (Exception ex) - { - Logger.LogError($"DDC: DiscoverMonitorsAsync exception: {ex.Message}\nStack: {ex.StackTrace}"); - return Enumerable.Empty(); - } - }, - cancellationToken); + // Phase 3: Create monitor objects + return CreateValidMonitors(fetchResults); + } + catch (Exception ex) + { + Logger.LogError($"DDC: DiscoverMonitorsAsync exception: {ex.Message}\nStack: {ex.StackTrace}"); + return Enumerable.Empty(); + } } /// diff --git a/src/modules/powerdisplay/PowerDisplay.Lib/Interfaces/IMonitorController.cs b/src/modules/powerdisplay/PowerDisplay.Lib/Interfaces/IMonitorController.cs index 234345901c..541e5f0265 100644 --- a/src/modules/powerdisplay/PowerDisplay.Lib/Interfaces/IMonitorController.cs +++ b/src/modules/powerdisplay/PowerDisplay.Lib/Interfaces/IMonitorController.cs @@ -17,7 +17,7 @@ namespace PowerDisplay.Common.Interfaces public interface IMonitorController { /// - /// Controller name + /// Gets controller name /// string Name { get; }