diff --git a/src/Logitech/Artemis.Plugins.Wrappers.Logitech/Services/LogitechPipeListenerService.cs b/src/Logitech/Artemis.Plugins.Wrappers.Logitech/Services/LogitechPipeListenerService.cs index d4c50c3..1db5a2d 100644 --- a/src/Logitech/Artemis.Plugins.Wrappers.Logitech/Services/LogitechPipeListenerService.cs +++ b/src/Logitech/Artemis.Plugins.Wrappers.Logitech/Services/LogitechPipeListenerService.cs @@ -38,13 +38,18 @@ public LogitechPipeListenerService(ILogger logger, Plugin plugin) _colors = new(); _excluded = new(); - _pipeListener = new("LGS_LED_SDK-00000001"); + var id = WTSGetActiveConsoleSessionId(); + var pipeName = $"LGS_LED_SDK-{id:00000000}"; + _pipeListener = new(pipeName); _pipeListener.ClientConnected += OnPipeListenerClientConnected; _pipeListener.ClientDisconnected += OnPipeListenerClientDisconnected; _pipeListener.CommandReceived += OnPipeListenerCommandReceived; _pipeListener.Exception += OnPipeListenerException; } + [DllImport("kernel32.dll")] + private static extern uint WTSGetActiveConsoleSessionId(); + private void OnPipeListenerException(object sender, Exception e) { _logger.Error(e, "Logitech wrapper reader exception ");