diff --git a/src/Artemis.Core/Services/Interfaces/IRgbService.cs b/src/Artemis.Core/Services/Interfaces/IRgbService.cs
index f6b74dead..a7885911d 100644
--- a/src/Artemis.Core/Services/Interfaces/IRgbService.cs
+++ b/src/Artemis.Core/Services/Interfaces/IRgbService.cs
@@ -33,13 +33,7 @@ namespace Artemis.Core.Services.Interfaces
///
///
void AddDeviceProvider(IRGBDeviceProvider deviceProvider);
-
- ///
- /// Removes the given device provider from the by recreating it without the device provider
- ///
- ///
- void RemoveDeviceProvider(IRGBDeviceProvider deviceProvider);
-
+
void Dispose();
///
diff --git a/src/Artemis.Core/Services/RgbService.cs b/src/Artemis.Core/Services/RgbService.cs
index c7911ecfa..3d72e44ce 100644
--- a/src/Artemis.Core/Services/RgbService.cs
+++ b/src/Artemis.Core/Services/RgbService.cs
@@ -18,14 +18,13 @@ namespace Artemis.Core.Services
public class RgbService : IRgbService, IDisposable
{
private readonly List _loadedDevices;
- private readonly List _loadedDeviceProviders;
private readonly ILogger _logger;
private readonly PluginSetting _renderScaleSetting;
private readonly PluginSetting _sampleSizeSetting;
private readonly PluginSetting _targetFrameRateSetting;
private readonly TimerUpdateTrigger _updateTrigger;
private ListLedGroup _surfaceLedGroup;
-
+
internal RgbService(ILogger logger, ISettingsService settingsService)
{
_logger = logger;
@@ -40,7 +39,6 @@ namespace Artemis.Core.Services
_renderScaleSetting.SettingChanged += RenderScaleSettingOnSettingChanged;
_targetFrameRateSetting.SettingChanged += TargetFrameRateSettingOnSettingChanged;
_loadedDevices = new List();
- _loadedDeviceProviders = new List();
_updateTrigger = new TimerUpdateTrigger {UpdateFrequency = 1.0 / _targetFrameRateSetting.Value};
Surface.RegisterUpdateTrigger(_updateTrigger);
}
@@ -56,15 +54,18 @@ namespace Artemis.Core.Services
public void AddDeviceProvider(IRGBDeviceProvider deviceProvider)
{
- if (_loadedDeviceProviders.Contains(deviceProvider))
- return;
-
- Surface.LoadDevices(deviceProvider);
- _loadedDeviceProviders.Add(deviceProvider);
+ try
+ {
+ Surface.LoadDevices(deviceProvider, RGBDeviceType.All, false, true);
+ }
+ catch (Exception e)
+ {
+ _logger.Error(e, "Exception during device loading for device provider {deviceProvider}", deviceProvider.GetType().Name);
+ }
if (deviceProvider.Devices == null)
{
- _logger.Warning("RgbDevice provider {deviceProvider} has no devices", deviceProvider.GetType().Name);
+ _logger.Warning("Device provider {deviceProvider} has no devices", deviceProvider.GetType().Name);
return;
}
@@ -80,12 +81,6 @@ namespace Artemis.Core.Services
}
}
- public void RemoveDeviceProvider(IRGBDeviceProvider deviceProvider)
- {
- if (!_loadedDeviceProviders.Contains(deviceProvider))
- return;
- }
-
public void Dispose()
{
Surface.UnregisterUpdateTrigger(_updateTrigger);
diff --git a/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj b/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj
index 8d793ed38..f52f5238e 100644
--- a/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj
+++ b/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj
@@ -21,6 +21,7 @@
+
diff --git a/src/Artemis.UI/Artemis.UI.csproj b/src/Artemis.UI/Artemis.UI.csproj
index 304fb6540..38451630a 100644
--- a/src/Artemis.UI/Artemis.UI.csproj
+++ b/src/Artemis.UI/Artemis.UI.csproj
@@ -123,6 +123,7 @@
+
diff --git a/src/Plugins/Artemis.Plugins.Devices.CoolerMaster/Artemis.Plugins.Devices.CoolerMaster.csproj b/src/Plugins/Artemis.Plugins.Devices.CoolerMaster/Artemis.Plugins.Devices.CoolerMaster.csproj
index 73d670915..ce1f00872 100644
--- a/src/Plugins/Artemis.Plugins.Devices.CoolerMaster/Artemis.Plugins.Devices.CoolerMaster.csproj
+++ b/src/Plugins/Artemis.Plugins.Devices.CoolerMaster/Artemis.Plugins.Devices.CoolerMaster.csproj
@@ -15,6 +15,18 @@
pdbonly
+
+
+
+
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
PreserveNewest
diff --git a/src/Plugins/Artemis.Plugins.Devices.Corsair/CorsairDeviceProvider.cs b/src/Plugins/Artemis.Plugins.Devices.Corsair/CorsairDeviceProvider.cs
index 311487b6c..fe5d257c6 100644
--- a/src/Plugins/Artemis.Plugins.Devices.Corsair/CorsairDeviceProvider.cs
+++ b/src/Plugins/Artemis.Plugins.Devices.Corsair/CorsairDeviceProvider.cs
@@ -27,7 +27,6 @@ namespace Artemis.Plugins.Devices.Corsair
public override void DisablePlugin()
{
- _rgbService.RemoveDeviceProvider(RgbDeviceProvider);
}
public override void Dispose()
diff --git a/src/Plugins/Artemis.Plugins.Devices.DMX/Artemis.Plugins.Devices.DMX.csproj b/src/Plugins/Artemis.Plugins.Devices.DMX/Artemis.Plugins.Devices.DMX.csproj
index 25f9a3fc2..1fa3b1b68 100644
--- a/src/Plugins/Artemis.Plugins.Devices.DMX/Artemis.Plugins.Devices.DMX.csproj
+++ b/src/Plugins/Artemis.Plugins.Devices.DMX/Artemis.Plugins.Devices.DMX.csproj
@@ -23,6 +23,9 @@
PreserveNewest
+
+
+
false
diff --git a/src/Plugins/Artemis.Plugins.Devices.Logitech/Artemis.Plugins.Devices.Logitech.csproj b/src/Plugins/Artemis.Plugins.Devices.Logitech/Artemis.Plugins.Devices.Logitech.csproj
index c9fc0cc53..f8510496f 100644
--- a/src/Plugins/Artemis.Plugins.Devices.Logitech/Artemis.Plugins.Devices.Logitech.csproj
+++ b/src/Plugins/Artemis.Plugins.Devices.Logitech/Artemis.Plugins.Devices.Logitech.csproj
@@ -28,6 +28,9 @@
PreserveNewest
+
+
+
diff --git a/src/Plugins/Artemis.Plugins.Devices.Logitech/LogitechDeviceProvider.cs b/src/Plugins/Artemis.Plugins.Devices.Logitech/LogitechDeviceProvider.cs
index 2c66497cb..1073c4c9a 100644
--- a/src/Plugins/Artemis.Plugins.Devices.Logitech/LogitechDeviceProvider.cs
+++ b/src/Plugins/Artemis.Plugins.Devices.Logitech/LogitechDeviceProvider.cs
@@ -1,19 +1,26 @@
using System.IO;
+using System.Linq;
using Artemis.Core.Plugins.Abstract;
using Artemis.Core.Plugins.Models;
using Artemis.Core.Services.Interfaces;
+using HidSharp;
using RGB.NET.Core;
using RGB.NET.Devices.Logitech;
+using Serilog;
+using Serilog.Events;
namespace Artemis.Plugins.Devices.Logitech
{
public class LogitechDeviceProvider : DeviceProvider
{
+ private const int VENDOR_ID = 0x046D;
+ private readonly ILogger _logger;
private readonly IRgbService _rgbService;
- public LogitechDeviceProvider(PluginInfo pluginInfo, IRgbService rgbService) : base(pluginInfo, RGB.NET.Devices.Logitech.LogitechDeviceProvider.Instance)
+ public LogitechDeviceProvider(PluginInfo pluginInfo, IRgbService rgbService, ILogger logger) : base(pluginInfo, RGB.NET.Devices.Logitech.LogitechDeviceProvider.Instance)
{
_rgbService = rgbService;
+ _logger = logger;
}
public override void EnablePlugin()
@@ -22,6 +29,9 @@ namespace Artemis.Plugins.Devices.Logitech
RGB.NET.Devices.Logitech.LogitechDeviceProvider.PossibleX64NativePaths.Add(Path.Combine(PluginInfo.Directory.FullName, "x64", "LogitechLedEnginesWrapper.dll"));
RGB.NET.Devices.Logitech.LogitechDeviceProvider.PossibleX86NativePaths.Add(Path.Combine(PluginInfo.Directory.FullName, "x86", "LogitechLedEnginesWrapper.dll"));
_rgbService.AddDeviceProvider(RgbDeviceProvider);
+
+ if (_logger.IsEnabled(LogEventLevel.Debug))
+ LogDeviceIds();
}
public override void DisablePlugin()
@@ -31,5 +41,13 @@ namespace Artemis.Plugins.Devices.Logitech
public override void Dispose()
{
}
+
+ private void LogDeviceIds()
+ {
+ var devices = DeviceList.Local.GetHidDevices(VENDOR_ID).ToList();
+ _logger.Debug("Found {count} Logitech device(s)", devices.Count);
+ foreach (var hidDevice in devices)
+ _logger.Debug("Found Logitech device {name} with PID {pid}", hidDevice.GetFriendlyName(), hidDevice.ProductID);
+ }
}
}
\ No newline at end of file
diff --git a/src/Plugins/Artemis.Plugins.Devices.Msi/Artemis.Plugins.Devices.Msi.csproj b/src/Plugins/Artemis.Plugins.Devices.Msi/Artemis.Plugins.Devices.Msi.csproj
index ebadcfd58..acf4ad2d1 100644
--- a/src/Plugins/Artemis.Plugins.Devices.Msi/Artemis.Plugins.Devices.Msi.csproj
+++ b/src/Plugins/Artemis.Plugins.Devices.Msi/Artemis.Plugins.Devices.Msi.csproj
@@ -15,6 +15,18 @@
pdbonly
+
+
+
+
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
PreserveNewest
diff --git a/src/Plugins/Artemis.Plugins.Devices.Razer/Artemis.Plugins.Devices.Razer.csproj b/src/Plugins/Artemis.Plugins.Devices.Razer/Artemis.Plugins.Devices.Razer.csproj
index 11ea38631..85998f608 100644
--- a/src/Plugins/Artemis.Plugins.Devices.Razer/Artemis.Plugins.Devices.Razer.csproj
+++ b/src/Plugins/Artemis.Plugins.Devices.Razer/Artemis.Plugins.Devices.Razer.csproj
@@ -15,6 +15,18 @@
pdbonly
+
+
+
+
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
PreserveNewest
diff --git a/src/Plugins/Artemis.Plugins.Devices.Roccat/Artemis.Plugins.Devices.Roccat.csproj b/src/Plugins/Artemis.Plugins.Devices.Roccat/Artemis.Plugins.Devices.Roccat.csproj
index 90efa29c9..0b96b986f 100644
--- a/src/Plugins/Artemis.Plugins.Devices.Roccat/Artemis.Plugins.Devices.Roccat.csproj
+++ b/src/Plugins/Artemis.Plugins.Devices.Roccat/Artemis.Plugins.Devices.Roccat.csproj
@@ -15,6 +15,18 @@
pdbonly
+
+
+
+
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
PreserveNewest
diff --git a/src/Plugins/Artemis.Plugins.Devices.WS281X/Artemis.Plugins.Devices.WS281X.csproj b/src/Plugins/Artemis.Plugins.Devices.WS281X/Artemis.Plugins.Devices.WS281X.csproj
index 53c9987fd..41b49f390 100644
--- a/src/Plugins/Artemis.Plugins.Devices.WS281X/Artemis.Plugins.Devices.WS281X.csproj
+++ b/src/Plugins/Artemis.Plugins.Devices.WS281X/Artemis.Plugins.Devices.WS281X.csproj
@@ -23,6 +23,9 @@
PreserveNewest
+
+
+
false