mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-12 17:48:31 +00:00
Added Led-Mapping base class and centralized HID-device-detection
This commit is contained in:
parent
eb3b91d8d8
commit
7f3abaefec
81
RGB.NET.Core/Leds/LedMapping.cs
Normal file
81
RGB.NET.Core/Leds/LedMapping.cs
Normal file
@ -0,0 +1,81 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace RGB.NET.Core
|
||||
{
|
||||
public class LedMapping<T> : IEnumerable<(LedId ledId, T mapping)>
|
||||
where T : notnull
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private readonly Dictionary<LedId, T> _mapping = new();
|
||||
private readonly Dictionary<T, LedId> _reverseMapping = new();
|
||||
|
||||
public int Count => _mapping.Count;
|
||||
|
||||
public ICollection<LedId> LedIds => _mapping.Keys;
|
||||
public ICollection<T> Mappings => _reverseMapping.Keys;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Indexer
|
||||
|
||||
public T this[LedId ledId]
|
||||
{
|
||||
get => _mapping[ledId];
|
||||
set
|
||||
{
|
||||
_mapping[ledId] = value;
|
||||
_reverseMapping[value] = ledId;
|
||||
}
|
||||
}
|
||||
|
||||
public LedId this[T mapping]
|
||||
{
|
||||
get => _reverseMapping[mapping];
|
||||
set => this[value] = mapping;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
public void Add(LedId ledId, T mapping)
|
||||
{
|
||||
_mapping.Add(ledId, mapping);
|
||||
_reverseMapping.Add(mapping, ledId);
|
||||
}
|
||||
|
||||
public bool Contains(LedId ledId) => _mapping.ContainsKey(ledId);
|
||||
public bool Contains(T mapping) => _reverseMapping.ContainsKey(mapping);
|
||||
|
||||
public bool TryGetValue(LedId ledId, out T? mapping) => _mapping.TryGetValue(ledId, out mapping);
|
||||
public bool TryGetValue(T mapping, out LedId ledId) => _reverseMapping.TryGetValue(mapping, out ledId);
|
||||
|
||||
public bool Remove(LedId ledId)
|
||||
{
|
||||
if (_mapping.TryGetValue(ledId, out T? mapping))
|
||||
_reverseMapping.Remove(mapping);
|
||||
return _mapping.Remove(ledId);
|
||||
}
|
||||
|
||||
public bool Remove(T mapping)
|
||||
{
|
||||
if (_reverseMapping.TryGetValue(mapping, out LedId ledId))
|
||||
_mapping.Remove(ledId);
|
||||
return _reverseMapping.Remove(mapping);
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
_mapping.Clear();
|
||||
_reverseMapping.Clear();
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
||||
public IEnumerator<(LedId ledId, T mapping)> GetEnumerator() => _mapping.Select(x => (x.Key, x.Value)).GetEnumerator();
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -1,138 +0,0 @@
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
#pragma warning disable 1591 // Missing XML comment for publicly visible type or member
|
||||
|
||||
namespace RGB.NET.Devices.Logitech
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains list of all LEDs available for all logitech devices.
|
||||
/// </summary>
|
||||
public enum LogitechLedId
|
||||
{
|
||||
Invalid = 0,
|
||||
ESC = 0x01,
|
||||
F1 = 0x3b,
|
||||
F2 = 0x3c,
|
||||
F3 = 0x3d,
|
||||
F4 = 0x3e,
|
||||
F5 = 0x3f,
|
||||
F6 = 0x40,
|
||||
F7 = 0x41,
|
||||
F8 = 0x42,
|
||||
F9 = 0x43,
|
||||
F10 = 0x44,
|
||||
F11 = 0x57,
|
||||
F12 = 0x58,
|
||||
PRINT_SCREEN = 0x137,
|
||||
SCROLL_LOCK = 0x46,
|
||||
PAUSE_BREAK = 0x45,
|
||||
|
||||
TILDE = 0x29,
|
||||
ONE = 0x02,
|
||||
TWO = 0x03,
|
||||
THREE = 0x04,
|
||||
FOUR = 0x05,
|
||||
FIVE = 0x06,
|
||||
SIX = 0x07,
|
||||
SEVEN = 0x08,
|
||||
EIGHT = 0x09,
|
||||
NINE = 0x0A,
|
||||
ZERO = 0x0B,
|
||||
MINUS = 0x0C,
|
||||
EQUALS = 0x0D,
|
||||
BACKSPACE = 0x0E,
|
||||
INSERT = 0x152,
|
||||
HOME = 0x147,
|
||||
PAGE_UP = 0x149,
|
||||
NUM_LOCK = 0x145,
|
||||
NUM_SLASH = 0x135,
|
||||
NUM_ASTERISK = 0x37,
|
||||
NUM_MINUS = 0x4A,
|
||||
|
||||
TAB = 0x0F,
|
||||
Q = 0x10,
|
||||
W = 0x11,
|
||||
E = 0x12,
|
||||
R = 0x13,
|
||||
T = 0x14,
|
||||
Y = 0x15,
|
||||
U = 0x16,
|
||||
I = 0x17,
|
||||
O = 0x18,
|
||||
P = 0x19,
|
||||
OPEN_BRACKET = 0x1A,
|
||||
CLOSE_BRACKET = 0x1B,
|
||||
BACKSLASH = 0x2B,
|
||||
KEYBOARD_DELETE = 0x153,
|
||||
END = 0x14F,
|
||||
PAGE_DOWN = 0x151,
|
||||
NUM_SEVEN = 0x47,
|
||||
NUM_EIGHT = 0x48,
|
||||
NUM_NINE = 0x49,
|
||||
NUM_PLUS = 0x4E,
|
||||
|
||||
CAPS_LOCK = 0x3A,
|
||||
A = 0x1E,
|
||||
S = 0x1F,
|
||||
D = 0x20,
|
||||
F = 0x21,
|
||||
G = 0x22,
|
||||
H = 0x23,
|
||||
J = 0x24,
|
||||
K = 0x25,
|
||||
L = 0x26,
|
||||
SEMICOLON = 0x27,
|
||||
APOSTROPHE = 0x28,
|
||||
NonUsTilde = 0xFF, //TODO DarthAffe 26.03.2017: Find the real ID/Name of this key - it's not documented ...
|
||||
ENTER = 0x1C,
|
||||
NUM_FOUR = 0x4B,
|
||||
NUM_FIVE = 0x4C,
|
||||
NUM_SIX = 0x4D,
|
||||
|
||||
LEFT_SHIFT = 0x2A,
|
||||
Z = 0x2C,
|
||||
X = 0x2D,
|
||||
C = 0x2E,
|
||||
V = 0x2F,
|
||||
B = 0x30,
|
||||
N = 0x31,
|
||||
M = 0x32,
|
||||
COMMA = 0x33,
|
||||
PERIOD = 0x34,
|
||||
FORWARD_SLASH = 0x35,
|
||||
RIGHT_SHIFT = 0x36,
|
||||
ARROW_UP = 0x148,
|
||||
NUM_ONE = 0x4F,
|
||||
NUM_TWO = 0x50,
|
||||
NUM_THREE = 0x51,
|
||||
NUM_ENTER = 0x11C,
|
||||
|
||||
LEFT_CONTROL = 0x1D,
|
||||
LEFT_WINDOWS = 0x15B,
|
||||
LEFT_ALT = 0x38,
|
||||
SPACE = 0x39,
|
||||
RIGHT_ALT = 0x138,
|
||||
RIGHT_WINDOWS = 0x15C,
|
||||
APPLICATION_SELECT = 0x15D,
|
||||
RIGHT_CONTROL = 0x11D,
|
||||
ARROW_LEFT = 0x14B,
|
||||
ARROW_DOWN = 0x150,
|
||||
ARROW_RIGHT = 0x14D,
|
||||
NUM_ZERO = 0x52,
|
||||
NUM_PERIOD = 0x53,
|
||||
|
||||
G_1 = 0xFFF1,
|
||||
G_2 = 0xFFF2,
|
||||
G_3 = 0xFFF3,
|
||||
G_4 = 0xFFF4,
|
||||
G_5 = 0xFFF5,
|
||||
G_6 = 0xFFF6,
|
||||
G_7 = 0xFFF7,
|
||||
G_8 = 0xFFF8,
|
||||
G_9 = 0xFFF9,
|
||||
G_LOGO = 0xFFFF1,
|
||||
G_BADGE = 0xFFFF2,
|
||||
|
||||
DEVICE = 0xFFFFFFF
|
||||
}
|
||||
}
|
||||
326
RGB.NET.Devices.Logitech/Generic/LedMappings.cs
Normal file
326
RGB.NET.Devices.Logitech/Generic/LedMappings.cs
Normal file
@ -0,0 +1,326 @@
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Devices.Logitech
|
||||
{
|
||||
public static class LedMappings
|
||||
{
|
||||
public static LedMapping<int> PerKey { get; } = new()
|
||||
{
|
||||
{ LedId.Keyboard_Escape, 0 },
|
||||
{ LedId.Keyboard_F1, 4 },
|
||||
{ LedId.Keyboard_F2, 8 },
|
||||
{ LedId.Keyboard_F3, 12 },
|
||||
{ LedId.Keyboard_F4, 16 },
|
||||
{ LedId.Keyboard_F5, 20 },
|
||||
{ LedId.Keyboard_F6, 24 },
|
||||
{ LedId.Keyboard_F7, 28 },
|
||||
{ LedId.Keyboard_F8, 32 },
|
||||
{ LedId.Keyboard_F9, 36 },
|
||||
{ LedId.Keyboard_F10, 40 },
|
||||
{ LedId.Keyboard_F11, 44 },
|
||||
{ LedId.Keyboard_F12, 48 },
|
||||
{ LedId.Keyboard_PrintScreen, 52 },
|
||||
{ LedId.Keyboard_ScrollLock, 56 },
|
||||
{ LedId.Keyboard_PauseBreak, 60 },
|
||||
// { LedId.Keyboard_?, 64 },
|
||||
// { LedId.Keyboard_?, 68 },
|
||||
// { LedId.Keyboard_?, 72 },
|
||||
// { LedId.Keyboard_?, 76 },
|
||||
// { LedId.Keyboard_?, 80 },
|
||||
|
||||
{ LedId.Keyboard_GraveAccentAndTilde, 84 },
|
||||
{ LedId.Keyboard_1, 88 },
|
||||
{ LedId.Keyboard_2, 92 },
|
||||
{ LedId.Keyboard_3, 96 },
|
||||
{ LedId.Keyboard_4, 100 },
|
||||
{ LedId.Keyboard_5, 104 },
|
||||
{ LedId.Keyboard_6, 108 },
|
||||
{ LedId.Keyboard_7, 112 },
|
||||
{ LedId.Keyboard_8, 116 },
|
||||
{ LedId.Keyboard_9, 120 },
|
||||
{ LedId.Keyboard_0, 124 },
|
||||
{ LedId.Keyboard_MinusAndUnderscore, 128 },
|
||||
{ LedId.Keyboard_EqualsAndPlus, 132 },
|
||||
{ LedId.Keyboard_Backspace, 136 },
|
||||
{ LedId.Keyboard_Insert, 140 },
|
||||
{ LedId.Keyboard_Home, 144 },
|
||||
{ LedId.Keyboard_PageUp, 148 },
|
||||
{ LedId.Keyboard_NumLock, 152 },
|
||||
{ LedId.Keyboard_NumSlash, 156 },
|
||||
{ LedId.Keyboard_NumAsterisk, 160 },
|
||||
{ LedId.Keyboard_NumMinus, 164 },
|
||||
|
||||
{ LedId.Keyboard_Tab, 168 },
|
||||
{ LedId.Keyboard_Q, 172 },
|
||||
{ LedId.Keyboard_W, 176 },
|
||||
{ LedId.Keyboard_E, 180 },
|
||||
{ LedId.Keyboard_R, 184 },
|
||||
{ LedId.Keyboard_T, 188 },
|
||||
{ LedId.Keyboard_Y, 192 },
|
||||
{ LedId.Keyboard_U, 196 },
|
||||
{ LedId.Keyboard_I, 200 },
|
||||
{ LedId.Keyboard_O, 204 },
|
||||
{ LedId.Keyboard_P, 208 },
|
||||
{ LedId.Keyboard_BracketLeft, 212 },
|
||||
{ LedId.Keyboard_BracketRight, 216 },
|
||||
{ LedId.Keyboard_Backslash, 220 },
|
||||
{ LedId.Keyboard_Delete, 224 },
|
||||
{ LedId.Keyboard_End, 228 },
|
||||
{ LedId.Keyboard_PageDown, 232 },
|
||||
{ LedId.Keyboard_Num7, 236 },
|
||||
{ LedId.Keyboard_Num8, 240 },
|
||||
{ LedId.Keyboard_Num9, 244 },
|
||||
{ LedId.Keyboard_NumPlus, 248 },
|
||||
|
||||
{ LedId.Keyboard_CapsLock, 252 },
|
||||
{ LedId.Keyboard_A, 256 },
|
||||
{ LedId.Keyboard_S, 260 },
|
||||
{ LedId.Keyboard_D, 264 },
|
||||
{ LedId.Keyboard_F, 268 },
|
||||
{ LedId.Keyboard_G, 272 },
|
||||
{ LedId.Keyboard_H, 276 },
|
||||
{ LedId.Keyboard_J, 280 },
|
||||
{ LedId.Keyboard_K, 284 },
|
||||
{ LedId.Keyboard_L, 288 },
|
||||
{ LedId.Keyboard_SemicolonAndColon, 292 },
|
||||
{ LedId.Keyboard_ApostropheAndDoubleQuote, 296 },
|
||||
{ LedId.Keyboard_NonUsTilde, 300 }, //TODO DarthAffe 26.03.2017: Find the real ID/Name of this key - it's not documented ...
|
||||
{ LedId.Keyboard_Enter, 304 },
|
||||
// { LedId.Keyboard_?, 308 },
|
||||
// { LedId.Keyboard_?, 312 },
|
||||
// { LedId.Keyboard_?, 316 },
|
||||
{ LedId.Keyboard_Num4, 320 },
|
||||
{ LedId.Keyboard_Num5, 324 },
|
||||
{ LedId.Keyboard_Num6, 328 },
|
||||
// { LedId.Keyboard_?, 332 },
|
||||
|
||||
{ LedId.Keyboard_LeftShift, 336 },
|
||||
{ LedId.Keyboard_NonUsBackslash, 340 },
|
||||
{ LedId.Keyboard_Z, 344 },
|
||||
{ LedId.Keyboard_X, 348 },
|
||||
{ LedId.Keyboard_C, 352 },
|
||||
{ LedId.Keyboard_V, 356 },
|
||||
{ LedId.Keyboard_B, 360 },
|
||||
{ LedId.Keyboard_N, 364 },
|
||||
{ LedId.Keyboard_M, 368 },
|
||||
{ LedId.Keyboard_CommaAndLessThan, 372 },
|
||||
{ LedId.Keyboard_PeriodAndBiggerThan, 376 },
|
||||
{ LedId.Keyboard_SlashAndQuestionMark, 380 },
|
||||
{ LedId.Keyboard_RightShift, 388 },
|
||||
// { LedId.Keyboard_?, 392 },
|
||||
{ LedId.Keyboard_ArrowUp, 396 },
|
||||
// { LedId.Keyboard_?, 400 },
|
||||
{ LedId.Keyboard_Num1, 404 },
|
||||
{ LedId.Keyboard_Num2, 408 },
|
||||
{ LedId.Keyboard_Num3, 412 },
|
||||
{ LedId.Keyboard_NumEnter, 416 },
|
||||
|
||||
{ LedId.Keyboard_LeftCtrl, 420 },
|
||||
{ LedId.Keyboard_LeftGui, 424 },
|
||||
{ LedId.Keyboard_LeftAlt, 428 },
|
||||
// { LedId.Keyboard_?, 432 },
|
||||
// { LedId.Keyboard_?, 436 },
|
||||
{ LedId.Keyboard_Space, 440 },
|
||||
// { LedId.Keyboard_?, 444 },
|
||||
// { LedId.Keyboard_?, 448 },
|
||||
// { LedId.Keyboard_?, 452 },
|
||||
// { LedId.Keyboard_?, 456 },
|
||||
// { LedId.Keyboard_?, 460 },
|
||||
{ LedId.Keyboard_RightAlt, 464 },
|
||||
{ LedId.Keyboard_RightGui, 468 },
|
||||
{ LedId.Keyboard_Application, 472 },
|
||||
{ LedId.Keyboard_RightCtrl, 476 },
|
||||
{ LedId.Keyboard_ArrowLeft, 480 },
|
||||
{ LedId.Keyboard_ArrowDown, 484 },
|
||||
{ LedId.Keyboard_ArrowRight, 488 },
|
||||
{ LedId.Keyboard_Num0, 492 },
|
||||
{ LedId.Keyboard_NumPeriodAndDelete, 496 },
|
||||
// { LedId.Keyboard_?, 500 },
|
||||
};
|
||||
|
||||
public static LedMapping<int> Device { get; } = new()
|
||||
{
|
||||
{ LedId.Custom1, 0 }
|
||||
};
|
||||
|
||||
public static LedMapping<int> ZoneKeyboard { get; } = new()
|
||||
{
|
||||
{ LedId.Keyboard_Programmable1, 0 },
|
||||
{ LedId.Keyboard_Programmable2, 1 },
|
||||
{ LedId.Keyboard_Programmable3, 2 },
|
||||
{ LedId.Keyboard_Programmable4, 3 },
|
||||
{ LedId.Keyboard_Programmable5, 4 },
|
||||
{ LedId.Keyboard_Programmable6, 5 },
|
||||
{ LedId.Keyboard_Programmable7, 6 },
|
||||
{ LedId.Keyboard_Programmable8, 7 },
|
||||
{ LedId.Keyboard_Programmable9, 8 },
|
||||
{ LedId.Keyboard_Programmable10, 9 },
|
||||
{ LedId.Keyboard_Programmable11, 10 },
|
||||
{ LedId.Keyboard_Programmable12, 11 },
|
||||
{ LedId.Keyboard_Programmable13, 12 },
|
||||
{ LedId.Keyboard_Programmable14, 13 },
|
||||
{ LedId.Keyboard_Programmable15, 14 },
|
||||
{ LedId.Keyboard_Programmable16, 15 },
|
||||
{ LedId.Keyboard_Programmable17, 16 },
|
||||
{ LedId.Keyboard_Programmable18, 17 },
|
||||
{ LedId.Keyboard_Programmable19, 18 },
|
||||
{ LedId.Keyboard_Programmable20, 19 },
|
||||
{ LedId.Keyboard_Programmable21, 20 },
|
||||
{ LedId.Keyboard_Programmable22, 21 },
|
||||
{ LedId.Keyboard_Programmable23, 22 },
|
||||
{ LedId.Keyboard_Programmable24, 23 },
|
||||
{ LedId.Keyboard_Programmable25, 24 },
|
||||
{ LedId.Keyboard_Programmable26, 25 },
|
||||
{ LedId.Keyboard_Programmable27, 26 },
|
||||
{ LedId.Keyboard_Programmable28, 27 },
|
||||
{ LedId.Keyboard_Programmable29, 28 },
|
||||
{ LedId.Keyboard_Programmable30, 29 },
|
||||
{ LedId.Keyboard_Programmable31, 30 },
|
||||
{ LedId.Keyboard_Programmable32, 31 },
|
||||
};
|
||||
|
||||
public static LedMapping<int> ZoneMouse { get; } = new()
|
||||
{
|
||||
{ LedId.Mouse1, 0 },
|
||||
{ LedId.Mouse2, 1 },
|
||||
{ LedId.Mouse3, 2 },
|
||||
{ LedId.Mouse4, 3 },
|
||||
{ LedId.Mouse5, 4 },
|
||||
{ LedId.Mouse6, 5 },
|
||||
{ LedId.Mouse7, 6 },
|
||||
{ LedId.Mouse8, 7 },
|
||||
{ LedId.Mouse9, 8 },
|
||||
{ LedId.Mouse10, 9 },
|
||||
{ LedId.Mouse11, 10 },
|
||||
{ LedId.Mouse12, 11 },
|
||||
{ LedId.Mouse13, 12 },
|
||||
{ LedId.Mouse14, 13 },
|
||||
{ LedId.Mouse15, 14 },
|
||||
{ LedId.Mouse16, 15 },
|
||||
{ LedId.Mouse17, 16 },
|
||||
{ LedId.Mouse18, 17 },
|
||||
{ LedId.Mouse19, 18 },
|
||||
{ LedId.Mouse20, 19 },
|
||||
{ LedId.Mouse21, 20 },
|
||||
{ LedId.Mouse22, 21 },
|
||||
{ LedId.Mouse23, 22 },
|
||||
{ LedId.Mouse24, 23 },
|
||||
{ LedId.Mouse25, 24 },
|
||||
{ LedId.Mouse26, 25 },
|
||||
{ LedId.Mouse27, 26 },
|
||||
{ LedId.Mouse28, 27 },
|
||||
{ LedId.Mouse29, 28 },
|
||||
{ LedId.Mouse30, 29 },
|
||||
{ LedId.Mouse31, 30 },
|
||||
{ LedId.Mouse32, 31 },
|
||||
};
|
||||
|
||||
public static LedMapping<int> ZoneHeadset { get; } = new()
|
||||
{
|
||||
{ LedId.Headset1, 0 },
|
||||
{ LedId.Headset2, 1 },
|
||||
{ LedId.Headset3, 2 },
|
||||
{ LedId.Headset4, 3 },
|
||||
{ LedId.Headset5, 4 },
|
||||
{ LedId.Headset6, 5 },
|
||||
{ LedId.Headset7, 6 },
|
||||
{ LedId.Headset8, 7 },
|
||||
{ LedId.Headset9, 8 },
|
||||
{ LedId.Headset10, 9 },
|
||||
{ LedId.Headset11, 10 },
|
||||
{ LedId.Headset12, 11 },
|
||||
{ LedId.Headset13, 12 },
|
||||
{ LedId.Headset14, 13 },
|
||||
{ LedId.Headset15, 14 },
|
||||
{ LedId.Headset16, 15 },
|
||||
{ LedId.Headset17, 16 },
|
||||
{ LedId.Headset18, 17 },
|
||||
{ LedId.Headset19, 18 },
|
||||
{ LedId.Headset20, 19 },
|
||||
{ LedId.Headset21, 20 },
|
||||
{ LedId.Headset22, 21 },
|
||||
{ LedId.Headset23, 22 },
|
||||
{ LedId.Headset24, 23 },
|
||||
{ LedId.Headset25, 24 },
|
||||
{ LedId.Headset26, 25 },
|
||||
{ LedId.Headset27, 26 },
|
||||
{ LedId.Headset28, 27 },
|
||||
{ LedId.Headset29, 28 },
|
||||
{ LedId.Headset30, 29 },
|
||||
{ LedId.Headset31, 30 },
|
||||
{ LedId.Headset32, 31 },
|
||||
};
|
||||
|
||||
public static LedMapping<int> ZoneMousepad { get; } = new()
|
||||
{
|
||||
{ LedId.Mousepad1, 0 },
|
||||
{ LedId.Mousepad2, 1 },
|
||||
{ LedId.Mousepad3, 2 },
|
||||
{ LedId.Mousepad4, 3 },
|
||||
{ LedId.Mousepad5, 4 },
|
||||
{ LedId.Mousepad6, 5 },
|
||||
{ LedId.Mousepad7, 6 },
|
||||
{ LedId.Mousepad8, 7 },
|
||||
{ LedId.Mousepad9, 8 },
|
||||
{ LedId.Mousepad10, 9 },
|
||||
{ LedId.Mousepad11, 10 },
|
||||
{ LedId.Mousepad12, 11 },
|
||||
{ LedId.Mousepad13, 12 },
|
||||
{ LedId.Mousepad14, 13 },
|
||||
{ LedId.Mousepad15, 14 },
|
||||
{ LedId.Mousepad16, 15 },
|
||||
{ LedId.Mousepad17, 16 },
|
||||
{ LedId.Mousepad18, 17 },
|
||||
{ LedId.Mousepad19, 18 },
|
||||
{ LedId.Mousepad20, 19 },
|
||||
{ LedId.Mousepad21, 20 },
|
||||
{ LedId.Mousepad22, 21 },
|
||||
{ LedId.Mousepad23, 22 },
|
||||
{ LedId.Mousepad24, 23 },
|
||||
{ LedId.Mousepad25, 24 },
|
||||
{ LedId.Mousepad26, 25 },
|
||||
{ LedId.Mousepad27, 26 },
|
||||
{ LedId.Mousepad28, 27 },
|
||||
{ LedId.Mousepad29, 28 },
|
||||
{ LedId.Mousepad30, 29 },
|
||||
{ LedId.Mousepad31, 30 },
|
||||
{ LedId.Mousepad32, 31 },
|
||||
};
|
||||
|
||||
public static LedMapping<int> ZoneSpeaker { get; } = new()
|
||||
{
|
||||
{ LedId.Speaker1, 0 },
|
||||
{ LedId.Speaker2, 1 },
|
||||
{ LedId.Speaker3, 2 },
|
||||
{ LedId.Speaker4, 3 },
|
||||
{ LedId.Speaker5, 4 },
|
||||
{ LedId.Speaker6, 5 },
|
||||
{ LedId.Speaker7, 6 },
|
||||
{ LedId.Speaker8, 7 },
|
||||
{ LedId.Speaker9, 8 },
|
||||
{ LedId.Speaker10, 9 },
|
||||
{ LedId.Speaker11, 10 },
|
||||
{ LedId.Speaker12, 11 },
|
||||
{ LedId.Speaker13, 12 },
|
||||
{ LedId.Speaker14, 13 },
|
||||
{ LedId.Speaker15, 14 },
|
||||
{ LedId.Speaker16, 15 },
|
||||
{ LedId.Speaker17, 16 },
|
||||
{ LedId.Speaker18, 17 },
|
||||
{ LedId.Speaker19, 18 },
|
||||
{ LedId.Speaker20, 19 },
|
||||
{ LedId.Speaker21, 20 },
|
||||
{ LedId.Speaker22, 21 },
|
||||
{ LedId.Speaker23, 22 },
|
||||
{ LedId.Speaker24, 23 },
|
||||
{ LedId.Speaker25, 24 },
|
||||
{ LedId.Speaker26, 25 },
|
||||
{ LedId.Speaker27, 26 },
|
||||
{ LedId.Speaker28, 27 },
|
||||
{ LedId.Speaker29, 28 },
|
||||
{ LedId.Speaker30, 29 },
|
||||
{ LedId.Speaker31, 30 },
|
||||
{ LedId.Speaker32, 31 },
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -1,133 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using HidSharp;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Devices.Logitech.HID
|
||||
{
|
||||
internal static class DeviceChecker
|
||||
{
|
||||
#region Constants
|
||||
|
||||
private const int VENDOR_ID = 0x046D;
|
||||
|
||||
private static readonly List<(string model, RGBDeviceType deviceType, int id, int zones)> PER_KEY_DEVICES
|
||||
= new()
|
||||
{
|
||||
("G910", RGBDeviceType.Keyboard, 0xC32B, 0),
|
||||
("G910v2", RGBDeviceType.Keyboard, 0xC335, 0),
|
||||
("G915", RGBDeviceType.Keyboard, 0xC541, 0),
|
||||
("G815", RGBDeviceType.Keyboard, 0xC33F, 0),
|
||||
("G810", RGBDeviceType.Keyboard, 0xC337, 0),
|
||||
("G810", RGBDeviceType.Keyboard, 0xC331, 0),
|
||||
("G610", RGBDeviceType.Keyboard, 0xC333, 0),
|
||||
("G512", RGBDeviceType.Keyboard, 0xC33C, 0),
|
||||
("G512 SE", RGBDeviceType.Keyboard, 0xC342, 0),
|
||||
("G410", RGBDeviceType.Keyboard, 0xC330, 0),
|
||||
("G213", RGBDeviceType.Keyboard, 0xC336, 0),
|
||||
("Pro", RGBDeviceType.Keyboard, 0xC339, 0),
|
||||
("G915 TKL", RGBDeviceType.Keyboard, 0xC343, 0),
|
||||
("Lightspeed Keyboard Dongle", RGBDeviceType.Keyboard, 0xC545, 0),
|
||||
};
|
||||
|
||||
private static readonly List<(string model, RGBDeviceType deviceType, int id, int zones)> PER_DEVICE_DEVICES
|
||||
= new()
|
||||
{
|
||||
("G19", RGBDeviceType.Keyboard, 0xC228, 0),
|
||||
("G19s", RGBDeviceType.Keyboard, 0xC229, 0),
|
||||
("G600", RGBDeviceType.Mouse, 0xC24A, 0),
|
||||
("G300s", RGBDeviceType.Mouse, 0xC246, 0),
|
||||
("G510", RGBDeviceType.Keyboard, 0xC22D, 0),
|
||||
("G510s", RGBDeviceType.Keyboard, 0xC22E, 0),
|
||||
("G13", RGBDeviceType.Keypad, 0xC21C, 0),
|
||||
("G110", RGBDeviceType.Keyboard, 0xC22B, 0),
|
||||
("G710+", RGBDeviceType.Keyboard, 0xC24D, 0),
|
||||
("G105", RGBDeviceType.Keyboard, 0xC248, 0),
|
||||
("G15", RGBDeviceType.Keyboard, 0xC222, 0),
|
||||
("G11", RGBDeviceType.Keyboard, 0xC225, 0),
|
||||
};
|
||||
|
||||
private static readonly List<(string model, RGBDeviceType deviceType, int id, int zones)> ZONE_DEVICES
|
||||
= new()
|
||||
{
|
||||
("G213", RGBDeviceType.Keyboard, 0xC336, 5),
|
||||
("G903", RGBDeviceType.Mouse, 0xC086, 2),
|
||||
("Lightspeed Mouse Dongle", RGBDeviceType.Mouse, 0xC539, 2),
|
||||
("G703", RGBDeviceType.Mouse, 0xC087, 2),
|
||||
("G502 HERO", RGBDeviceType.Mouse, 0xC08B, 2),
|
||||
("G502 Lightspeed", RGBDeviceType.Mouse, 0xC08D, 2),
|
||||
("G502", RGBDeviceType.Mouse, 0xC332, 2),
|
||||
("G403", RGBDeviceType.Mouse, 0xC083, 2),
|
||||
("G303", RGBDeviceType.Mouse, 0xC080, 2),
|
||||
("G203", RGBDeviceType.Mouse, 0xC084, 1),
|
||||
("G Pro", RGBDeviceType.Mouse, 0xC085, 1),
|
||||
("G Pro Wireless", RGBDeviceType.Mouse, 0xC088, 2),
|
||||
("G Pro Hero", RGBDeviceType.Mouse, 0xC08C, 1),
|
||||
("G633", RGBDeviceType.Headset, 0x0A5C, 2),
|
||||
("G933", RGBDeviceType.Headset, 0x0A5B, 2),
|
||||
("G935", RGBDeviceType.Headset, 0x0A87, 2),
|
||||
("G560", RGBDeviceType.Speaker, 0x0A78, 4),
|
||||
("G733", RGBDeviceType.Speaker, 0xAB5, 2),
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties & Fields
|
||||
|
||||
public static bool IsPerKeyDeviceConnected { get; private set; }
|
||||
public static (string model, RGBDeviceType deviceType, int id, int zones) PerKeyDeviceData { get; private set; }
|
||||
|
||||
public static bool IsPerDeviceDeviceConnected { get; private set; }
|
||||
public static (string model, RGBDeviceType deviceType, int id, int zones) PerDeviceDeviceData { get; private set; }
|
||||
|
||||
public static bool IsZoneDeviceConnected { get; private set; }
|
||||
public static IEnumerable<(string model, RGBDeviceType deviceType, int id, int zones)> ZoneDeviceData { get; private set; } = Enumerable.Empty<(string model, RGBDeviceType deviceType, int id, int zones)>();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
internal static void LoadDeviceList()
|
||||
{
|
||||
List<int> ids = DeviceList.Local.GetHidDevices(VENDOR_ID).Select(x => x.ProductID).Distinct().ToList();
|
||||
|
||||
foreach ((string model, RGBDeviceType deviceType, int id, int zones) deviceData in PER_KEY_DEVICES)
|
||||
if (ids.Contains(deviceData.id))
|
||||
{
|
||||
IsPerKeyDeviceConnected = true;
|
||||
PerKeyDeviceData = deviceData;
|
||||
break;
|
||||
}
|
||||
|
||||
foreach ((string model, RGBDeviceType deviceType, int id, int zones) deviceData in PER_DEVICE_DEVICES)
|
||||
if (ids.Contains(deviceData.id))
|
||||
{
|
||||
IsPerDeviceDeviceConnected = true;
|
||||
PerDeviceDeviceData = deviceData;
|
||||
break;
|
||||
}
|
||||
|
||||
Dictionary<RGBDeviceType, List<(string model, RGBDeviceType deviceType, int id, int zones)>> connectedZoneDevices = new();
|
||||
foreach ((string model, RGBDeviceType deviceType, int id, int zones) deviceData in ZONE_DEVICES)
|
||||
{
|
||||
if (ids.Contains(deviceData.id))
|
||||
{
|
||||
IsZoneDeviceConnected = true;
|
||||
if (!connectedZoneDevices.TryGetValue(deviceData.deviceType, out List<(string model, RGBDeviceType deviceType, int id, int zones)>? deviceList))
|
||||
connectedZoneDevices.Add(deviceData.deviceType, deviceList = new List<(string model, RGBDeviceType deviceType, int id, int zones)>());
|
||||
deviceList.Add(deviceData);
|
||||
}
|
||||
}
|
||||
List<(string model, RGBDeviceType deviceType, int id, int zones)> zoneDeviceData = new();
|
||||
foreach (KeyValuePair<RGBDeviceType, List<(string model, RGBDeviceType deviceType, int id, int zones)>> connectedZoneDevice in connectedZoneDevices)
|
||||
{
|
||||
int maxZones = connectedZoneDevice.Value.Max(x => x.zones);
|
||||
zoneDeviceData.Add(connectedZoneDevice.Value.First(x => x.zones == maxZones));
|
||||
}
|
||||
|
||||
ZoneDeviceData = zoneDeviceData;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -3,9 +3,11 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using HidSharp;
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Devices.Logitech.HID;
|
||||
using RGB.NET.Devices.Logitech.Native;
|
||||
using RGB.NET.HID;
|
||||
|
||||
namespace RGB.NET.Devices.Logitech
|
||||
{
|
||||
@ -38,6 +40,64 @@ namespace RGB.NET.Devices.Logitech
|
||||
private LogitechPerDeviceUpdateQueue? _perDeviceUpdateQueue;
|
||||
private LogitechPerKeyUpdateQueue? _perKeyUpdateQueue;
|
||||
|
||||
private const int VENDOR_ID = 0x046D;
|
||||
|
||||
public static HIDLoader<int, int> PerKeyDeviceDefinitions { get; } = new(VENDOR_ID)
|
||||
{
|
||||
{ 0xC32B, RGBDeviceType.Keyboard, "G910", LedMappings.PerKey, 0 },
|
||||
{ 0xC335, RGBDeviceType.Keyboard, "G910v2", LedMappings.PerKey, 0 },
|
||||
{ 0xC541, RGBDeviceType.Keyboard, "G915", LedMappings.PerKey, 0 },
|
||||
{ 0xC33F, RGBDeviceType.Keyboard, "G815", LedMappings.PerKey, 0 },
|
||||
{ 0xC337, RGBDeviceType.Keyboard, "G810", LedMappings.PerKey, 0 },
|
||||
{ 0xC331, RGBDeviceType.Keyboard, "G810", LedMappings.PerKey, 0 },
|
||||
{ 0xC333, RGBDeviceType.Keyboard, "G610", LedMappings.PerKey, 0 },
|
||||
{ 0xC33C, RGBDeviceType.Keyboard, "G512", LedMappings.PerKey, 0 },
|
||||
{ 0xC342, RGBDeviceType.Keyboard, "G512 SE", LedMappings.PerKey, 0 },
|
||||
{ 0xC330, RGBDeviceType.Keyboard, "G410", LedMappings.PerKey, 0 },
|
||||
{ 0xC336, RGBDeviceType.Keyboard, "G213", LedMappings.PerKey, 0 },
|
||||
{ 0xC339, RGBDeviceType.Keyboard, "Pro", LedMappings.PerKey, 0 },
|
||||
{ 0xC343, RGBDeviceType.Keyboard, "G915 TKL", LedMappings.PerKey, 0 },
|
||||
{ 0xC545, RGBDeviceType.Keyboard, "Lightspeed Keyboard Dongle", LedMappings.PerKey, 0 },
|
||||
};
|
||||
|
||||
public static HIDLoader<int, (LogitechDeviceType deviceType, int zones)> PerZoneDeviceDefinitions { get; } = new(VENDOR_ID)
|
||||
{
|
||||
{ 0xC336, RGBDeviceType.Keyboard, "G213", LedMappings.ZoneKeyboard, (LogitechDeviceType.Keyboard, 2) },
|
||||
{ 0xC086, RGBDeviceType.Mouse, "G903", LedMappings.ZoneMouse, (LogitechDeviceType.Mouse, 2) },
|
||||
{ 0xC539, RGBDeviceType.Mouse, "Lightspeed Mouse Dongle", LedMappings.ZoneMouse, (LogitechDeviceType.Mouse, 2) },
|
||||
{ 0xC087, RGBDeviceType.Mouse, "G703", LedMappings.ZoneMouse, (LogitechDeviceType.Mouse, 2) },
|
||||
{ 0xC08B, RGBDeviceType.Mouse, "G502 HERO", LedMappings.ZoneMouse, (LogitechDeviceType.Mouse, 2) },
|
||||
{ 0xC08D, RGBDeviceType.Mouse, "G502 Lightspeed", LedMappings.ZoneMouse, (LogitechDeviceType.Mouse, 2) },
|
||||
{ 0xC332, RGBDeviceType.Mouse, "G502", LedMappings.ZoneMouse, (LogitechDeviceType.Mouse, 2) },
|
||||
{ 0xC083, RGBDeviceType.Mouse, "G403", LedMappings.ZoneMouse, (LogitechDeviceType.Mouse, 2) },
|
||||
{ 0xC080, RGBDeviceType.Mouse, "G303", LedMappings.ZoneMouse, (LogitechDeviceType.Mouse, 2) },
|
||||
{ 0xC084, RGBDeviceType.Mouse, "G203", LedMappings.ZoneMouse, (LogitechDeviceType.Mouse, 1) },
|
||||
{ 0xC085, RGBDeviceType.Mouse, "G Pro", LedMappings.ZoneMouse, (LogitechDeviceType.Mouse, 1) },
|
||||
{ 0xC088, RGBDeviceType.Mouse, "G Pro Wireless", LedMappings.ZoneMouse, (LogitechDeviceType.Mouse, 2) },
|
||||
{ 0xC08C, RGBDeviceType.Mouse, "G Pro Hero", LedMappings.ZoneMouse, (LogitechDeviceType.Mouse, 1) },
|
||||
{ 0x0A5C, RGBDeviceType.Headset, "G633", LedMappings.ZoneHeadset, (LogitechDeviceType.Headset, 2) },
|
||||
{ 0x0A5B, RGBDeviceType.Headset, "G933", LedMappings.ZoneHeadset, (LogitechDeviceType.Headset, 2) },
|
||||
{ 0x0A87, RGBDeviceType.Headset, "G935", LedMappings.ZoneHeadset, (LogitechDeviceType.Headset, 2) },
|
||||
{ 0x0A78, RGBDeviceType.Speaker, "G560", LedMappings.ZoneHeadset, (LogitechDeviceType.Speaker, 4) },
|
||||
{ 0xAB5, RGBDeviceType.Speaker, "G733", LedMappings.ZoneSpeaker, (LogitechDeviceType.Speaker, 2) },
|
||||
};
|
||||
|
||||
public static HIDLoader<int, int> PerDeviceDeviceDefinitions { get; } = new(VENDOR_ID)
|
||||
{
|
||||
{ 0xC228, RGBDeviceType.Keyboard, "G19", LedMappings.Device, 0 },
|
||||
{ 0xC229, RGBDeviceType.Keyboard, "G19s", LedMappings.Device, 0 },
|
||||
{ 0xC24A, RGBDeviceType.Mouse, "G600", LedMappings.Device, 0 },
|
||||
{ 0xC246, RGBDeviceType.Mouse, "G300s", LedMappings.Device, 0 },
|
||||
{ 0xC22D, RGBDeviceType.Keyboard, "G510", LedMappings.Device, 0 },
|
||||
{ 0xC22E, RGBDeviceType.Keyboard, "G510s", LedMappings.Device, 0 },
|
||||
{ 0xC21C, RGBDeviceType.Keypad, "G13", LedMappings.Device, 0 },
|
||||
{ 0xC22B, RGBDeviceType.Keyboard, "G110", LedMappings.Device, 0 },
|
||||
{ 0xC24D, RGBDeviceType.Keyboard, "G710+", LedMappings.Device, 0 },
|
||||
{ 0xC248, RGBDeviceType.Keyboard, "G105", LedMappings.Device, 0 },
|
||||
{ 0xC222, RGBDeviceType.Keyboard, "G15", LedMappings.Device, 0 },
|
||||
{ 0xC225, RGBDeviceType.Keyboard, "G11", LedMappings.Device, 0 },
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
@ -67,30 +127,37 @@ namespace RGB.NET.Devices.Logitech
|
||||
_LogitechGSDK.LogiLedSaveCurrentLighting();
|
||||
}
|
||||
|
||||
protected override IEnumerable<IRGBDevice> GetLoadedDevices(RGBDeviceType loadFilter)
|
||||
{
|
||||
PerKeyDeviceDefinitions.LoadFilter = loadFilter;
|
||||
PerZoneDeviceDefinitions.LoadFilter = loadFilter;
|
||||
PerDeviceDeviceDefinitions.LoadFilter = loadFilter;
|
||||
|
||||
return base.GetLoadedDevices(loadFilter);
|
||||
}
|
||||
|
||||
//TODO DarthAffe 04.03.2021: Rework device selection and configuration for HID-based providers
|
||||
protected override IEnumerable<IRGBDevice> LoadDevices()
|
||||
{
|
||||
DeviceChecker.LoadDeviceList();
|
||||
|
||||
if (DeviceChecker.IsPerKeyDeviceConnected && (_perKeyUpdateQueue != null))
|
||||
IEnumerable<(HIDDeviceDefinition<int, int> definition, HidDevice device)> perKeyDevices = PerKeyDeviceDefinitions.GetConnectedDevices();
|
||||
if ((_perKeyUpdateQueue != null) && perKeyDevices.Any())
|
||||
{
|
||||
(string model, RGBDeviceType deviceType, int _, int _) = DeviceChecker.PerKeyDeviceData;
|
||||
yield return new LogitechPerKeyRGBDevice(new LogitechRGBDeviceInfo(deviceType, model, LogitechDeviceCaps.PerKeyRGB, 0), _perKeyUpdateQueue);
|
||||
(HIDDeviceDefinition<int, int> definition, _) = perKeyDevices.First();
|
||||
yield return new LogitechPerKeyRGBDevice(new LogitechRGBDeviceInfo(definition.DeviceType, definition.Name, LogitechDeviceCaps.PerKeyRGB, 0), _perKeyUpdateQueue, definition.LedMapping);
|
||||
}
|
||||
|
||||
if (DeviceChecker.IsPerDeviceDeviceConnected && (_perDeviceUpdateQueue != null))
|
||||
IEnumerable<(HIDDeviceDefinition<int, (LogitechDeviceType deviceType, int zones)> definition, HidDevice device)> perZoneDevices = PerZoneDeviceDefinitions.GetConnectedDevices(x => x.CustomData.deviceType);
|
||||
foreach ((HIDDeviceDefinition<int, (LogitechDeviceType deviceType, int zones)> definition, _) in perZoneDevices)
|
||||
{
|
||||
(string model, RGBDeviceType deviceType, int _, int _) = DeviceChecker.PerDeviceDeviceData;
|
||||
yield return new LogitechPerDeviceRGBDevice(new LogitechRGBDeviceInfo(deviceType, model, LogitechDeviceCaps.DeviceRGB, 0), _perDeviceUpdateQueue);
|
||||
LogitechZoneUpdateQueue updateQueue = new(GetUpdateTrigger(), definition.CustomData.deviceType);
|
||||
yield return new LogitechPerKeyRGBDevice(new LogitechRGBDeviceInfo(definition.DeviceType, definition.Name, LogitechDeviceCaps.DeviceRGB, definition.CustomData.zones), updateQueue, definition.LedMapping);
|
||||
}
|
||||
|
||||
if (DeviceChecker.IsZoneDeviceConnected)
|
||||
IEnumerable<(HIDDeviceDefinition<int, int> definition, HidDevice device)> perDeviceDevices = PerDeviceDeviceDefinitions.GetConnectedDevices();
|
||||
if ((_perDeviceUpdateQueue != null) && perDeviceDevices.Any())
|
||||
{
|
||||
foreach ((string model, RGBDeviceType deviceType, int _, int zones) in DeviceChecker.ZoneDeviceData)
|
||||
{
|
||||
LogitechZoneUpdateQueue updateQueue = new(GetUpdateTrigger(), deviceType);
|
||||
yield return new LogitechZoneRGBDevice(new LogitechRGBDeviceInfo(deviceType, model, LogitechDeviceCaps.DeviceRGB, zones), updateQueue);
|
||||
}
|
||||
(HIDDeviceDefinition<int, int> definition, _) = perDeviceDevices.First();
|
||||
yield return new LogitechPerKeyRGBDevice(new LogitechRGBDeviceInfo(definition.DeviceType, definition.Name, LogitechDeviceCaps.DeviceRGB, 0), _perDeviceUpdateQueue, definition.LedMapping);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -10,16 +10,23 @@ namespace RGB.NET.Devices.Logitech
|
||||
/// </summary>
|
||||
public class LogitechPerDeviceRGBDevice : LogitechRGBDevice<LogitechRGBDeviceInfo>, IUnknownDevice //TODO DarthAffe 18.04.2020: It's know which kind of device this is, but they would need to be separated
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private readonly LedMapping<int> _ledMapping;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Logitech.LogitechPerDeviceRGBDevice" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by logitech for the per-device-lightable device</param>
|
||||
internal LogitechPerDeviceRGBDevice(LogitechRGBDeviceInfo info, IUpdateQueue updateQueue)
|
||||
internal LogitechPerDeviceRGBDevice(LogitechRGBDeviceInfo info, IUpdateQueue updateQueue, LedMapping<int> ledMapping)
|
||||
: base(info, updateQueue)
|
||||
{
|
||||
this._ledMapping = ledMapping;
|
||||
|
||||
InitializeLayout();
|
||||
}
|
||||
|
||||
@ -31,8 +38,9 @@ namespace RGB.NET.Devices.Logitech
|
||||
{
|
||||
AddLed(LedId.Custom1, new Point(0, 0), new Size(10, 10));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override object GetLedCustomData(LedId ledId) => (ledId, LogitechLedId.DEVICE);
|
||||
protected override object GetLedCustomData(LedId ledId) => _ledMapping[ledId];
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate) => UpdateQueue.SetData(GetUpdateData(ledsToUpdate.Take(1)));
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.CompilerServices;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Devices.Logitech
|
||||
@ -11,145 +10,7 @@ namespace RGB.NET.Devices.Logitech
|
||||
private const int BITMAP_SIZE = 21 * 6 * 4;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties & Fields
|
||||
|
||||
internal static Dictionary<LedId, int> BitmapOffset { get; } = new()
|
||||
{
|
||||
{ LedId.Keyboard_Escape, 0 },
|
||||
{ LedId.Keyboard_F1, 4 },
|
||||
{ LedId.Keyboard_F2, 8 },
|
||||
{ LedId.Keyboard_F3, 12 },
|
||||
{ LedId.Keyboard_F4, 16 },
|
||||
{ LedId.Keyboard_F5, 20 },
|
||||
{ LedId.Keyboard_F6, 24 },
|
||||
{ LedId.Keyboard_F7, 28 },
|
||||
{ LedId.Keyboard_F8, 32 },
|
||||
{ LedId.Keyboard_F9, 36 },
|
||||
{ LedId.Keyboard_F10, 40 },
|
||||
{ LedId.Keyboard_F11, 44 },
|
||||
{ LedId.Keyboard_F12, 48 },
|
||||
{ LedId.Keyboard_PrintScreen, 52 },
|
||||
{ LedId.Keyboard_ScrollLock, 56 },
|
||||
{ LedId.Keyboard_PauseBreak, 60 },
|
||||
// { LedId.Keyboard_?, 64 },
|
||||
// { LedId.Keyboard_?, 68 },
|
||||
// { LedId.Keyboard_?, 72 },
|
||||
// { LedId.Keyboard_?, 76 },
|
||||
// { LedId.Keyboard_?, 80 },
|
||||
|
||||
{ LedId.Keyboard_GraveAccentAndTilde, 84 },
|
||||
{ LedId.Keyboard_1, 88 },
|
||||
{ LedId.Keyboard_2, 92 },
|
||||
{ LedId.Keyboard_3, 96 },
|
||||
{ LedId.Keyboard_4, 100 },
|
||||
{ LedId.Keyboard_5, 104 },
|
||||
{ LedId.Keyboard_6, 108 },
|
||||
{ LedId.Keyboard_7, 112 },
|
||||
{ LedId.Keyboard_8, 116 },
|
||||
{ LedId.Keyboard_9, 120 },
|
||||
{ LedId.Keyboard_0, 124 },
|
||||
{ LedId.Keyboard_MinusAndUnderscore, 128 },
|
||||
{ LedId.Keyboard_EqualsAndPlus, 132 },
|
||||
{ LedId.Keyboard_Backspace, 136 },
|
||||
{ LedId.Keyboard_Insert, 140 },
|
||||
{ LedId.Keyboard_Home, 144 },
|
||||
{ LedId.Keyboard_PageUp, 148 },
|
||||
{ LedId.Keyboard_NumLock, 152 },
|
||||
{ LedId.Keyboard_NumSlash, 156 },
|
||||
{ LedId.Keyboard_NumAsterisk, 160 },
|
||||
{ LedId.Keyboard_NumMinus, 164 },
|
||||
|
||||
{ LedId.Keyboard_Tab, 168 },
|
||||
{ LedId.Keyboard_Q, 172 },
|
||||
{ LedId.Keyboard_W, 176 },
|
||||
{ LedId.Keyboard_E, 180 },
|
||||
{ LedId.Keyboard_R, 184 },
|
||||
{ LedId.Keyboard_T, 188 },
|
||||
{ LedId.Keyboard_Y, 192 },
|
||||
{ LedId.Keyboard_U, 196 },
|
||||
{ LedId.Keyboard_I, 200 },
|
||||
{ LedId.Keyboard_O, 204 },
|
||||
{ LedId.Keyboard_P, 208 },
|
||||
{ LedId.Keyboard_BracketLeft, 212 },
|
||||
{ LedId.Keyboard_BracketRight, 216 },
|
||||
{ LedId.Keyboard_Backslash, 220 },
|
||||
{ LedId.Keyboard_Delete, 224 },
|
||||
{ LedId.Keyboard_End, 228 },
|
||||
{ LedId.Keyboard_PageDown, 232 },
|
||||
{ LedId.Keyboard_Num7, 236 },
|
||||
{ LedId.Keyboard_Num8, 240 },
|
||||
{ LedId.Keyboard_Num9, 244 },
|
||||
{ LedId.Keyboard_NumPlus, 248 },
|
||||
|
||||
{ LedId.Keyboard_CapsLock, 252 },
|
||||
{ LedId.Keyboard_A, 256 },
|
||||
{ LedId.Keyboard_S, 260 },
|
||||
{ LedId.Keyboard_D, 264 },
|
||||
{ LedId.Keyboard_F, 268 },
|
||||
{ LedId.Keyboard_G, 272 },
|
||||
{ LedId.Keyboard_H, 276 },
|
||||
{ LedId.Keyboard_J, 280 },
|
||||
{ LedId.Keyboard_K, 284 },
|
||||
{ LedId.Keyboard_L, 288 },
|
||||
{ LedId.Keyboard_SemicolonAndColon, 292 },
|
||||
{ LedId.Keyboard_ApostropheAndDoubleQuote, 296 },
|
||||
{ LedId.Keyboard_NonUsTilde, 300 }, //TODO DarthAffe 26.03.2017: Find the real ID/Name of this key - it's not documented ...
|
||||
{ LedId.Keyboard_Enter, 304 },
|
||||
// { LedId.Keyboard_?, 308 },
|
||||
// { LedId.Keyboard_?, 312 },
|
||||
// { LedId.Keyboard_?, 316 },
|
||||
{ LedId.Keyboard_Num4, 320 },
|
||||
{ LedId.Keyboard_Num5, 324 },
|
||||
{ LedId.Keyboard_Num6, 328 },
|
||||
// { LedId.Keyboard_?, 332 },
|
||||
|
||||
{ LedId.Keyboard_LeftShift, 336 },
|
||||
{ LedId.Keyboard_NonUsBackslash, 340 },
|
||||
{ LedId.Keyboard_Z, 344 },
|
||||
{ LedId.Keyboard_X, 348 },
|
||||
{ LedId.Keyboard_C, 352 },
|
||||
{ LedId.Keyboard_V, 356 },
|
||||
{ LedId.Keyboard_B, 360 },
|
||||
{ LedId.Keyboard_N, 364 },
|
||||
{ LedId.Keyboard_M, 368 },
|
||||
{ LedId.Keyboard_CommaAndLessThan, 372 },
|
||||
{ LedId.Keyboard_PeriodAndBiggerThan, 376 },
|
||||
{ LedId.Keyboard_SlashAndQuestionMark, 380 },
|
||||
{ LedId.Keyboard_RightShift, 388 },
|
||||
// { LedId.Keyboard_?, 392 },
|
||||
{ LedId.Keyboard_ArrowUp, 396 },
|
||||
// { LedId.Keyboard_?, 400 },
|
||||
{ LedId.Keyboard_Num1, 404 },
|
||||
{ LedId.Keyboard_Num2, 408 },
|
||||
{ LedId.Keyboard_Num3, 412 },
|
||||
{ LedId.Keyboard_NumEnter, 416 },
|
||||
|
||||
{ LedId.Keyboard_LeftCtrl, 420 },
|
||||
{ LedId.Keyboard_LeftGui, 424 },
|
||||
{ LedId.Keyboard_LeftAlt, 428 },
|
||||
// { LedId.Keyboard_?, 432 },
|
||||
// { LedId.Keyboard_?, 436 },
|
||||
{ LedId.Keyboard_Space, 440 },
|
||||
// { LedId.Keyboard_?, 444 },
|
||||
// { LedId.Keyboard_?, 448 },
|
||||
// { LedId.Keyboard_?, 452 },
|
||||
// { LedId.Keyboard_?, 456 },
|
||||
// { LedId.Keyboard_?, 460 },
|
||||
{ LedId.Keyboard_RightAlt, 464 },
|
||||
{ LedId.Keyboard_RightGui, 468 },
|
||||
{ LedId.Keyboard_Application, 472 },
|
||||
{ LedId.Keyboard_RightCtrl, 476 },
|
||||
{ LedId.Keyboard_ArrowLeft, 480 },
|
||||
{ LedId.Keyboard_ArrowDown, 484 },
|
||||
{ LedId.Keyboard_ArrowRight, 488 },
|
||||
{ LedId.Keyboard_Num0, 492 },
|
||||
{ LedId.Keyboard_NumPeriodAndDelete, 496 },
|
||||
// { LedId.Keyboard_?, 500 },
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Methods
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
|
||||
@ -9,23 +9,30 @@ namespace RGB.NET.Devices.Logitech
|
||||
/// </summary>
|
||||
public class LogitechPerKeyRGBDevice : LogitechRGBDevice<LogitechRGBDeviceInfo>, IUnknownDevice //TODO DarthAffe 18.04.2020: It's know which kind of device this is, but they would need to be separated
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private readonly LedMapping<int> _ledMapping;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Logitech.LogitechPerKeyRGBDevice" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by logitech for the per-key-lightable device</param>
|
||||
internal LogitechPerKeyRGBDevice(LogitechRGBDeviceInfo info, IUpdateQueue updateQueue)
|
||||
internal LogitechPerKeyRGBDevice(LogitechRGBDeviceInfo info, IUpdateQueue updateQueue, LedMapping<int> ledMapping)
|
||||
: base(info, updateQueue)
|
||||
{ }
|
||||
{
|
||||
this._ledMapping = ledMapping;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override object GetLedCustomData(LedId ledId) => (ledId, PerKeyIdMapping.DEFAULT.TryGetValue(ledId, out LogitechLedId logitechLedId) ? logitechLedId : LogitechLedId.Invalid);
|
||||
protected override object GetLedCustomData(LedId ledId) => _ledMapping.TryGetValue(ledId, out int logitechLedId) ? logitechLedId : -1;
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate) => UpdateQueue.SetData(GetUpdateData(ledsToUpdate));
|
||||
|
||||
@ -37,26 +37,10 @@ namespace RGB.NET.Devices.Logitech
|
||||
_LogitechGSDK.LogiLedSetTargetDevice(LogitechDeviceCaps.PerKeyRGB);
|
||||
|
||||
Array.Clear(_bitmap, 0, _bitmap.Length);
|
||||
bool usesBitmap = false;
|
||||
foreach ((object key, Color color) in dataSet)
|
||||
{
|
||||
(LedId id, LogitechLedId customData) = ((LedId, LogitechLedId))key;
|
||||
BitmapMapping.SetColor(_bitmap, (int)key, color);
|
||||
|
||||
// DarthAffe 26.03.2017: This is only needed since update by name doesn't work as expected for all keys ...
|
||||
if (BitmapMapping.BitmapOffset.TryGetValue(id, out int bitmapOffset))
|
||||
{
|
||||
BitmapMapping.SetColor(_bitmap, bitmapOffset, color);
|
||||
usesBitmap = true;
|
||||
}
|
||||
else
|
||||
_LogitechGSDK.LogiLedSetLightingForKeyWithKeyName((int)customData,
|
||||
(int)MathF.Round(color.R * 100),
|
||||
(int)MathF.Round(color.G * 100),
|
||||
(int)MathF.Round(color.B * 100));
|
||||
}
|
||||
|
||||
if (usesBitmap)
|
||||
_LogitechGSDK.LogiLedSetLightingFromBitmap(_bitmap);
|
||||
_LogitechGSDK.LogiLedSetLightingFromBitmap(_bitmap);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@ -1,130 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Devices.Logitech
|
||||
{
|
||||
internal static class PerKeyIdMapping
|
||||
{
|
||||
internal static readonly Dictionary<LedId, LogitechLedId> DEFAULT = new()
|
||||
{
|
||||
{ LedId.Invalid, LogitechLedId.Invalid },
|
||||
{ LedId.Keyboard_Escape, LogitechLedId.ESC },
|
||||
{ LedId.Keyboard_F1, LogitechLedId.F1 },
|
||||
{ LedId.Keyboard_F2, LogitechLedId.F2 },
|
||||
{ LedId.Keyboard_F3, LogitechLedId.F3 },
|
||||
{ LedId.Keyboard_F4, LogitechLedId.F4 },
|
||||
{ LedId.Keyboard_F5, LogitechLedId.F5 },
|
||||
{ LedId.Keyboard_F6, LogitechLedId.F6 },
|
||||
{ LedId.Keyboard_F7, LogitechLedId.F7 },
|
||||
{ LedId.Keyboard_F8, LogitechLedId.F8 },
|
||||
{ LedId.Keyboard_F9, LogitechLedId.F9 },
|
||||
{ LedId.Keyboard_F10, LogitechLedId.F10 },
|
||||
{ LedId.Keyboard_F11, LogitechLedId.F11 },
|
||||
{ LedId.Keyboard_GraveAccentAndTilde, LogitechLedId.TILDE },
|
||||
{ LedId.Keyboard_1, LogitechLedId.ONE },
|
||||
{ LedId.Keyboard_2, LogitechLedId.TWO },
|
||||
{ LedId.Keyboard_3, LogitechLedId.THREE },
|
||||
{ LedId.Keyboard_4, LogitechLedId.FOUR },
|
||||
{ LedId.Keyboard_5, LogitechLedId.FIVE },
|
||||
{ LedId.Keyboard_6, LogitechLedId.SIX },
|
||||
{ LedId.Keyboard_7, LogitechLedId.SEVEN },
|
||||
{ LedId.Keyboard_8, LogitechLedId.EIGHT },
|
||||
{ LedId.Keyboard_9, LogitechLedId.NINE },
|
||||
{ LedId.Keyboard_0, LogitechLedId.ZERO },
|
||||
{ LedId.Keyboard_MinusAndUnderscore, LogitechLedId.MINUS },
|
||||
{ LedId.Keyboard_Tab, LogitechLedId.TAB },
|
||||
{ LedId.Keyboard_Q, LogitechLedId.Q },
|
||||
{ LedId.Keyboard_W, LogitechLedId.W },
|
||||
{ LedId.Keyboard_E, LogitechLedId.E },
|
||||
{ LedId.Keyboard_R, LogitechLedId.R },
|
||||
{ LedId.Keyboard_T, LogitechLedId.T },
|
||||
{ LedId.Keyboard_Y, LogitechLedId.Y },
|
||||
{ LedId.Keyboard_U, LogitechLedId.U },
|
||||
{ LedId.Keyboard_I, LogitechLedId.I },
|
||||
{ LedId.Keyboard_O, LogitechLedId.O },
|
||||
{ LedId.Keyboard_P, LogitechLedId.P },
|
||||
{ LedId.Keyboard_BracketLeft, LogitechLedId.OPEN_BRACKET },
|
||||
{ LedId.Keyboard_CapsLock, LogitechLedId.CAPS_LOCK },
|
||||
{ LedId.Keyboard_A, LogitechLedId.A },
|
||||
{ LedId.Keyboard_S, LogitechLedId.S },
|
||||
{ LedId.Keyboard_D, LogitechLedId.D },
|
||||
{ LedId.Keyboard_F, LogitechLedId.F },
|
||||
{ LedId.Keyboard_G, LogitechLedId.G },
|
||||
{ LedId.Keyboard_H, LogitechLedId.H },
|
||||
{ LedId.Keyboard_J, LogitechLedId.J },
|
||||
{ LedId.Keyboard_K, LogitechLedId.K },
|
||||
{ LedId.Keyboard_L, LogitechLedId.L },
|
||||
{ LedId.Keyboard_SemicolonAndColon, LogitechLedId.SEMICOLON },
|
||||
{ LedId.Keyboard_ApostropheAndDoubleQuote, LogitechLedId.APOSTROPHE },
|
||||
{ LedId.Keyboard_LeftShift, LogitechLedId.LEFT_SHIFT },
|
||||
{ LedId.Keyboard_Z, LogitechLedId.Z },
|
||||
{ LedId.Keyboard_X, LogitechLedId.X },
|
||||
{ LedId.Keyboard_C, LogitechLedId.C },
|
||||
{ LedId.Keyboard_V, LogitechLedId.V },
|
||||
{ LedId.Keyboard_B, LogitechLedId.B },
|
||||
{ LedId.Keyboard_N, LogitechLedId.N },
|
||||
{ LedId.Keyboard_M, LogitechLedId.M },
|
||||
{ LedId.Keyboard_CommaAndLessThan, LogitechLedId.COMMA },
|
||||
{ LedId.Keyboard_PeriodAndBiggerThan, LogitechLedId.PERIOD },
|
||||
{ LedId.Keyboard_SlashAndQuestionMark, LogitechLedId.FORWARD_SLASH },
|
||||
{ LedId.Keyboard_LeftCtrl, LogitechLedId.LEFT_CONTROL },
|
||||
{ LedId.Keyboard_LeftGui, LogitechLedId.LEFT_WINDOWS },
|
||||
{ LedId.Keyboard_LeftAlt, LogitechLedId.LEFT_ALT },
|
||||
{ LedId.Keyboard_Space, LogitechLedId.SPACE },
|
||||
{ LedId.Keyboard_RightAlt, LogitechLedId.RIGHT_ALT },
|
||||
{ LedId.Keyboard_RightGui, LogitechLedId.RIGHT_WINDOWS },
|
||||
{ LedId.Keyboard_Application, LogitechLedId.APPLICATION_SELECT },
|
||||
{ LedId.Keyboard_F12, LogitechLedId.F12 },
|
||||
{ LedId.Keyboard_PrintScreen, LogitechLedId.PRINT_SCREEN },
|
||||
{ LedId.Keyboard_ScrollLock, LogitechLedId.SCROLL_LOCK },
|
||||
{ LedId.Keyboard_PauseBreak, LogitechLedId.PAUSE_BREAK },
|
||||
{ LedId.Keyboard_Insert, LogitechLedId.INSERT },
|
||||
{ LedId.Keyboard_Home, LogitechLedId.HOME },
|
||||
{ LedId.Keyboard_PageUp, LogitechLedId.PAGE_UP },
|
||||
{ LedId.Keyboard_BracketRight, LogitechLedId.CLOSE_BRACKET },
|
||||
{ LedId.Keyboard_NonUsBackslash, LogitechLedId.BACKSLASH },
|
||||
{ LedId.Keyboard_Backslash, LogitechLedId.BACKSLASH },
|
||||
{ LedId.Keyboard_NonUsTilde, LogitechLedId.NonUsTilde },
|
||||
{ LedId.Keyboard_Enter, LogitechLedId.ENTER },
|
||||
{ LedId.Keyboard_EqualsAndPlus, LogitechLedId.EQUALS },
|
||||
{ LedId.Keyboard_Backspace, LogitechLedId.BACKSPACE },
|
||||
{ LedId.Keyboard_Delete, LogitechLedId.KEYBOARD_DELETE },
|
||||
{ LedId.Keyboard_End, LogitechLedId.END },
|
||||
{ LedId.Keyboard_PageDown, LogitechLedId.PAGE_DOWN },
|
||||
{ LedId.Keyboard_RightShift, LogitechLedId.RIGHT_SHIFT },
|
||||
{ LedId.Keyboard_RightCtrl, LogitechLedId.RIGHT_CONTROL },
|
||||
{ LedId.Keyboard_ArrowUp, LogitechLedId.ARROW_UP },
|
||||
{ LedId.Keyboard_ArrowLeft, LogitechLedId.ARROW_LEFT },
|
||||
{ LedId.Keyboard_ArrowDown, LogitechLedId.ARROW_DOWN },
|
||||
{ LedId.Keyboard_ArrowRight, LogitechLedId.ARROW_RIGHT },
|
||||
{ LedId.Keyboard_NumLock, LogitechLedId.NUM_LOCK },
|
||||
{ LedId.Keyboard_NumSlash, LogitechLedId.NUM_SLASH },
|
||||
{ LedId.Keyboard_NumAsterisk, LogitechLedId.NUM_ASTERISK },
|
||||
{ LedId.Keyboard_NumMinus, LogitechLedId.NUM_MINUS },
|
||||
{ LedId.Keyboard_NumPlus, LogitechLedId.NUM_PLUS },
|
||||
{ LedId.Keyboard_NumEnter, LogitechLedId.NUM_ENTER },
|
||||
{ LedId.Keyboard_Num7, LogitechLedId.NUM_SEVEN },
|
||||
{ LedId.Keyboard_Num8, LogitechLedId.NUM_EIGHT },
|
||||
{ LedId.Keyboard_Num9, LogitechLedId.NUM_NINE },
|
||||
{ LedId.Keyboard_Num4, LogitechLedId.NUM_FOUR },
|
||||
{ LedId.Keyboard_Num5, LogitechLedId.NUM_FIVE },
|
||||
{ LedId.Keyboard_Num6, LogitechLedId.NUM_SIX },
|
||||
{ LedId.Keyboard_Num1, LogitechLedId.NUM_ONE },
|
||||
{ LedId.Keyboard_Num2, LogitechLedId.NUM_TWO },
|
||||
{ LedId.Keyboard_Num3, LogitechLedId.NUM_THREE },
|
||||
{ LedId.Keyboard_Num0, LogitechLedId.NUM_ZERO },
|
||||
{ LedId.Keyboard_NumPeriodAndDelete, LogitechLedId.NUM_PERIOD },
|
||||
{ LedId.Keyboard_Programmable1, LogitechLedId.G_1 },
|
||||
{ LedId.Keyboard_Programmable2, LogitechLedId.G_2 },
|
||||
{ LedId.Keyboard_Programmable3, LogitechLedId.G_3 },
|
||||
{ LedId.Keyboard_Programmable4, LogitechLedId.G_4 },
|
||||
{ LedId.Keyboard_Programmable5, LogitechLedId.G_5 },
|
||||
{ LedId.Keyboard_Programmable6, LogitechLedId.G_6 },
|
||||
{ LedId.Keyboard_Programmable7, LogitechLedId.G_7 },
|
||||
{ LedId.Keyboard_Programmable8, LogitechLedId.G_8 },
|
||||
{ LedId.Keyboard_Programmable9, LogitechLedId.G_9 },
|
||||
{ LedId.Logo, LogitechLedId.G_LOGO },
|
||||
{ LedId.Keyboard_Custom1, LogitechLedId.G_BADGE },
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -52,6 +52,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\RGB.NET.Core\RGB.NET.Core.csproj" />
|
||||
<PackageReference Include="HidSharp" Version="2.1.0" />
|
||||
<ProjectReference Include="..\RGB.NET.HID\RGB.NET.HID.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@ -9,22 +9,9 @@ namespace RGB.NET.Devices.Logitech
|
||||
/// </summary>
|
||||
public class LogitechZoneRGBDevice : LogitechRGBDevice<LogitechRGBDeviceInfo>, IUnknownDevice //TODO DarthAffe 18.04.2020: It's know which kind of device this is, but they would need to be separated
|
||||
{
|
||||
#region Constants
|
||||
|
||||
private static readonly Dictionary<RGBDeviceType, LedId> BASE_LED_MAPPING = new()
|
||||
{
|
||||
{ RGBDeviceType.Keyboard, LedId.Keyboard_Programmable1 },
|
||||
{ RGBDeviceType.Mouse, LedId.Mouse1 },
|
||||
{ RGBDeviceType.Headset, LedId.Headset1 },
|
||||
{ RGBDeviceType.Mousepad, LedId.Mousepad1 },
|
||||
{ RGBDeviceType.Speaker, LedId.Speaker1 }
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties & Fields
|
||||
|
||||
private LedId _baseLedId;
|
||||
private readonly LedMapping<int> _ledMapping;
|
||||
|
||||
#endregion
|
||||
|
||||
@ -34,11 +21,10 @@ namespace RGB.NET.Devices.Logitech
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Logitech.LogitechZoneRGBDevice" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by logitech for the zone-lightable device</param>
|
||||
internal LogitechZoneRGBDevice(LogitechRGBDeviceInfo info, IUpdateQueue updateQueue)
|
||||
internal LogitechZoneRGBDevice(LogitechRGBDeviceInfo info, IUpdateQueue updateQueue, LedMapping<int> ledMapping)
|
||||
: base(info, updateQueue)
|
||||
{
|
||||
_baseLedId = BASE_LED_MAPPING.TryGetValue(info.DeviceType, out LedId id) ? id : LedId.Custom1;
|
||||
this._ledMapping = ledMapping;
|
||||
|
||||
InitializeLayout();
|
||||
}
|
||||
@ -50,11 +36,11 @@ namespace RGB.NET.Devices.Logitech
|
||||
private void InitializeLayout()
|
||||
{
|
||||
for (int i = 0; i < DeviceInfo.Zones; i++)
|
||||
AddLed(_baseLedId + i, new Point(i * 10, 0), new Size(10, 10));
|
||||
AddLed(_ledMapping[i], new Point(i * 10, 0), new Size(10, 10));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override object? GetLedCustomData(LedId ledId) => (int)(ledId - _baseLedId);
|
||||
protected override object? GetLedCustomData(LedId ledId) => _ledMapping[ledId];
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate) => UpdateQueue.SetData(GetUpdateData(ledsToUpdate));
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Devices.Logitech.Native;
|
||||
|
||||
@ -10,19 +9,6 @@ namespace RGB.NET.Devices.Logitech
|
||||
/// </summary>
|
||||
public class LogitechZoneUpdateQueue : UpdateQueue
|
||||
{
|
||||
#region Constants
|
||||
|
||||
private static readonly Dictionary<RGBDeviceType, LogitechDeviceType> DEVICE_TYPE_MAPPING = new()
|
||||
{
|
||||
{ RGBDeviceType.Keyboard, LogitechDeviceType.Keyboard },
|
||||
{ RGBDeviceType.Mouse, LogitechDeviceType.Mouse },
|
||||
{ RGBDeviceType.Headset, LogitechDeviceType.Headset },
|
||||
{ RGBDeviceType.Mousepad, LogitechDeviceType.Mousemat },
|
||||
{ RGBDeviceType.Speaker, LogitechDeviceType.Speaker }
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties & Fields
|
||||
|
||||
private readonly LogitechDeviceType _deviceType;
|
||||
@ -36,11 +22,10 @@ namespace RGB.NET.Devices.Logitech
|
||||
/// </summary>
|
||||
/// <param name="updateTrigger">The update trigger used by this queue.</param>
|
||||
/// <param name="deviceType">The tpye of the device this queue is updating.</param>
|
||||
public LogitechZoneUpdateQueue(IDeviceUpdateTrigger updateTrigger, RGBDeviceType deviceType)
|
||||
public LogitechZoneUpdateQueue(IDeviceUpdateTrigger updateTrigger, LogitechDeviceType deviceType)
|
||||
: base(updateTrigger)
|
||||
{
|
||||
if (!DEVICE_TYPE_MAPPING.TryGetValue(deviceType, out _deviceType))
|
||||
throw new ArgumentException($"Invalid type '{deviceType.ToString()}'", nameof(deviceType));
|
||||
this._deviceType = deviceType;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
10
RGB.NET.Devices.Razer/Generic/LedMappings.cs
Normal file
10
RGB.NET.Devices.Razer/Generic/LedMappings.cs
Normal file
@ -0,0 +1,10 @@
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Devices.Razer
|
||||
{
|
||||
public static class LedMappings
|
||||
{
|
||||
public static LedMapping<int> TODO { get; } = new()
|
||||
{ };
|
||||
}
|
||||
}
|
||||
@ -1,188 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using HidSharp;
|
||||
using RGB.NET.Core;
|
||||
using DeviceDataList =
|
||||
System.Collections.Generic.List<(string model, RGB.NET.Core.RGBDeviceType deviceType, RGB.NET.Devices.Razer.RazerEndpointType
|
||||
razerDeviceType, int id)>;
|
||||
|
||||
namespace RGB.NET.Devices.Razer.HID
|
||||
{
|
||||
internal static class DeviceChecker
|
||||
{
|
||||
#region Constants
|
||||
|
||||
private const int VENDOR_ID = 0x1532;
|
||||
|
||||
private static readonly DeviceDataList DEVICES
|
||||
= new()
|
||||
{
|
||||
// Keyboards
|
||||
("BlackWidow Ultimate 2012", RGBDeviceType.Keyboard, RazerEndpointType.Keyboard, 0x010D),
|
||||
("BlackWidow Classic (Alternate)", RGBDeviceType.Keyboard, RazerEndpointType.Keyboard, 0x010E),
|
||||
("Anansi", RGBDeviceType.Keyboard, RazerEndpointType.Keyboard, 0x010F),
|
||||
("BlackWidow Ultimate 2013", RGBDeviceType.Keyboard, RazerEndpointType.Keyboard, 0x011A),
|
||||
("BlackWidow Stealth", RGBDeviceType.Keyboard, RazerEndpointType.Keyboard, 0x011B),
|
||||
("DeathStalker Expert", RGBDeviceType.Keyboard, RazerEndpointType.Keyboard, 0x0202),
|
||||
("BlackWidow Chroma", RGBDeviceType.Keyboard, RazerEndpointType.Keyboard, 0x0203),
|
||||
("DeathStalker Chroma", RGBDeviceType.Keyboard, RazerEndpointType.Keyboard, 0x0204),
|
||||
("Blade Stealth", RGBDeviceType.Keyboard, RazerEndpointType.LaptopKeyboard, 0x0205),
|
||||
("BlackWidow Tournament Edition Chroma", RGBDeviceType.Keyboard, RazerEndpointType.Keyboard, 0x0209),
|
||||
("Blade QHD", RGBDeviceType.Keyboard, RazerEndpointType.LaptopKeyboard, 0x020F),
|
||||
("Blade Pro (Late 2016)", RGBDeviceType.Keyboard, RazerEndpointType.LaptopKeyboard, 0x0210),
|
||||
("BlackWidow Chroma (Overwatch)", RGBDeviceType.Keyboard, RazerEndpointType.Keyboard, 0x0211),
|
||||
("BlackWidow Ultimate 2016", RGBDeviceType.Keyboard, RazerEndpointType.Keyboard, 0x0214),
|
||||
("BlackWidow X Chroma", RGBDeviceType.Keyboard, RazerEndpointType.Keyboard, 0x0216),
|
||||
("BlackWidow X Ultimate", RGBDeviceType.Keyboard, RazerEndpointType.Keyboard, 0x0217),
|
||||
("BlackWidow X Tournament Edition Chroma", RGBDeviceType.Keyboard, RazerEndpointType.Keyboard, 0x021A),
|
||||
("Ornata Chroma", RGBDeviceType.Keyboard, RazerEndpointType.Keyboard, 0x021E),
|
||||
("Ornata", RGBDeviceType.Keyboard, RazerEndpointType.Keyboard, 0x021F),
|
||||
("Blade Stealth (Late 2016)", RGBDeviceType.Keyboard, RazerEndpointType.LaptopKeyboard, 0x0220),
|
||||
("BlackWidow Chroma V2", RGBDeviceType.Keyboard, RazerEndpointType.Keyboard, 0x0221),
|
||||
("Blade (Late 2016)", RGBDeviceType.Keyboard, RazerEndpointType.LaptopKeyboard, 0x0224),
|
||||
("Blade Pro (2017)", RGBDeviceType.Keyboard, RazerEndpointType.LaptopKeyboard, 0x0225),
|
||||
("Huntsman Elite", RGBDeviceType.Keyboard, RazerEndpointType.Keyboard, 0x0226),
|
||||
("Huntsman", RGBDeviceType.Keyboard, RazerEndpointType.Keyboard, 0x0227),
|
||||
("BlackWidow Elite", RGBDeviceType.Keyboard, RazerEndpointType.Keyboard, 0x0228),
|
||||
("Cynosa Chroma", RGBDeviceType.Keyboard, RazerEndpointType.Keyboard, 0x022A),
|
||||
("Blade Stealth (Mid 2017)", RGBDeviceType.Keyboard, RazerEndpointType.LaptopKeyboard, 0x022D),
|
||||
("Blade Pro FullHD (2017)", RGBDeviceType.Keyboard, RazerEndpointType.LaptopKeyboard, 0x022F),
|
||||
("Blade Stealth (Late 2017)", RGBDeviceType.Keyboard, RazerEndpointType.LaptopKeyboard, 0x0232),
|
||||
("Blade 15 (2018)", RGBDeviceType.Keyboard, RazerEndpointType.LaptopKeyboard, 0x0233),
|
||||
("Blade Pro 17 (2019)", RGBDeviceType.Keyboard, RazerEndpointType.LaptopKeyboard, 0x0234),
|
||||
("BlackWidow Lite (2018)", RGBDeviceType.Keyboard, RazerEndpointType.Keyboard, 0x0235),
|
||||
("BlackWidow Essential", RGBDeviceType.Keyboard, RazerEndpointType.Keyboard, 0x0237),
|
||||
("Blade Stealth (2019)", RGBDeviceType.Keyboard, RazerEndpointType.LaptopKeyboard, 0x0239),
|
||||
("Blade 15 (2019) Advanced", RGBDeviceType.Keyboard, RazerEndpointType.LaptopKeyboard, 0x023A),
|
||||
("Blade 15 (2018) Base Model", RGBDeviceType.Keyboard, RazerEndpointType.LaptopKeyboard, 0x023B),
|
||||
("Cynosa Lite", RGBDeviceType.Keyboard, RazerEndpointType.Keyboard, 0x023F),
|
||||
("Blade 15 (2018) Mercury", RGBDeviceType.Keyboard, RazerEndpointType.LaptopKeyboard, 0x0240),
|
||||
("BlackWidow (2019)", RGBDeviceType.Keyboard, RazerEndpointType.Keyboard, 0x0241),
|
||||
("Huntsman Tournament Edition", RGBDeviceType.Keyboard, RazerEndpointType.Keyboard, 0x0243),
|
||||
("Blade 15 (Mid 2019) Mercury", RGBDeviceType.Keyboard, RazerEndpointType.LaptopKeyboard, 0x0245),
|
||||
("Blade 15 (Mid 2019) Base", RGBDeviceType.Keyboard, RazerEndpointType.LaptopKeyboard, 0x0246),
|
||||
("Blade Stealth (Late 2019)", RGBDeviceType.Keyboard, RazerEndpointType.LaptopKeyboard, 0x024A),
|
||||
("Blade Pro (Late 2019)", RGBDeviceType.Keyboard, RazerEndpointType.LaptopKeyboard, 0x024C),
|
||||
("Blade 15 Studio Edition (2019)", RGBDeviceType.Keyboard, RazerEndpointType.LaptopKeyboard, 0x024D),
|
||||
("Blade Stealth (Early 2020)", RGBDeviceType.Keyboard, RazerEndpointType.LaptopKeyboard, 0x0252),
|
||||
("Blade 15 Advanced (2020)", RGBDeviceType.Keyboard, RazerEndpointType.LaptopKeyboard, 0x0253),
|
||||
("Blade 15 (Early 2020) Base", RGBDeviceType.Keyboard, RazerEndpointType.LaptopKeyboard, 0x0255),
|
||||
("Blade Stealth (Late 2020)", RGBDeviceType.Keyboard, RazerEndpointType.LaptopKeyboard, 0x0259),
|
||||
("BlackWidow V3 Pro", RGBDeviceType.Keyboard, RazerEndpointType.Keyboard, 0x25A), // The keyboard, only present when connected with cable
|
||||
("BlackWidow V3 Pro", RGBDeviceType.Keyboard, RazerEndpointType.Keyboard, 0x25C), // The dongle, may not be present when connected with cable
|
||||
("Ornata Chroma V2", RGBDeviceType.Keyboard, RazerEndpointType.Keyboard, 0x025D),
|
||||
("Cynosa V2", RGBDeviceType.Keyboard, RazerEndpointType.Keyboard, 0x025E),
|
||||
|
||||
// Mice
|
||||
("Orochi 2011", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x0013),
|
||||
("DeathAdder 3.5G", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x0016),
|
||||
("Abyssus 1800", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x0020),
|
||||
("Mamba 2012 (Wired)", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x0024),
|
||||
("Mamba 2012 (Wireless)", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x0025),
|
||||
("Naga 2012", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x002E),
|
||||
("Imperator 2012", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x002F),
|
||||
("Ouroboros 2012", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x0032),
|
||||
("Taipan", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x0034),
|
||||
("Naga Hex (Red)", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x0036),
|
||||
("DeathAdder 2013", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x0037),
|
||||
("DeathAdder 1800", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x0038),
|
||||
("Orochi 2013", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x0039),
|
||||
("Naga 2014", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x0040),
|
||||
("Naga Hex", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x0041),
|
||||
("Abyssus 2014", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x0042),
|
||||
("DeathAdder Chroma", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x0043),
|
||||
("Mamba (Wired)", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x0044),
|
||||
("Mamba (Wireless)", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x0045),
|
||||
("Mamba Tournament Edition", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x0046),
|
||||
("Orochi (Wired)", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x0048),
|
||||
("Diamondback Chroma", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x004C),
|
||||
("DeathAdder 2000", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x004F),
|
||||
("Naga Hex V2", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x0050),
|
||||
("Naga Chroma", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x0053),
|
||||
("DeathAdder 3500", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x0054),
|
||||
("Lancehead (Wired)", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x0059),
|
||||
("Lancehead (Wireless)", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x005A),
|
||||
("Abyssus V2", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x005B),
|
||||
("DeathAdder Elite", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x005C),
|
||||
("Abyssus 2000", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x005E),
|
||||
("Lancehead Tournament Edition", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x0060),
|
||||
("Atheris (Receiver)", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x0062),
|
||||
("Basilisk", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x0064),
|
||||
("Naga Trinity", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x0067),
|
||||
("Abyssus Elite (D.Va Edition)", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x006A),
|
||||
("Abyssus Essential", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x006B),
|
||||
("Mamba Elite (Wired)", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x006C),
|
||||
("DeathAdder Essential", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x006E),
|
||||
("Lancehead Wireless (Receiver)", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x006F),
|
||||
("Lancehead Wireless (Wired)", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x0070),
|
||||
("DeathAdder Essential (White Edition)", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x0071),
|
||||
("Mamba Wireless (Receiver)", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x0072),
|
||||
("Mamba Wireless (Wired)", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x0073),
|
||||
("Viper", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x0078),
|
||||
("Viper Ultimate (Wired)", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x007A),
|
||||
("Viper Ultimate (Wireless)", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x007B),
|
||||
("DeathAdder V2 Pro (Wired)", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x007C),
|
||||
("DeathAdder V2 Pro (Wireless)", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x007D),
|
||||
("Basilisk X HyperSpeed", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x0083),
|
||||
("Basilisk Ultimate", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x0088),
|
||||
("DeathAdder V2", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x0084),
|
||||
("Viper Mini", RGBDeviceType.Mouse, RazerEndpointType.Mouse, 0x008A),
|
||||
|
||||
// Mousepads
|
||||
("Firefly Hyperflux", RGBDeviceType.Mousepad, RazerEndpointType.Mousepad, 0x0068),
|
||||
("Firefly", RGBDeviceType.Mousepad, RazerEndpointType.Mousepad, 0x0C00),
|
||||
("Goliathus", RGBDeviceType.Mousepad, RazerEndpointType.ChromaLink, 0x0C01),
|
||||
("Goliathus Extended", RGBDeviceType.Mousepad, RazerEndpointType.ChromaLink, 0x0C02),
|
||||
("Firefly v2", RGBDeviceType.Mousepad, RazerEndpointType.Mousepad, 0x0C04),
|
||||
|
||||
// Headsets
|
||||
("Kraken 7.1", RGBDeviceType.Headset, RazerEndpointType.Headset, 0x0501),
|
||||
("Kraken 7.1 Chroma", RGBDeviceType.Headset, RazerEndpointType.Headset, 0x0504),
|
||||
("Kraken 7.1", RGBDeviceType.Headset, RazerEndpointType.Headset, 0x0506),
|
||||
("Kraken 7.1 V2", RGBDeviceType.Headset, RazerEndpointType.Headset, 0x0510),
|
||||
("Kraken Ultimate", RGBDeviceType.Headset, RazerEndpointType.Headset, 0x0527),
|
||||
("Kraken Kitty Edition", RGBDeviceType.Headset, RazerEndpointType.Headset, 0x0F19),
|
||||
|
||||
// Keypads
|
||||
("Nostromo", RGBDeviceType.Keypad, RazerEndpointType.Keypad, 0x0111),
|
||||
("Orbweaver", RGBDeviceType.Keypad, RazerEndpointType.Keypad, 0x0113),
|
||||
("Tartarus", RGBDeviceType.Keypad, RazerEndpointType.Keypad, 0x0201),
|
||||
("Orbweaver Chroma", RGBDeviceType.Keypad, RazerEndpointType.Keypad, 0x0207),
|
||||
("Tartarus Chroma", RGBDeviceType.Keypad, RazerEndpointType.Keypad, 0x0208),
|
||||
("Tartarus V2", RGBDeviceType.Keypad, RazerEndpointType.Keypad, 0x022B),
|
||||
("Tartarus Pro", RGBDeviceType.Keypad, RazerEndpointType.Keypad, 0x0244),
|
||||
|
||||
// Misc - guessing these are through ChromaLink
|
||||
("Core", RGBDeviceType.GraphicsCard, RazerEndpointType.ChromaLink, 0x0215),
|
||||
("Base Station Chroma", RGBDeviceType.HeadsetStand, RazerEndpointType.ChromaLink, 0x0F08),
|
||||
("Nommo Chroma", RGBDeviceType.Speaker, RazerEndpointType.ChromaLink, 0x0517),
|
||||
("Nommo Pro", RGBDeviceType.Speaker, RazerEndpointType.ChromaLink, 0x0518),
|
||||
("Chroma Mug Holder", RGBDeviceType.Unknown, RazerEndpointType.ChromaLink, 0x0F07),
|
||||
("Chroma Hardware Development Kit (HDK)", RGBDeviceType.Unknown, RazerEndpointType.ChromaLink, 0x0F09),
|
||||
("Mouse Bungee V3 Chroma", RGBDeviceType.Unknown, RazerEndpointType.ChromaLink, 0x0F1D),
|
||||
("Base Station V2 Chroma", RGBDeviceType.Unknown, RazerEndpointType.ChromaLink, 0x0F20)
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties & Fields
|
||||
|
||||
public static DeviceDataList ConnectedDevices { get; } = new();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
internal static void LoadDeviceList(RGBDeviceType loadFilter)
|
||||
{
|
||||
ConnectedDevices.Clear();
|
||||
|
||||
HashSet<int> ids = new(DeviceList.Local.GetHidDevices(VENDOR_ID).Select(x => x.ProductID).Distinct());
|
||||
DeviceDataList connectedDevices = DEVICES.Where(d => ids.Contains(d.id) && loadFilter.HasFlag(d.deviceType)).ToList();
|
||||
|
||||
ConnectedDevices.AddRange(connectedDevices);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -50,11 +50,8 @@
|
||||
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="HidSharp" Version="2.1.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\RGB.NET.Core\RGB.NET.Core.csproj" />
|
||||
<ProjectReference Include="..\RGB.NET.HID\RGB.NET.HID.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@ -6,8 +6,8 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Devices.Razer.HID;
|
||||
using RGB.NET.Devices.Razer.Native;
|
||||
using RGB.NET.HID;
|
||||
|
||||
namespace RGB.NET.Devices.Razer
|
||||
{
|
||||
@ -42,6 +42,156 @@ namespace RGB.NET.Devices.Razer
|
||||
/// </summary>
|
||||
public bool LoadEmulatorDevices { get; set; } = false;
|
||||
|
||||
private const int VENDOR_ID = 0x1532;
|
||||
|
||||
public static HIDLoader<int, RazerEndpointType> DeviceDefinitions { get; } = new(VENDOR_ID)
|
||||
{
|
||||
// Keyboards
|
||||
{ 0x010D, RGBDeviceType.Keyboard, "BlackWidow Ultimate 2012", LedMappings.TODO, RazerEndpointType.Keyboard },
|
||||
{ 0x010E, RGBDeviceType.Keyboard, "BlackWidow Classic (Alternate)", LedMappings.TODO, RazerEndpointType.Keyboard },
|
||||
{ 0x010F, RGBDeviceType.Keyboard, "Anansi", LedMappings.TODO, RazerEndpointType.Keyboard },
|
||||
{ 0x011A, RGBDeviceType.Keyboard, "BlackWidow Ultimate 2013", LedMappings.TODO, RazerEndpointType.Keyboard },
|
||||
{ 0x011B, RGBDeviceType.Keyboard, "BlackWidow Stealth", LedMappings.TODO, RazerEndpointType.Keyboard },
|
||||
{ 0x0202, RGBDeviceType.Keyboard, "DeathStalker Expert", LedMappings.TODO, RazerEndpointType.Keyboard },
|
||||
{ 0x0203, RGBDeviceType.Keyboard, "BlackWidow Chroma", LedMappings.TODO, RazerEndpointType.Keyboard },
|
||||
{ 0x0204, RGBDeviceType.Keyboard, "DeathStalker Chroma", LedMappings.TODO, RazerEndpointType.Keyboard },
|
||||
{ 0x0205, RGBDeviceType.Keyboard, "Blade Stealth", LedMappings.TODO, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x0209, RGBDeviceType.Keyboard, "BlackWidow Tournament Edition Chroma", LedMappings.TODO, RazerEndpointType.Keyboard },
|
||||
{ 0x020F, RGBDeviceType.Keyboard, "Blade QHD", LedMappings.TODO, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x0210, RGBDeviceType.Keyboard, "Blade Pro (Late 2016)", LedMappings.TODO, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x0211, RGBDeviceType.Keyboard, "BlackWidow Chroma (Overwatch)", LedMappings.TODO, RazerEndpointType.Keyboard },
|
||||
{ 0x0214, RGBDeviceType.Keyboard, "BlackWidow Ultimate 2016", LedMappings.TODO, RazerEndpointType.Keyboard },
|
||||
{ 0x0216, RGBDeviceType.Keyboard, "BlackWidow X Chroma", LedMappings.TODO, RazerEndpointType.Keyboard },
|
||||
{ 0x0217, RGBDeviceType.Keyboard, "BlackWidow X Ultimate", LedMappings.TODO, RazerEndpointType.Keyboard },
|
||||
{ 0x021A, RGBDeviceType.Keyboard, "BlackWidow X Tournament Edition Chroma", LedMappings.TODO, RazerEndpointType.Keyboard },
|
||||
{ 0x021E, RGBDeviceType.Keyboard, "Ornata Chroma", LedMappings.TODO, RazerEndpointType.Keyboard },
|
||||
{ 0x021F, RGBDeviceType.Keyboard, "Ornata", LedMappings.TODO, RazerEndpointType.Keyboard },
|
||||
{ 0x0220, RGBDeviceType.Keyboard, "Blade Stealth (Late 2016)", LedMappings.TODO, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x0221, RGBDeviceType.Keyboard, "BlackWidow Chroma V2", LedMappings.TODO, RazerEndpointType.Keyboard },
|
||||
{ 0x0224, RGBDeviceType.Keyboard, "Blade (Late 2016)", LedMappings.TODO, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x0225, RGBDeviceType.Keyboard, "Blade Pro (2017)", LedMappings.TODO, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x0226, RGBDeviceType.Keyboard, "Huntsman Elite", LedMappings.TODO, RazerEndpointType.Keyboard },
|
||||
{ 0x0227, RGBDeviceType.Keyboard, "Huntsman", LedMappings.TODO, RazerEndpointType.Keyboard },
|
||||
{ 0x0228, RGBDeviceType.Keyboard, "BlackWidow Elite", LedMappings.TODO, RazerEndpointType.Keyboard },
|
||||
{ 0x022A, RGBDeviceType.Keyboard, "Cynosa Chroma", LedMappings.TODO, RazerEndpointType.Keyboard },
|
||||
{ 0x022D, RGBDeviceType.Keyboard, "Blade Stealth (Mid 2017)", LedMappings.TODO, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x022F, RGBDeviceType.Keyboard, "Blade Pro FullHD (2017)", LedMappings.TODO, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x0232, RGBDeviceType.Keyboard, "Blade Stealth (Late 2017)", LedMappings.TODO, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x0233, RGBDeviceType.Keyboard, "Blade 15 (2018)", LedMappings.TODO, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x0234, RGBDeviceType.Keyboard, "Blade Pro 17 (2019)", LedMappings.TODO, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x0235, RGBDeviceType.Keyboard, "BlackWidow Lite (2018)", LedMappings.TODO, RazerEndpointType.Keyboard },
|
||||
{ 0x0237, RGBDeviceType.Keyboard, "BlackWidow Essential", LedMappings.TODO, RazerEndpointType.Keyboard },
|
||||
{ 0x0239, RGBDeviceType.Keyboard, "Blade Stealth (2019)", LedMappings.TODO, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x023A, RGBDeviceType.Keyboard, "Blade 15 (2019) Advanced", LedMappings.TODO, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x023B, RGBDeviceType.Keyboard, "Blade 15 (2018) Base Model", LedMappings.TODO, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x023F, RGBDeviceType.Keyboard, "Cynosa Lite", LedMappings.TODO, RazerEndpointType.Keyboard },
|
||||
{ 0x0240, RGBDeviceType.Keyboard, "Blade 15 (2018) Mercury", LedMappings.TODO, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x0241, RGBDeviceType.Keyboard, "BlackWidow (2019)", LedMappings.TODO, RazerEndpointType.Keyboard },
|
||||
{ 0x0243, RGBDeviceType.Keyboard, "Huntsman Tournament Edition", LedMappings.TODO, RazerEndpointType.Keyboard },
|
||||
{ 0x0245, RGBDeviceType.Keyboard, "Blade 15 (Mid 2019) Mercury", LedMappings.TODO, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x0246, RGBDeviceType.Keyboard, "Blade 15 (Mid 2019) Base", LedMappings.TODO, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x024A, RGBDeviceType.Keyboard, "Blade Stealth (Late 2019)", LedMappings.TODO, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x024C, RGBDeviceType.Keyboard, "Blade Pro (Late 2019)", LedMappings.TODO, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x024D, RGBDeviceType.Keyboard, "Blade 15 Studio Edition (2019)", LedMappings.TODO, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x0252, RGBDeviceType.Keyboard, "Blade Stealth (Early 2020)", LedMappings.TODO, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x0253, RGBDeviceType.Keyboard, "Blade 15 Advanced (2020)", LedMappings.TODO, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x0255, RGBDeviceType.Keyboard, "Blade 15 (Early 2020) Base", LedMappings.TODO, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x0259, RGBDeviceType.Keyboard, "Blade Stealth (Late 2020)", LedMappings.TODO, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x25A, RGBDeviceType.Keyboard, "BlackWidow V3 Pro", LedMappings.TODO, RazerEndpointType.Keyboard }, // The keyboard, only present when connected with cable
|
||||
{ 0x25C, RGBDeviceType.Keyboard, "BlackWidow V3 Pro", LedMappings.TODO, RazerEndpointType.Keyboard }, // The dongle, may not be present when connected with cable
|
||||
{ 0x025D, RGBDeviceType.Keyboard, "Ornata Chroma V2", LedMappings.TODO, RazerEndpointType.Keyboard },
|
||||
{ 0x025E, RGBDeviceType.Keyboard, "Cynosa V2", LedMappings.TODO, RazerEndpointType.Keyboard },
|
||||
|
||||
// Mice
|
||||
{ 0x0013, RGBDeviceType.Mouse, "Orochi 2011", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x0016, RGBDeviceType.Mouse, "DeathAdder 3.5G", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x0020, RGBDeviceType.Mouse, "Abyssus 1800", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x0024, RGBDeviceType.Mouse, "Mamba 2012 (Wired)", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x0025, RGBDeviceType.Mouse, "Mamba 2012 (Wireless)", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x002E, RGBDeviceType.Mouse, "Naga 2012", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x002F, RGBDeviceType.Mouse, "Imperator 2012", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x0032, RGBDeviceType.Mouse, "Ouroboros 2012", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x0034, RGBDeviceType.Mouse, "Taipan", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x0036, RGBDeviceType.Mouse, "Naga Hex (Red)", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x0037, RGBDeviceType.Mouse, "DeathAdder 2013", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x0038, RGBDeviceType.Mouse, "DeathAdder 1800", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x0039, RGBDeviceType.Mouse, "Orochi 2013", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x0040, RGBDeviceType.Mouse, "Naga 2014", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x0041, RGBDeviceType.Mouse, "Naga Hex", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x0042, RGBDeviceType.Mouse, "Abyssus 2014", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x0043, RGBDeviceType.Mouse, "DeathAdder Chroma", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x0044, RGBDeviceType.Mouse, "Mamba (Wired)", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x0045, RGBDeviceType.Mouse, "Mamba (Wireless)", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x0046, RGBDeviceType.Mouse, "Mamba Tournament Edition", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x0048, RGBDeviceType.Mouse, "Orochi (Wired)", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x004C, RGBDeviceType.Mouse, "Diamondback Chroma", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x004F, RGBDeviceType.Mouse, "DeathAdder 2000", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x0050, RGBDeviceType.Mouse, "Naga Hex V2", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x0053, RGBDeviceType.Mouse, "Naga Chroma", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x0054, RGBDeviceType.Mouse, "DeathAdder 3500", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x0059, RGBDeviceType.Mouse, "Lancehead (Wired)", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x005A, RGBDeviceType.Mouse, "Lancehead (Wireless)", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x005B, RGBDeviceType.Mouse, "Abyssus V2", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x005C, RGBDeviceType.Mouse, "DeathAdder Elite", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x005E, RGBDeviceType.Mouse, "Abyssus 2000", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x0060, RGBDeviceType.Mouse, "Lancehead Tournament Edition", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x0062, RGBDeviceType.Mouse, "Atheris (Receiver)", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x0064, RGBDeviceType.Mouse, "Basilisk", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x0067, RGBDeviceType.Mouse, "Naga Trinity", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x006A, RGBDeviceType.Mouse, "Abyssus Elite (D.Va Edition)", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x006B, RGBDeviceType.Mouse, "Abyssus Essential", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x006C, RGBDeviceType.Mouse, "Mamba Elite (Wired)", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x006E, RGBDeviceType.Mouse, "DeathAdder Essential", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x006F, RGBDeviceType.Mouse, "Lancehead Wireless (Receiver)", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x0070, RGBDeviceType.Mouse, "Lancehead Wireless (Wired)", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x0071, RGBDeviceType.Mouse, "DeathAdder Essential (White Edition)", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x0072, RGBDeviceType.Mouse, "Mamba Wireless (Receiver)", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x0073, RGBDeviceType.Mouse, "Mamba Wireless (Wired)", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x0078, RGBDeviceType.Mouse, "Viper", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x007A, RGBDeviceType.Mouse, "Viper Ultimate (Wired)", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x007B, RGBDeviceType.Mouse, "Viper Ultimate (Wireless)", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x007C, RGBDeviceType.Mouse, "DeathAdder V2 Pro (Wired)", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x007D, RGBDeviceType.Mouse, "DeathAdder V2 Pro (Wireless)", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x0083, RGBDeviceType.Mouse, "Basilisk X HyperSpeed", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x0088, RGBDeviceType.Mouse, "Basilisk Ultimate", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x0084, RGBDeviceType.Mouse, "DeathAdder V2", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
{ 0x008A, RGBDeviceType.Mouse, "Viper Mini", LedMappings.TODO, RazerEndpointType.Mouse },
|
||||
|
||||
// Mousepads
|
||||
{ 0x0068, RGBDeviceType.Mousepad, "Firefly Hyperflux", LedMappings.TODO, RazerEndpointType.Mousepad },
|
||||
{ 0x0C00, RGBDeviceType.Mousepad, "Firefly", LedMappings.TODO, RazerEndpointType.Mousepad },
|
||||
{ 0x0C01, RGBDeviceType.Mousepad, "Goliathus", LedMappings.TODO, RazerEndpointType.ChromaLink },
|
||||
{ 0x0C02, RGBDeviceType.Mousepad, "Goliathus Extended", LedMappings.TODO, RazerEndpointType.ChromaLink },
|
||||
{ 0x0C04, RGBDeviceType.Mousepad, "Firefly v2", LedMappings.TODO, RazerEndpointType.Mousepad },
|
||||
|
||||
// Headsets
|
||||
{ 0x0501, RGBDeviceType.Headset, "Kraken 7.1", LedMappings.TODO, RazerEndpointType.Headset },
|
||||
{ 0x0504, RGBDeviceType.Headset, "Kraken 7.1 Chroma", LedMappings.TODO, RazerEndpointType.Headset },
|
||||
{ 0x0506, RGBDeviceType.Headset, "Kraken 7.1", LedMappings.TODO, RazerEndpointType.Headset },
|
||||
{ 0x0510, RGBDeviceType.Headset, "Kraken 7.1 V2", LedMappings.TODO, RazerEndpointType.Headset },
|
||||
{ 0x0527, RGBDeviceType.Headset, "Kraken Ultimate", LedMappings.TODO, RazerEndpointType.Headset },
|
||||
{ 0x0F19, RGBDeviceType.Headset, "Kraken Kitty Edition", LedMappings.TODO, RazerEndpointType.Headset },
|
||||
|
||||
// Keypads
|
||||
{ 0x0111, RGBDeviceType.Keypad, "Nostromo", LedMappings.TODO, RazerEndpointType.Keypad },
|
||||
{ 0x0113, RGBDeviceType.Keypad, "Orbweaver", LedMappings.TODO, RazerEndpointType.Keypad },
|
||||
{ 0x0201, RGBDeviceType.Keypad, "Tartarus", LedMappings.TODO, RazerEndpointType.Keypad },
|
||||
{ 0x0207, RGBDeviceType.Keypad, "Orbweaver Chroma", LedMappings.TODO, RazerEndpointType.Keypad },
|
||||
{ 0x0208, RGBDeviceType.Keypad, "Tartarus Chroma", LedMappings.TODO, RazerEndpointType.Keypad },
|
||||
{ 0x022B, RGBDeviceType.Keypad, "Tartarus V2", LedMappings.TODO, RazerEndpointType.Keypad },
|
||||
{ 0x0244, RGBDeviceType.Keypad, "Tartarus Pro", LedMappings.TODO, RazerEndpointType.Keypad },
|
||||
|
||||
// Misc - guessing these are through ChromaLink
|
||||
{ 0x0215, RGBDeviceType.GraphicsCard, "Core", LedMappings.TODO, RazerEndpointType.ChromaLink },
|
||||
{ 0x0F08, RGBDeviceType.HeadsetStand, "Base Station Chroma", LedMappings.TODO, RazerEndpointType.ChromaLink },
|
||||
{ 0x0517, RGBDeviceType.Speaker, "Nommo Chroma", LedMappings.TODO, RazerEndpointType.ChromaLink },
|
||||
{ 0x0518, RGBDeviceType.Speaker, "Nommo Pro", LedMappings.TODO, RazerEndpointType.ChromaLink },
|
||||
{ 0x0F07, RGBDeviceType.Unknown, "Chroma Mug Holder", LedMappings.TODO, RazerEndpointType.ChromaLink },
|
||||
{ 0x0F09, RGBDeviceType.Unknown, "Chroma Hardware Development Kit (HDK)", LedMappings.TODO, RazerEndpointType.ChromaLink },
|
||||
{ 0x0F1D, RGBDeviceType.Unknown, "Mouse Bungee V3 Chroma", LedMappings.TODO, RazerEndpointType.ChromaLink },
|
||||
{ 0x0F20, RGBDeviceType.Unknown, "Base Station V2 Chroma", LedMappings.TODO, RazerEndpointType.ChromaLink }
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
@ -73,7 +223,7 @@ namespace RGB.NET.Devices.Razer
|
||||
|
||||
protected override IEnumerable<IRGBDevice> GetLoadedDevices(RGBDeviceType loadFilter)
|
||||
{
|
||||
DeviceChecker.LoadDeviceList(loadFilter);
|
||||
DeviceDefinitions.LoadFilter = loadFilter;
|
||||
|
||||
IList<IRGBDevice> devices = base.GetLoadedDevices(loadFilter).ToList();
|
||||
|
||||
@ -99,28 +249,22 @@ namespace RGB.NET.Devices.Razer
|
||||
protected override IEnumerable<IRGBDevice> LoadDevices()
|
||||
{
|
||||
// Only take the first device of each endpoint type, the Razer SDK doesn't allow separate control over multiple devices using the same endpoint
|
||||
foreach ((var model, RGBDeviceType deviceType, RazerEndpointType endpointType, int _) in DeviceChecker.ConnectedDevices.GroupBy(GetEndpointDeviceType).Select(t => t.First()))
|
||||
foreach ((HIDDeviceDefinition<int, RazerEndpointType> definition, _) in DeviceDefinitions.GetConnectedDevices(x => x.CustomData == RazerEndpointType.LaptopKeyboard ? RazerEndpointType.Keyboard : x.CustomData))
|
||||
{
|
||||
yield return endpointType switch
|
||||
yield return definition.CustomData switch
|
||||
{
|
||||
RazerEndpointType.Keyboard => new RazerKeyboardRGBDevice(new RazerKeyboardRGBDeviceInfo(model, endpointType), GetUpdateTrigger()),
|
||||
RazerEndpointType.LaptopKeyboard => new RazerKeyboardRGBDevice(new RazerKeyboardRGBDeviceInfo(model, endpointType), GetUpdateTrigger()),
|
||||
RazerEndpointType.Mouse => new RazerMouseRGBDevice(new RazerRGBDeviceInfo(deviceType, endpointType, model), GetUpdateTrigger()),
|
||||
RazerEndpointType.Headset => new RazerHeadsetRGBDevice(new RazerRGBDeviceInfo(deviceType, endpointType, model), GetUpdateTrigger()),
|
||||
RazerEndpointType.Mousepad => new RazerMousepadRGBDevice(new RazerRGBDeviceInfo(deviceType, endpointType, model), GetUpdateTrigger()),
|
||||
RazerEndpointType.Keypad => new RazerKeypadRGBDevice(new RazerRGBDeviceInfo(deviceType, endpointType, model), GetUpdateTrigger()),
|
||||
RazerEndpointType.ChromaLink => new RazerChromaLinkRGBDevice(new RazerRGBDeviceInfo(deviceType, endpointType, model), GetUpdateTrigger()),
|
||||
_ => throw new RGBDeviceException($"Razer SDK does not support endpoint '{endpointType}'")
|
||||
RazerEndpointType.Keyboard => new RazerKeyboardRGBDevice(new RazerKeyboardRGBDeviceInfo(definition.Name, definition.CustomData), GetUpdateTrigger()),
|
||||
RazerEndpointType.LaptopKeyboard => new RazerKeyboardRGBDevice(new RazerKeyboardRGBDeviceInfo(definition.Name, definition.CustomData), GetUpdateTrigger()),
|
||||
RazerEndpointType.Mouse => new RazerMouseRGBDevice(new RazerRGBDeviceInfo(definition.DeviceType, definition.CustomData, definition.Name), GetUpdateTrigger()),
|
||||
RazerEndpointType.Headset => new RazerHeadsetRGBDevice(new RazerRGBDeviceInfo(definition.DeviceType, definition.CustomData, definition.Name), GetUpdateTrigger()),
|
||||
RazerEndpointType.Mousepad => new RazerMousepadRGBDevice(new RazerRGBDeviceInfo(definition.DeviceType, definition.CustomData, definition.Name), GetUpdateTrigger()),
|
||||
RazerEndpointType.Keypad => new RazerKeypadRGBDevice(new RazerRGBDeviceInfo(definition.DeviceType, definition.CustomData, definition.Name), GetUpdateTrigger()),
|
||||
RazerEndpointType.ChromaLink => new RazerChromaLinkRGBDevice(new RazerRGBDeviceInfo(definition.DeviceType, definition.CustomData, definition.Name), GetUpdateTrigger()),
|
||||
_ => throw new RGBDeviceException($"Razer SDK does not support endpoint '{definition.CustomData}'")
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private RazerEndpointType GetEndpointDeviceType((string model, RGBDeviceType deviceType, RazerEndpointType razerDeviceType, int id) device)
|
||||
{
|
||||
// Treat laptop keyboards as regular keyboards
|
||||
return device.razerDeviceType == RazerEndpointType.LaptopKeyboard ? RazerEndpointType.Keyboard : device.razerDeviceType;
|
||||
}
|
||||
|
||||
private void ThrowRazerError(RazerError errorCode) => throw new RazerException(errorCode);
|
||||
|
||||
private void TryUnInit()
|
||||
|
||||
@ -1,446 +1,369 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using HidSharp;
|
||||
using RGB.NET.Core;
|
||||
using DeviceDataList = System.Collections.Generic.List<(string model, RGB.NET.Core.RGBDeviceType deviceType, int id, RGB.NET.Devices.SteelSeries.SteelSeriesDeviceType steelSeriesDeviceType, System.Collections.Generic.Dictionary<RGB.NET.Core.LedId, RGB.NET.Devices.SteelSeries.SteelSeriesLedId> ledMapping)>;
|
||||
using LedMapping = System.Collections.Generic.Dictionary<RGB.NET.Core.LedId, RGB.NET.Devices.SteelSeries.SteelSeriesLedId>;
|
||||
|
||||
namespace RGB.NET.Devices.SteelSeries.HID
|
||||
{
|
||||
internal static class DeviceChecker
|
||||
{
|
||||
#region Constants
|
||||
|
||||
private static readonly LedMapping KEYBOARD_MAPPING_UK = new()
|
||||
{
|
||||
{ LedId.Logo, SteelSeriesLedId.Logo },
|
||||
{ LedId.Keyboard_Escape, SteelSeriesLedId.Escape },
|
||||
{ LedId.Keyboard_F1, SteelSeriesLedId.F1 },
|
||||
{ LedId.Keyboard_F2, SteelSeriesLedId.F2 },
|
||||
{ LedId.Keyboard_F3, SteelSeriesLedId.F3 },
|
||||
{ LedId.Keyboard_F4, SteelSeriesLedId.F4 },
|
||||
{ LedId.Keyboard_F5, SteelSeriesLedId.F5 },
|
||||
{ LedId.Keyboard_F6, SteelSeriesLedId.F6 },
|
||||
{ LedId.Keyboard_F7, SteelSeriesLedId.F7 },
|
||||
{ LedId.Keyboard_F8, SteelSeriesLedId.F8 },
|
||||
{ LedId.Keyboard_F9, SteelSeriesLedId.F9 },
|
||||
{ LedId.Keyboard_F10, SteelSeriesLedId.F10 },
|
||||
{ LedId.Keyboard_F11, SteelSeriesLedId.F11 },
|
||||
{ LedId.Keyboard_GraveAccentAndTilde, SteelSeriesLedId.Backqoute },
|
||||
{ LedId.Keyboard_1, SteelSeriesLedId.Keyboard1 },
|
||||
{ LedId.Keyboard_2, SteelSeriesLedId.Keyboard2 },
|
||||
{ LedId.Keyboard_3, SteelSeriesLedId.Keyboard3 },
|
||||
{ LedId.Keyboard_4, SteelSeriesLedId.Keyboard4 },
|
||||
{ LedId.Keyboard_5, SteelSeriesLedId.Keyboard5 },
|
||||
{ LedId.Keyboard_6, SteelSeriesLedId.Keyboard6 },
|
||||
{ LedId.Keyboard_7, SteelSeriesLedId.Keyboard7 },
|
||||
{ LedId.Keyboard_8, SteelSeriesLedId.Keyboard8 },
|
||||
{ LedId.Keyboard_9, SteelSeriesLedId.Keyboard9 },
|
||||
{ LedId.Keyboard_0, SteelSeriesLedId.Keyboard0 },
|
||||
{ LedId.Keyboard_MinusAndUnderscore, SteelSeriesLedId.Dash },
|
||||
{ LedId.Keyboard_Tab, SteelSeriesLedId.Tab },
|
||||
{ LedId.Keyboard_Q, SteelSeriesLedId.Q },
|
||||
{ LedId.Keyboard_W, SteelSeriesLedId.W },
|
||||
{ LedId.Keyboard_E, SteelSeriesLedId.E },
|
||||
{ LedId.Keyboard_R, SteelSeriesLedId.R },
|
||||
{ LedId.Keyboard_T, SteelSeriesLedId.T },
|
||||
{ LedId.Keyboard_Y, SteelSeriesLedId.Y },
|
||||
{ LedId.Keyboard_U, SteelSeriesLedId.U },
|
||||
{ LedId.Keyboard_I, SteelSeriesLedId.I },
|
||||
{ LedId.Keyboard_O, SteelSeriesLedId.O },
|
||||
{ LedId.Keyboard_P, SteelSeriesLedId.P },
|
||||
{ LedId.Keyboard_BracketLeft, SteelSeriesLedId.LBracket },
|
||||
{ LedId.Keyboard_CapsLock, SteelSeriesLedId.Caps },
|
||||
{ LedId.Keyboard_A, SteelSeriesLedId.A },
|
||||
{ LedId.Keyboard_S, SteelSeriesLedId.S },
|
||||
{ LedId.Keyboard_D, SteelSeriesLedId.D },
|
||||
{ LedId.Keyboard_F, SteelSeriesLedId.F },
|
||||
{ LedId.Keyboard_G, SteelSeriesLedId.G },
|
||||
{ LedId.Keyboard_H, SteelSeriesLedId.H },
|
||||
{ LedId.Keyboard_J, SteelSeriesLedId.J },
|
||||
{ LedId.Keyboard_K, SteelSeriesLedId.K },
|
||||
{ LedId.Keyboard_L, SteelSeriesLedId.L },
|
||||
{ LedId.Keyboard_SemicolonAndColon, SteelSeriesLedId.Semicolon },
|
||||
{ LedId.Keyboard_ApostropheAndDoubleQuote, SteelSeriesLedId.Quote },
|
||||
{ LedId.Keyboard_LeftShift, SteelSeriesLedId.LShift },
|
||||
{ LedId.Keyboard_NonUsTilde, SteelSeriesLedId.Pound },
|
||||
{ LedId.Keyboard_Z, SteelSeriesLedId.Z },
|
||||
{ LedId.Keyboard_X, SteelSeriesLedId.X },
|
||||
{ LedId.Keyboard_C, SteelSeriesLedId.C },
|
||||
{ LedId.Keyboard_V, SteelSeriesLedId.V },
|
||||
{ LedId.Keyboard_B, SteelSeriesLedId.B },
|
||||
{ LedId.Keyboard_N, SteelSeriesLedId.N },
|
||||
{ LedId.Keyboard_M, SteelSeriesLedId.M },
|
||||
{ LedId.Keyboard_CommaAndLessThan, SteelSeriesLedId.Comma },
|
||||
{ LedId.Keyboard_PeriodAndBiggerThan, SteelSeriesLedId.Period },
|
||||
{ LedId.Keyboard_SlashAndQuestionMark, SteelSeriesLedId.Slash },
|
||||
{ LedId.Keyboard_LeftCtrl, SteelSeriesLedId.LCtrl },
|
||||
{ LedId.Keyboard_LeftGui, SteelSeriesLedId.LWin },
|
||||
{ LedId.Keyboard_LeftAlt, SteelSeriesLedId.LAlt },
|
||||
{ LedId.Keyboard_Space, SteelSeriesLedId.Spacebar },
|
||||
{ LedId.Keyboard_RightAlt, SteelSeriesLedId.RAlt },
|
||||
{ LedId.Keyboard_RightGui, SteelSeriesLedId.RWin },
|
||||
{ LedId.Keyboard_Application, SteelSeriesLedId.SSKey },
|
||||
{ LedId.Keyboard_F12, SteelSeriesLedId.F12 },
|
||||
{ LedId.Keyboard_PrintScreen, SteelSeriesLedId.PrintScreen },
|
||||
{ LedId.Keyboard_ScrollLock, SteelSeriesLedId.ScrollLock },
|
||||
{ LedId.Keyboard_PauseBreak, SteelSeriesLedId.Pause },
|
||||
{ LedId.Keyboard_Insert, SteelSeriesLedId.Insert },
|
||||
{ LedId.Keyboard_Home, SteelSeriesLedId.Home },
|
||||
{ LedId.Keyboard_PageUp, SteelSeriesLedId.PageUp },
|
||||
{ LedId.Keyboard_BracketRight, SteelSeriesLedId.RBracket },
|
||||
{ LedId.Keyboard_Backslash, SteelSeriesLedId.Backslash },
|
||||
{ LedId.Keyboard_Enter, SteelSeriesLedId.Return },
|
||||
{ LedId.Keyboard_EqualsAndPlus, SteelSeriesLedId.Equal },
|
||||
{ LedId.Keyboard_Backspace, SteelSeriesLedId.Backspace },
|
||||
{ LedId.Keyboard_Delete, SteelSeriesLedId.Delete },
|
||||
{ LedId.Keyboard_End, SteelSeriesLedId.End },
|
||||
{ LedId.Keyboard_PageDown, SteelSeriesLedId.PageDown },
|
||||
{ LedId.Keyboard_RightShift, SteelSeriesLedId.RShift },
|
||||
{ LedId.Keyboard_RightCtrl, SteelSeriesLedId.RCtrl },
|
||||
{ LedId.Keyboard_ArrowUp, SteelSeriesLedId.UpArrow },
|
||||
{ LedId.Keyboard_ArrowLeft, SteelSeriesLedId.LeftArrow },
|
||||
{ LedId.Keyboard_ArrowDown, SteelSeriesLedId.DownArrow },
|
||||
{ LedId.Keyboard_ArrowRight, SteelSeriesLedId.RightArrow },
|
||||
{ LedId.Keyboard_NumLock, SteelSeriesLedId.KeypadNumLock },
|
||||
{ LedId.Keyboard_NumSlash, SteelSeriesLedId.KeypadDivide },
|
||||
{ LedId.Keyboard_NumAsterisk, SteelSeriesLedId.KeypadTimes },
|
||||
{ LedId.Keyboard_NumMinus, SteelSeriesLedId.KeypadMinus },
|
||||
{ LedId.Keyboard_NumPlus, SteelSeriesLedId.KeypadPlus },
|
||||
{ LedId.Keyboard_NumEnter, SteelSeriesLedId.KeypadEnter },
|
||||
{ LedId.Keyboard_Num7, SteelSeriesLedId.Keypad7 },
|
||||
{ LedId.Keyboard_Num8, SteelSeriesLedId.Keypad8 },
|
||||
{ LedId.Keyboard_Num9, SteelSeriesLedId.Keypad9 },
|
||||
{ LedId.Keyboard_Num4, SteelSeriesLedId.Keypad4 },
|
||||
{ LedId.Keyboard_Num5, SteelSeriesLedId.Keypad5 },
|
||||
{ LedId.Keyboard_Num6, SteelSeriesLedId.Keypad6 },
|
||||
{ LedId.Keyboard_Num1, SteelSeriesLedId.Keypad1 },
|
||||
{ LedId.Keyboard_Num2, SteelSeriesLedId.Keypad2 },
|
||||
{ LedId.Keyboard_Num3, SteelSeriesLedId.Keypad3 },
|
||||
{ LedId.Keyboard_Num0, SteelSeriesLedId.Keypad0 },
|
||||
{ LedId.Keyboard_NumPeriodAndDelete, SteelSeriesLedId.KeypadPeriod }
|
||||
};
|
||||
|
||||
private static readonly LedMapping KEYBOARD_TKL_MAPPING_UK = new()
|
||||
{
|
||||
{ LedId.Logo, SteelSeriesLedId.Logo },
|
||||
{ LedId.Keyboard_Escape, SteelSeriesLedId.Escape },
|
||||
{ LedId.Keyboard_F1, SteelSeriesLedId.F1 },
|
||||
{ LedId.Keyboard_F2, SteelSeriesLedId.F2 },
|
||||
{ LedId.Keyboard_F3, SteelSeriesLedId.F3 },
|
||||
{ LedId.Keyboard_F4, SteelSeriesLedId.F4 },
|
||||
{ LedId.Keyboard_F5, SteelSeriesLedId.F5 },
|
||||
{ LedId.Keyboard_F6, SteelSeriesLedId.F6 },
|
||||
{ LedId.Keyboard_F7, SteelSeriesLedId.F7 },
|
||||
{ LedId.Keyboard_F8, SteelSeriesLedId.F8 },
|
||||
{ LedId.Keyboard_F9, SteelSeriesLedId.F9 },
|
||||
{ LedId.Keyboard_F10, SteelSeriesLedId.F10 },
|
||||
{ LedId.Keyboard_F11, SteelSeriesLedId.F11 },
|
||||
{ LedId.Keyboard_GraveAccentAndTilde, SteelSeriesLedId.Backqoute },
|
||||
{ LedId.Keyboard_1, SteelSeriesLedId.Keyboard1 },
|
||||
{ LedId.Keyboard_2, SteelSeriesLedId.Keyboard2 },
|
||||
{ LedId.Keyboard_3, SteelSeriesLedId.Keyboard3 },
|
||||
{ LedId.Keyboard_4, SteelSeriesLedId.Keyboard4 },
|
||||
{ LedId.Keyboard_5, SteelSeriesLedId.Keyboard5 },
|
||||
{ LedId.Keyboard_6, SteelSeriesLedId.Keyboard6 },
|
||||
{ LedId.Keyboard_7, SteelSeriesLedId.Keyboard7 },
|
||||
{ LedId.Keyboard_8, SteelSeriesLedId.Keyboard8 },
|
||||
{ LedId.Keyboard_9, SteelSeriesLedId.Keyboard9 },
|
||||
{ LedId.Keyboard_0, SteelSeriesLedId.Keyboard0 },
|
||||
{ LedId.Keyboard_MinusAndUnderscore, SteelSeriesLedId.Dash },
|
||||
{ LedId.Keyboard_Tab, SteelSeriesLedId.Tab },
|
||||
{ LedId.Keyboard_Q, SteelSeriesLedId.Q },
|
||||
{ LedId.Keyboard_W, SteelSeriesLedId.W },
|
||||
{ LedId.Keyboard_E, SteelSeriesLedId.E },
|
||||
{ LedId.Keyboard_R, SteelSeriesLedId.R },
|
||||
{ LedId.Keyboard_T, SteelSeriesLedId.T },
|
||||
{ LedId.Keyboard_Y, SteelSeriesLedId.Y },
|
||||
{ LedId.Keyboard_U, SteelSeriesLedId.U },
|
||||
{ LedId.Keyboard_I, SteelSeriesLedId.I },
|
||||
{ LedId.Keyboard_O, SteelSeriesLedId.O },
|
||||
{ LedId.Keyboard_P, SteelSeriesLedId.P },
|
||||
{ LedId.Keyboard_BracketLeft, SteelSeriesLedId.LBracket },
|
||||
{ LedId.Keyboard_CapsLock, SteelSeriesLedId.Caps },
|
||||
{ LedId.Keyboard_A, SteelSeriesLedId.A },
|
||||
{ LedId.Keyboard_S, SteelSeriesLedId.S },
|
||||
{ LedId.Keyboard_D, SteelSeriesLedId.D },
|
||||
{ LedId.Keyboard_F, SteelSeriesLedId.F },
|
||||
{ LedId.Keyboard_G, SteelSeriesLedId.G },
|
||||
{ LedId.Keyboard_H, SteelSeriesLedId.H },
|
||||
{ LedId.Keyboard_J, SteelSeriesLedId.J },
|
||||
{ LedId.Keyboard_K, SteelSeriesLedId.K },
|
||||
{ LedId.Keyboard_L, SteelSeriesLedId.L },
|
||||
{ LedId.Keyboard_SemicolonAndColon, SteelSeriesLedId.Semicolon },
|
||||
{ LedId.Keyboard_ApostropheAndDoubleQuote, SteelSeriesLedId.Quote },
|
||||
{ LedId.Keyboard_LeftShift, SteelSeriesLedId.LShift },
|
||||
{ LedId.Keyboard_NonUsTilde, SteelSeriesLedId.Pound },
|
||||
{ LedId.Keyboard_Z, SteelSeriesLedId.Z },
|
||||
{ LedId.Keyboard_X, SteelSeriesLedId.X },
|
||||
{ LedId.Keyboard_C, SteelSeriesLedId.C },
|
||||
{ LedId.Keyboard_V, SteelSeriesLedId.V },
|
||||
{ LedId.Keyboard_B, SteelSeriesLedId.B },
|
||||
{ LedId.Keyboard_N, SteelSeriesLedId.N },
|
||||
{ LedId.Keyboard_M, SteelSeriesLedId.M },
|
||||
{ LedId.Keyboard_CommaAndLessThan, SteelSeriesLedId.Comma },
|
||||
{ LedId.Keyboard_PeriodAndBiggerThan, SteelSeriesLedId.Period },
|
||||
{ LedId.Keyboard_SlashAndQuestionMark, SteelSeriesLedId.Slash },
|
||||
{ LedId.Keyboard_LeftCtrl, SteelSeriesLedId.LCtrl },
|
||||
{ LedId.Keyboard_LeftGui, SteelSeriesLedId.LWin },
|
||||
{ LedId.Keyboard_LeftAlt, SteelSeriesLedId.LAlt },
|
||||
{ LedId.Keyboard_Space, SteelSeriesLedId.Spacebar },
|
||||
{ LedId.Keyboard_RightAlt, SteelSeriesLedId.RAlt },
|
||||
{ LedId.Keyboard_RightGui, SteelSeriesLedId.RWin },
|
||||
{ LedId.Keyboard_Application, SteelSeriesLedId.SSKey },
|
||||
{ LedId.Keyboard_F12, SteelSeriesLedId.F12 },
|
||||
{ LedId.Keyboard_PrintScreen, SteelSeriesLedId.PrintScreen },
|
||||
{ LedId.Keyboard_ScrollLock, SteelSeriesLedId.ScrollLock },
|
||||
{ LedId.Keyboard_PauseBreak, SteelSeriesLedId.Pause },
|
||||
{ LedId.Keyboard_Insert, SteelSeriesLedId.Insert },
|
||||
{ LedId.Keyboard_Home, SteelSeriesLedId.Home },
|
||||
{ LedId.Keyboard_PageUp, SteelSeriesLedId.PageUp },
|
||||
{ LedId.Keyboard_BracketRight, SteelSeriesLedId.RBracket },
|
||||
{ LedId.Keyboard_Backslash, SteelSeriesLedId.Backslash },
|
||||
{ LedId.Keyboard_Enter, SteelSeriesLedId.Return },
|
||||
{ LedId.Keyboard_EqualsAndPlus, SteelSeriesLedId.Equal },
|
||||
{ LedId.Keyboard_Backspace, SteelSeriesLedId.Backspace },
|
||||
{ LedId.Keyboard_Delete, SteelSeriesLedId.Delete },
|
||||
{ LedId.Keyboard_End, SteelSeriesLedId.End },
|
||||
{ LedId.Keyboard_PageDown, SteelSeriesLedId.PageDown },
|
||||
{ LedId.Keyboard_RightShift, SteelSeriesLedId.RShift },
|
||||
{ LedId.Keyboard_RightCtrl, SteelSeriesLedId.RCtrl },
|
||||
{ LedId.Keyboard_ArrowUp, SteelSeriesLedId.UpArrow },
|
||||
{ LedId.Keyboard_ArrowLeft, SteelSeriesLedId.LeftArrow },
|
||||
{ LedId.Keyboard_ArrowDown, SteelSeriesLedId.DownArrow },
|
||||
{ LedId.Keyboard_ArrowRight, SteelSeriesLedId.RightArrow }
|
||||
};
|
||||
|
||||
private static readonly LedMapping MOUSE_ONE_ZONE = new()
|
||||
{
|
||||
{ LedId.Mouse1, SteelSeriesLedId.ZoneOne }
|
||||
};
|
||||
|
||||
private static readonly LedMapping MOUSE_TWO_ZONE = new()
|
||||
{
|
||||
{ LedId.Mouse1, SteelSeriesLedId.ZoneOne },
|
||||
{ LedId.Mouse2, SteelSeriesLedId.ZoneTwo }
|
||||
};
|
||||
|
||||
private static readonly LedMapping MOUSE_THREE_ZONE = new()
|
||||
{
|
||||
{ LedId.Mouse1, SteelSeriesLedId.ZoneOne },
|
||||
{ LedId.Mouse2, SteelSeriesLedId.ZoneTwo },
|
||||
{ LedId.Mouse3, SteelSeriesLedId.ZoneThree }
|
||||
};
|
||||
|
||||
private static readonly LedMapping MOUSE_EIGHT_ZONE = new()
|
||||
{
|
||||
{ LedId.Mouse1, SteelSeriesLedId.ZoneOne },
|
||||
{ LedId.Mouse2, SteelSeriesLedId.ZoneTwo },
|
||||
{ LedId.Mouse3, SteelSeriesLedId.ZoneThree },
|
||||
{ LedId.Mouse4, SteelSeriesLedId.ZoneFour },
|
||||
{ LedId.Mouse5, SteelSeriesLedId.ZoneFive },
|
||||
{ LedId.Mouse6, SteelSeriesLedId.ZoneSix },
|
||||
{ LedId.Mouse7, SteelSeriesLedId.ZoneSeven },
|
||||
{ LedId.Mouse8, SteelSeriesLedId.ZoneEight }
|
||||
};
|
||||
|
||||
private static readonly LedMapping HEADSET_TWO_ZONE = new()
|
||||
{
|
||||
{ LedId.Headset1, SteelSeriesLedId.ZoneOne },
|
||||
{ LedId.Headset2, SteelSeriesLedId.ZoneTwo }
|
||||
};
|
||||
|
||||
private static readonly LedMapping MOUSEPAD_TWELVE_ZONE = new()
|
||||
{
|
||||
{ LedId.Mousepad1, SteelSeriesLedId.ZoneOne },
|
||||
{ LedId.Mousepad2, SteelSeriesLedId.ZoneTwo },
|
||||
{ LedId.Mousepad3, SteelSeriesLedId.ZoneThree },
|
||||
{ LedId.Mousepad4, SteelSeriesLedId.ZoneFour },
|
||||
{ LedId.Mousepad5, SteelSeriesLedId.ZoneFive },
|
||||
{ LedId.Mousepad6, SteelSeriesLedId.ZoneSix },
|
||||
{ LedId.Mousepad7, SteelSeriesLedId.ZoneSeven },
|
||||
{ LedId.Mousepad8, SteelSeriesLedId.ZoneEight },
|
||||
{ LedId.Mousepad9, SteelSeriesLedId.ZoneNine },
|
||||
{ LedId.Mousepad10, SteelSeriesLedId.ZoneTen },
|
||||
{ LedId.Mousepad11, SteelSeriesLedId.ZoneEleven },
|
||||
{ LedId.Mousepad12, SteelSeriesLedId.ZoneTwelve },
|
||||
};
|
||||
|
||||
private static readonly LedMapping MONITOR_ONEHUNDREDANDTHREE_ZONE = new()
|
||||
{
|
||||
{ LedId.LedStripe1, SteelSeriesLedId.ZoneOne },
|
||||
{ LedId.LedStripe2, SteelSeriesLedId.ZoneTwo },
|
||||
{ LedId.LedStripe3, SteelSeriesLedId.ZoneThree },
|
||||
{ LedId.LedStripe4, SteelSeriesLedId.ZoneFour },
|
||||
{ LedId.LedStripe5, SteelSeriesLedId.ZoneFive },
|
||||
{ LedId.LedStripe6, SteelSeriesLedId.ZoneSix },
|
||||
{ LedId.LedStripe7, SteelSeriesLedId.ZoneSeven },
|
||||
{ LedId.LedStripe8, SteelSeriesLedId.ZoneEight },
|
||||
{ LedId.LedStripe9, SteelSeriesLedId.ZoneNine },
|
||||
{ LedId.LedStripe10, SteelSeriesLedId.ZoneTen },
|
||||
{ LedId.LedStripe11, SteelSeriesLedId.ZoneEleven },
|
||||
{ LedId.LedStripe12, SteelSeriesLedId.ZoneTwelve },
|
||||
{ LedId.LedStripe13, SteelSeriesLedId.ZoneThirteen },
|
||||
{ LedId.LedStripe14, SteelSeriesLedId.ZoneFourteen },
|
||||
{ LedId.LedStripe15, SteelSeriesLedId.ZoneFifteen },
|
||||
{ LedId.LedStripe16, SteelSeriesLedId.ZoneSixteen },
|
||||
{ LedId.LedStripe17, SteelSeriesLedId.ZoneSeventeen },
|
||||
{ LedId.LedStripe18, SteelSeriesLedId.ZoneEighteen },
|
||||
{ LedId.LedStripe19, SteelSeriesLedId.ZoneNineteen },
|
||||
{ LedId.LedStripe20, SteelSeriesLedId.ZoneTwenty },
|
||||
{ LedId.LedStripe21, SteelSeriesLedId.ZoneTwentyOne },
|
||||
{ LedId.LedStripe22, SteelSeriesLedId.ZoneTwentyTwo },
|
||||
{ LedId.LedStripe23, SteelSeriesLedId.ZoneTwentyThree },
|
||||
{ LedId.LedStripe24, SteelSeriesLedId.ZoneTwentyFour },
|
||||
{ LedId.LedStripe25, SteelSeriesLedId.ZoneTwentyFive },
|
||||
{ LedId.LedStripe26, SteelSeriesLedId.ZoneTwentySix },
|
||||
{ LedId.LedStripe27, SteelSeriesLedId.ZoneTwentySeven },
|
||||
{ LedId.LedStripe28, SteelSeriesLedId.ZoneTwentyEight },
|
||||
{ LedId.LedStripe29, SteelSeriesLedId.ZoneTwentyNine },
|
||||
{ LedId.LedStripe30, SteelSeriesLedId.ZoneThirty },
|
||||
{ LedId.LedStripe31, SteelSeriesLedId.ZoneThirtyOne },
|
||||
{ LedId.LedStripe32, SteelSeriesLedId.ZoneThirtyTwo },
|
||||
{ LedId.LedStripe33, SteelSeriesLedId.ZoneThirtyThree },
|
||||
{ LedId.LedStripe34, SteelSeriesLedId.ZoneThirtyFour },
|
||||
{ LedId.LedStripe35, SteelSeriesLedId.ZoneThirtyFive },
|
||||
{ LedId.LedStripe36, SteelSeriesLedId.ZoneThirtySix },
|
||||
{ LedId.LedStripe37, SteelSeriesLedId.ZoneThirtySeven },
|
||||
{ LedId.LedStripe38, SteelSeriesLedId.ZoneThirtyEight },
|
||||
{ LedId.LedStripe39, SteelSeriesLedId.ZoneThirtyNine },
|
||||
{ LedId.LedStripe40, SteelSeriesLedId.ZoneForty },
|
||||
{ LedId.LedStripe41, SteelSeriesLedId.ZoneFortyOne },
|
||||
{ LedId.LedStripe42, SteelSeriesLedId.ZoneFortyTwo },
|
||||
{ LedId.LedStripe43, SteelSeriesLedId.ZoneFortyThree },
|
||||
{ LedId.LedStripe44, SteelSeriesLedId.ZoneFortyFour },
|
||||
{ LedId.LedStripe45, SteelSeriesLedId.ZoneFortyFive },
|
||||
{ LedId.LedStripe46, SteelSeriesLedId.ZoneFortySix },
|
||||
{ LedId.LedStripe47, SteelSeriesLedId.ZoneFortySeven },
|
||||
{ LedId.LedStripe48, SteelSeriesLedId.ZoneFortyEight },
|
||||
{ LedId.LedStripe49, SteelSeriesLedId.ZoneFortyNine },
|
||||
{ LedId.LedStripe50, SteelSeriesLedId.ZoneFifty },
|
||||
{ LedId.LedStripe51, SteelSeriesLedId.ZoneFiftyOne },
|
||||
{ LedId.LedStripe52, SteelSeriesLedId.ZoneFiftyTwo },
|
||||
{ LedId.LedStripe53, SteelSeriesLedId.ZoneFiftyThree },
|
||||
{ LedId.LedStripe54, SteelSeriesLedId.ZoneFiftyFour },
|
||||
{ LedId.LedStripe55, SteelSeriesLedId.ZoneFiftyFive },
|
||||
{ LedId.LedStripe56, SteelSeriesLedId.ZoneFiftySix },
|
||||
{ LedId.LedStripe57, SteelSeriesLedId.ZoneFiftySeven },
|
||||
{ LedId.LedStripe58, SteelSeriesLedId.ZoneFiftyEight },
|
||||
{ LedId.LedStripe59, SteelSeriesLedId.ZoneFiftyNine },
|
||||
{ LedId.LedStripe60, SteelSeriesLedId.ZoneSixty },
|
||||
{ LedId.LedStripe61, SteelSeriesLedId.ZoneSixtyOne },
|
||||
{ LedId.LedStripe62, SteelSeriesLedId.ZoneSixtyTwo },
|
||||
{ LedId.LedStripe63, SteelSeriesLedId.ZoneSixtyThree },
|
||||
{ LedId.LedStripe64, SteelSeriesLedId.ZoneSixtyFour },
|
||||
{ LedId.LedStripe65, SteelSeriesLedId.ZoneSixtyFive },
|
||||
{ LedId.LedStripe66, SteelSeriesLedId.ZoneSixtySix },
|
||||
{ LedId.LedStripe67, SteelSeriesLedId.ZoneSixtySeven },
|
||||
{ LedId.LedStripe68, SteelSeriesLedId.ZoneSixtyEight },
|
||||
{ LedId.LedStripe69, SteelSeriesLedId.ZoneSixtyNine },
|
||||
{ LedId.LedStripe70, SteelSeriesLedId.ZoneSeventy },
|
||||
{ LedId.LedStripe71, SteelSeriesLedId.ZoneSeventyOne },
|
||||
{ LedId.LedStripe72, SteelSeriesLedId.ZoneSeventyTwo },
|
||||
{ LedId.LedStripe73, SteelSeriesLedId.ZoneSeventyThree },
|
||||
{ LedId.LedStripe74, SteelSeriesLedId.ZoneSeventyFour },
|
||||
{ LedId.LedStripe75, SteelSeriesLedId.ZoneSeventyFive },
|
||||
{ LedId.LedStripe76, SteelSeriesLedId.ZoneSeventySix },
|
||||
{ LedId.LedStripe77, SteelSeriesLedId.ZoneSeventySeven },
|
||||
{ LedId.LedStripe78, SteelSeriesLedId.ZoneSeventyEight },
|
||||
{ LedId.LedStripe79, SteelSeriesLedId.ZoneSeventyNine },
|
||||
{ LedId.LedStripe80, SteelSeriesLedId.ZoneEighty },
|
||||
{ LedId.LedStripe81, SteelSeriesLedId.ZoneEightyOne },
|
||||
{ LedId.LedStripe82, SteelSeriesLedId.ZoneEightyTwo },
|
||||
{ LedId.LedStripe83, SteelSeriesLedId.ZoneEightyThree },
|
||||
{ LedId.LedStripe84, SteelSeriesLedId.ZoneEightyFour },
|
||||
{ LedId.LedStripe85, SteelSeriesLedId.ZoneEightyFive },
|
||||
{ LedId.LedStripe86, SteelSeriesLedId.ZoneEightySix },
|
||||
{ LedId.LedStripe87, SteelSeriesLedId.ZoneEightySeven },
|
||||
{ LedId.LedStripe88, SteelSeriesLedId.ZoneEightyEight },
|
||||
{ LedId.LedStripe89, SteelSeriesLedId.ZoneEightyNine },
|
||||
{ LedId.LedStripe90, SteelSeriesLedId.ZoneNinety },
|
||||
{ LedId.LedStripe91, SteelSeriesLedId.ZoneNinetyOne },
|
||||
{ LedId.LedStripe92, SteelSeriesLedId.ZoneNinetyTwo },
|
||||
{ LedId.LedStripe93, SteelSeriesLedId.ZoneNinetyThree },
|
||||
{ LedId.LedStripe94, SteelSeriesLedId.ZoneNinetyFour },
|
||||
{ LedId.LedStripe95, SteelSeriesLedId.ZoneNinetyFive },
|
||||
{ LedId.LedStripe96, SteelSeriesLedId.ZoneNinetySix },
|
||||
{ LedId.LedStripe97, SteelSeriesLedId.ZoneNinetySeven },
|
||||
{ LedId.LedStripe98, SteelSeriesLedId.ZoneNinetyEight },
|
||||
{ LedId.LedStripe99, SteelSeriesLedId.ZoneNinetyNine },
|
||||
{ LedId.LedStripe100, SteelSeriesLedId.ZoneOneHundred },
|
||||
{ LedId.LedStripe101, SteelSeriesLedId.ZoneOneHundredOne },
|
||||
{ LedId.LedStripe102, SteelSeriesLedId.ZoneOneHundredTwo },
|
||||
{ LedId.LedStripe103, SteelSeriesLedId.ZoneOneHundredThree }
|
||||
};
|
||||
|
||||
private const int VENDOR_ID = 0x1038;
|
||||
|
||||
//TODO DarthAffe 16.02.2019: Add devices
|
||||
private static readonly DeviceDataList DEVICES = new()
|
||||
{
|
||||
//Mice
|
||||
("Aerox 3", RGBDeviceType.Mouse, 0x1836, SteelSeriesDeviceType.ThreeZone, MOUSE_THREE_ZONE),
|
||||
("Aerox 3 Wireless", RGBDeviceType.Mouse, 0x183A, SteelSeriesDeviceType.ThreeZone, MOUSE_THREE_ZONE),
|
||||
("Rival 100", RGBDeviceType.Mouse, 0x1702, SteelSeriesDeviceType.OneZone, MOUSE_ONE_ZONE),
|
||||
("Rival 105", RGBDeviceType.Mouse, 0x1814, SteelSeriesDeviceType.OneZone, MOUSE_ONE_ZONE),
|
||||
("Rival 106", RGBDeviceType.Mouse, 0x1816, SteelSeriesDeviceType.OneZone, MOUSE_ONE_ZONE),
|
||||
("Rival 110", RGBDeviceType.Mouse, 0x1729, SteelSeriesDeviceType.OneZone, MOUSE_ONE_ZONE),
|
||||
("Rival 150", RGBDeviceType.Mouse, 0x0472, SteelSeriesDeviceType.OneZone, MOUSE_ONE_ZONE),
|
||||
("Rival 300", RGBDeviceType.Mouse, 0x1710, SteelSeriesDeviceType.TwoZone, MOUSE_TWO_ZONE),
|
||||
("Rival 310", RGBDeviceType.Mouse, 0x1720, SteelSeriesDeviceType.TwoZone, MOUSE_TWO_ZONE),
|
||||
("Rival 500", RGBDeviceType.Mouse, 0x170E, SteelSeriesDeviceType.TwoZone, MOUSE_TWO_ZONE),
|
||||
("Rival 600", RGBDeviceType.Mouse, 0x1724, SteelSeriesDeviceType.EightZone, MOUSE_EIGHT_ZONE),
|
||||
("Rival 700", RGBDeviceType.Mouse, 0x1700, SteelSeriesDeviceType.TwoZone, MOUSE_TWO_ZONE),
|
||||
("Rival 3 (Old Firmware)", RGBDeviceType.Mouse, 0x1824, SteelSeriesDeviceType.ThreeZone, MOUSE_THREE_ZONE),
|
||||
("Rival 3", RGBDeviceType.Mouse, 0x184C, SteelSeriesDeviceType.ThreeZone, MOUSE_THREE_ZONE),
|
||||
("Rival 3 Wireless", RGBDeviceType.Mouse, 0x1830, SteelSeriesDeviceType.ThreeZone, MOUSE_THREE_ZONE),
|
||||
("Sensei Ten", RGBDeviceType.Mouse, 0x1832, SteelSeriesDeviceType.TwoZone, MOUSE_TWO_ZONE),
|
||||
|
||||
//Keyboards
|
||||
("Apex 5", RGBDeviceType.Keyboard, 0x161C, SteelSeriesDeviceType.PerKey, KEYBOARD_MAPPING_UK),
|
||||
("Apex 7", RGBDeviceType.Keyboard, 0x1612, SteelSeriesDeviceType.PerKey, KEYBOARD_MAPPING_UK),
|
||||
("Apex 7 TKL", RGBDeviceType.Keyboard, 0x1618, SteelSeriesDeviceType.PerKey, KEYBOARD_TKL_MAPPING_UK),
|
||||
("Apex M750", RGBDeviceType.Keyboard, 0x0616, SteelSeriesDeviceType.PerKey, KEYBOARD_MAPPING_UK),
|
||||
("Apex M800", RGBDeviceType.Keyboard, 0x1600, SteelSeriesDeviceType.PerKey, KEYBOARD_MAPPING_UK),
|
||||
("Apex Pro", RGBDeviceType.Keyboard, 0x1610, SteelSeriesDeviceType.PerKey, KEYBOARD_MAPPING_UK),
|
||||
("Apex Pro TKL", RGBDeviceType.Keyboard, 0x1614, SteelSeriesDeviceType.PerKey, KEYBOARD_TKL_MAPPING_UK),
|
||||
|
||||
//Headsets
|
||||
("Arctis 5", RGBDeviceType.Headset, 0x12AA, SteelSeriesDeviceType.TwoZone, HEADSET_TWO_ZONE),
|
||||
("Arctis 5 Game", RGBDeviceType.Headset, 0x1250, SteelSeriesDeviceType.TwoZone, HEADSET_TWO_ZONE),
|
||||
("Arctis 5 Game - Dota 2 edition", RGBDeviceType.Headset, 0x1251, SteelSeriesDeviceType.TwoZone, HEADSET_TWO_ZONE),
|
||||
("Arctis 5 Game - PUBG edition", RGBDeviceType.Headset, 0x12A8, SteelSeriesDeviceType.TwoZone, HEADSET_TWO_ZONE),
|
||||
("Arctis Pro Game", RGBDeviceType.Headset, 0x1252, SteelSeriesDeviceType.TwoZone, HEADSET_TWO_ZONE),
|
||||
|
||||
//Mousepads
|
||||
("QCK Prism", RGBDeviceType.Mousepad, 0x1507, SteelSeriesDeviceType.TwelveZone, MOUSEPAD_TWELVE_ZONE),
|
||||
|
||||
//Monitors
|
||||
("MGP27C", RGBDeviceType.Monitor, 0x1126, SteelSeriesDeviceType.OneHundredAndThreeZone, MONITOR_ONEHUNDREDANDTHREE_ZONE),
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties & Fields
|
||||
|
||||
public static DeviceDataList ConnectedDevices { get; } = new();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
internal static void LoadDeviceList(RGBDeviceType loadFilter)
|
||||
{
|
||||
ConnectedDevices.Clear();
|
||||
|
||||
HashSet<int> ids = new(DeviceList.Local.GetHidDevices(VENDOR_ID).Select(x => x.ProductID).Distinct());
|
||||
DeviceDataList connectedDevices = DEVICES.Where(d => ids.Contains(d.id) && loadFilter.HasFlag(d.deviceType)).ToList();
|
||||
|
||||
List<SteelSeriesDeviceType> connectedDeviceTypes = connectedDevices.Select(d => d.steelSeriesDeviceType).ToList();
|
||||
foreach (SteelSeriesDeviceType deviceType in connectedDeviceTypes)
|
||||
ConnectedDevices.Add(connectedDevices.Where(d => d.steelSeriesDeviceType == deviceType).OrderByDescending(d => d.ledMapping.Count).First());
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Devices.SteelSeries
|
||||
{
|
||||
public static class LedMappings
|
||||
{
|
||||
public static LedMapping<SteelSeriesLedId> KeyboardMappingUk { get; } = new()
|
||||
{
|
||||
{ LedId.Logo, SteelSeriesLedId.Logo },
|
||||
{ LedId.Keyboard_Escape, SteelSeriesLedId.Escape },
|
||||
{ LedId.Keyboard_F1, SteelSeriesLedId.F1 },
|
||||
{ LedId.Keyboard_F2, SteelSeriesLedId.F2 },
|
||||
{ LedId.Keyboard_F3, SteelSeriesLedId.F3 },
|
||||
{ LedId.Keyboard_F4, SteelSeriesLedId.F4 },
|
||||
{ LedId.Keyboard_F5, SteelSeriesLedId.F5 },
|
||||
{ LedId.Keyboard_F6, SteelSeriesLedId.F6 },
|
||||
{ LedId.Keyboard_F7, SteelSeriesLedId.F7 },
|
||||
{ LedId.Keyboard_F8, SteelSeriesLedId.F8 },
|
||||
{ LedId.Keyboard_F9, SteelSeriesLedId.F9 },
|
||||
{ LedId.Keyboard_F10, SteelSeriesLedId.F10 },
|
||||
{ LedId.Keyboard_F11, SteelSeriesLedId.F11 },
|
||||
{ LedId.Keyboard_GraveAccentAndTilde, SteelSeriesLedId.Backqoute },
|
||||
{ LedId.Keyboard_1, SteelSeriesLedId.Keyboard1 },
|
||||
{ LedId.Keyboard_2, SteelSeriesLedId.Keyboard2 },
|
||||
{ LedId.Keyboard_3, SteelSeriesLedId.Keyboard3 },
|
||||
{ LedId.Keyboard_4, SteelSeriesLedId.Keyboard4 },
|
||||
{ LedId.Keyboard_5, SteelSeriesLedId.Keyboard5 },
|
||||
{ LedId.Keyboard_6, SteelSeriesLedId.Keyboard6 },
|
||||
{ LedId.Keyboard_7, SteelSeriesLedId.Keyboard7 },
|
||||
{ LedId.Keyboard_8, SteelSeriesLedId.Keyboard8 },
|
||||
{ LedId.Keyboard_9, SteelSeriesLedId.Keyboard9 },
|
||||
{ LedId.Keyboard_0, SteelSeriesLedId.Keyboard0 },
|
||||
{ LedId.Keyboard_MinusAndUnderscore, SteelSeriesLedId.Dash },
|
||||
{ LedId.Keyboard_Tab, SteelSeriesLedId.Tab },
|
||||
{ LedId.Keyboard_Q, SteelSeriesLedId.Q },
|
||||
{ LedId.Keyboard_W, SteelSeriesLedId.W },
|
||||
{ LedId.Keyboard_E, SteelSeriesLedId.E },
|
||||
{ LedId.Keyboard_R, SteelSeriesLedId.R },
|
||||
{ LedId.Keyboard_T, SteelSeriesLedId.T },
|
||||
{ LedId.Keyboard_Y, SteelSeriesLedId.Y },
|
||||
{ LedId.Keyboard_U, SteelSeriesLedId.U },
|
||||
{ LedId.Keyboard_I, SteelSeriesLedId.I },
|
||||
{ LedId.Keyboard_O, SteelSeriesLedId.O },
|
||||
{ LedId.Keyboard_P, SteelSeriesLedId.P },
|
||||
{ LedId.Keyboard_BracketLeft, SteelSeriesLedId.LBracket },
|
||||
{ LedId.Keyboard_CapsLock, SteelSeriesLedId.Caps },
|
||||
{ LedId.Keyboard_A, SteelSeriesLedId.A },
|
||||
{ LedId.Keyboard_S, SteelSeriesLedId.S },
|
||||
{ LedId.Keyboard_D, SteelSeriesLedId.D },
|
||||
{ LedId.Keyboard_F, SteelSeriesLedId.F },
|
||||
{ LedId.Keyboard_G, SteelSeriesLedId.G },
|
||||
{ LedId.Keyboard_H, SteelSeriesLedId.H },
|
||||
{ LedId.Keyboard_J, SteelSeriesLedId.J },
|
||||
{ LedId.Keyboard_K, SteelSeriesLedId.K },
|
||||
{ LedId.Keyboard_L, SteelSeriesLedId.L },
|
||||
{ LedId.Keyboard_SemicolonAndColon, SteelSeriesLedId.Semicolon },
|
||||
{ LedId.Keyboard_ApostropheAndDoubleQuote, SteelSeriesLedId.Quote },
|
||||
{ LedId.Keyboard_LeftShift, SteelSeriesLedId.LShift },
|
||||
{ LedId.Keyboard_NonUsTilde, SteelSeriesLedId.Pound },
|
||||
{ LedId.Keyboard_Z, SteelSeriesLedId.Z },
|
||||
{ LedId.Keyboard_X, SteelSeriesLedId.X },
|
||||
{ LedId.Keyboard_C, SteelSeriesLedId.C },
|
||||
{ LedId.Keyboard_V, SteelSeriesLedId.V },
|
||||
{ LedId.Keyboard_B, SteelSeriesLedId.B },
|
||||
{ LedId.Keyboard_N, SteelSeriesLedId.N },
|
||||
{ LedId.Keyboard_M, SteelSeriesLedId.M },
|
||||
{ LedId.Keyboard_CommaAndLessThan, SteelSeriesLedId.Comma },
|
||||
{ LedId.Keyboard_PeriodAndBiggerThan, SteelSeriesLedId.Period },
|
||||
{ LedId.Keyboard_SlashAndQuestionMark, SteelSeriesLedId.Slash },
|
||||
{ LedId.Keyboard_LeftCtrl, SteelSeriesLedId.LCtrl },
|
||||
{ LedId.Keyboard_LeftGui, SteelSeriesLedId.LWin },
|
||||
{ LedId.Keyboard_LeftAlt, SteelSeriesLedId.LAlt },
|
||||
{ LedId.Keyboard_Space, SteelSeriesLedId.Spacebar },
|
||||
{ LedId.Keyboard_RightAlt, SteelSeriesLedId.RAlt },
|
||||
{ LedId.Keyboard_RightGui, SteelSeriesLedId.RWin },
|
||||
{ LedId.Keyboard_Application, SteelSeriesLedId.SSKey },
|
||||
{ LedId.Keyboard_F12, SteelSeriesLedId.F12 },
|
||||
{ LedId.Keyboard_PrintScreen, SteelSeriesLedId.PrintScreen },
|
||||
{ LedId.Keyboard_ScrollLock, SteelSeriesLedId.ScrollLock },
|
||||
{ LedId.Keyboard_PauseBreak, SteelSeriesLedId.Pause },
|
||||
{ LedId.Keyboard_Insert, SteelSeriesLedId.Insert },
|
||||
{ LedId.Keyboard_Home, SteelSeriesLedId.Home },
|
||||
{ LedId.Keyboard_PageUp, SteelSeriesLedId.PageUp },
|
||||
{ LedId.Keyboard_BracketRight, SteelSeriesLedId.RBracket },
|
||||
{ LedId.Keyboard_Backslash, SteelSeriesLedId.Backslash },
|
||||
{ LedId.Keyboard_Enter, SteelSeriesLedId.Return },
|
||||
{ LedId.Keyboard_EqualsAndPlus, SteelSeriesLedId.Equal },
|
||||
{ LedId.Keyboard_Backspace, SteelSeriesLedId.Backspace },
|
||||
{ LedId.Keyboard_Delete, SteelSeriesLedId.Delete },
|
||||
{ LedId.Keyboard_End, SteelSeriesLedId.End },
|
||||
{ LedId.Keyboard_PageDown, SteelSeriesLedId.PageDown },
|
||||
{ LedId.Keyboard_RightShift, SteelSeriesLedId.RShift },
|
||||
{ LedId.Keyboard_RightCtrl, SteelSeriesLedId.RCtrl },
|
||||
{ LedId.Keyboard_ArrowUp, SteelSeriesLedId.UpArrow },
|
||||
{ LedId.Keyboard_ArrowLeft, SteelSeriesLedId.LeftArrow },
|
||||
{ LedId.Keyboard_ArrowDown, SteelSeriesLedId.DownArrow },
|
||||
{ LedId.Keyboard_ArrowRight, SteelSeriesLedId.RightArrow },
|
||||
{ LedId.Keyboard_NumLock, SteelSeriesLedId.KeypadNumLock },
|
||||
{ LedId.Keyboard_NumSlash, SteelSeriesLedId.KeypadDivide },
|
||||
{ LedId.Keyboard_NumAsterisk, SteelSeriesLedId.KeypadTimes },
|
||||
{ LedId.Keyboard_NumMinus, SteelSeriesLedId.KeypadMinus },
|
||||
{ LedId.Keyboard_NumPlus, SteelSeriesLedId.KeypadPlus },
|
||||
{ LedId.Keyboard_NumEnter, SteelSeriesLedId.KeypadEnter },
|
||||
{ LedId.Keyboard_Num7, SteelSeriesLedId.Keypad7 },
|
||||
{ LedId.Keyboard_Num8, SteelSeriesLedId.Keypad8 },
|
||||
{ LedId.Keyboard_Num9, SteelSeriesLedId.Keypad9 },
|
||||
{ LedId.Keyboard_Num4, SteelSeriesLedId.Keypad4 },
|
||||
{ LedId.Keyboard_Num5, SteelSeriesLedId.Keypad5 },
|
||||
{ LedId.Keyboard_Num6, SteelSeriesLedId.Keypad6 },
|
||||
{ LedId.Keyboard_Num1, SteelSeriesLedId.Keypad1 },
|
||||
{ LedId.Keyboard_Num2, SteelSeriesLedId.Keypad2 },
|
||||
{ LedId.Keyboard_Num3, SteelSeriesLedId.Keypad3 },
|
||||
{ LedId.Keyboard_Num0, SteelSeriesLedId.Keypad0 },
|
||||
{ LedId.Keyboard_NumPeriodAndDelete, SteelSeriesLedId.KeypadPeriod }
|
||||
};
|
||||
|
||||
public static LedMapping<SteelSeriesLedId> KeyboardTklMappingUk { get; } = new()
|
||||
{
|
||||
{ LedId.Logo, SteelSeriesLedId.Logo },
|
||||
{ LedId.Keyboard_Escape, SteelSeriesLedId.Escape },
|
||||
{ LedId.Keyboard_F1, SteelSeriesLedId.F1 },
|
||||
{ LedId.Keyboard_F2, SteelSeriesLedId.F2 },
|
||||
{ LedId.Keyboard_F3, SteelSeriesLedId.F3 },
|
||||
{ LedId.Keyboard_F4, SteelSeriesLedId.F4 },
|
||||
{ LedId.Keyboard_F5, SteelSeriesLedId.F5 },
|
||||
{ LedId.Keyboard_F6, SteelSeriesLedId.F6 },
|
||||
{ LedId.Keyboard_F7, SteelSeriesLedId.F7 },
|
||||
{ LedId.Keyboard_F8, SteelSeriesLedId.F8 },
|
||||
{ LedId.Keyboard_F9, SteelSeriesLedId.F9 },
|
||||
{ LedId.Keyboard_F10, SteelSeriesLedId.F10 },
|
||||
{ LedId.Keyboard_F11, SteelSeriesLedId.F11 },
|
||||
{ LedId.Keyboard_GraveAccentAndTilde, SteelSeriesLedId.Backqoute },
|
||||
{ LedId.Keyboard_1, SteelSeriesLedId.Keyboard1 },
|
||||
{ LedId.Keyboard_2, SteelSeriesLedId.Keyboard2 },
|
||||
{ LedId.Keyboard_3, SteelSeriesLedId.Keyboard3 },
|
||||
{ LedId.Keyboard_4, SteelSeriesLedId.Keyboard4 },
|
||||
{ LedId.Keyboard_5, SteelSeriesLedId.Keyboard5 },
|
||||
{ LedId.Keyboard_6, SteelSeriesLedId.Keyboard6 },
|
||||
{ LedId.Keyboard_7, SteelSeriesLedId.Keyboard7 },
|
||||
{ LedId.Keyboard_8, SteelSeriesLedId.Keyboard8 },
|
||||
{ LedId.Keyboard_9, SteelSeriesLedId.Keyboard9 },
|
||||
{ LedId.Keyboard_0, SteelSeriesLedId.Keyboard0 },
|
||||
{ LedId.Keyboard_MinusAndUnderscore, SteelSeriesLedId.Dash },
|
||||
{ LedId.Keyboard_Tab, SteelSeriesLedId.Tab },
|
||||
{ LedId.Keyboard_Q, SteelSeriesLedId.Q },
|
||||
{ LedId.Keyboard_W, SteelSeriesLedId.W },
|
||||
{ LedId.Keyboard_E, SteelSeriesLedId.E },
|
||||
{ LedId.Keyboard_R, SteelSeriesLedId.R },
|
||||
{ LedId.Keyboard_T, SteelSeriesLedId.T },
|
||||
{ LedId.Keyboard_Y, SteelSeriesLedId.Y },
|
||||
{ LedId.Keyboard_U, SteelSeriesLedId.U },
|
||||
{ LedId.Keyboard_I, SteelSeriesLedId.I },
|
||||
{ LedId.Keyboard_O, SteelSeriesLedId.O },
|
||||
{ LedId.Keyboard_P, SteelSeriesLedId.P },
|
||||
{ LedId.Keyboard_BracketLeft, SteelSeriesLedId.LBracket },
|
||||
{ LedId.Keyboard_CapsLock, SteelSeriesLedId.Caps },
|
||||
{ LedId.Keyboard_A, SteelSeriesLedId.A },
|
||||
{ LedId.Keyboard_S, SteelSeriesLedId.S },
|
||||
{ LedId.Keyboard_D, SteelSeriesLedId.D },
|
||||
{ LedId.Keyboard_F, SteelSeriesLedId.F },
|
||||
{ LedId.Keyboard_G, SteelSeriesLedId.G },
|
||||
{ LedId.Keyboard_H, SteelSeriesLedId.H },
|
||||
{ LedId.Keyboard_J, SteelSeriesLedId.J },
|
||||
{ LedId.Keyboard_K, SteelSeriesLedId.K },
|
||||
{ LedId.Keyboard_L, SteelSeriesLedId.L },
|
||||
{ LedId.Keyboard_SemicolonAndColon, SteelSeriesLedId.Semicolon },
|
||||
{ LedId.Keyboard_ApostropheAndDoubleQuote, SteelSeriesLedId.Quote },
|
||||
{ LedId.Keyboard_LeftShift, SteelSeriesLedId.LShift },
|
||||
{ LedId.Keyboard_NonUsTilde, SteelSeriesLedId.Pound },
|
||||
{ LedId.Keyboard_Z, SteelSeriesLedId.Z },
|
||||
{ LedId.Keyboard_X, SteelSeriesLedId.X },
|
||||
{ LedId.Keyboard_C, SteelSeriesLedId.C },
|
||||
{ LedId.Keyboard_V, SteelSeriesLedId.V },
|
||||
{ LedId.Keyboard_B, SteelSeriesLedId.B },
|
||||
{ LedId.Keyboard_N, SteelSeriesLedId.N },
|
||||
{ LedId.Keyboard_M, SteelSeriesLedId.M },
|
||||
{ LedId.Keyboard_CommaAndLessThan, SteelSeriesLedId.Comma },
|
||||
{ LedId.Keyboard_PeriodAndBiggerThan, SteelSeriesLedId.Period },
|
||||
{ LedId.Keyboard_SlashAndQuestionMark, SteelSeriesLedId.Slash },
|
||||
{ LedId.Keyboard_LeftCtrl, SteelSeriesLedId.LCtrl },
|
||||
{ LedId.Keyboard_LeftGui, SteelSeriesLedId.LWin },
|
||||
{ LedId.Keyboard_LeftAlt, SteelSeriesLedId.LAlt },
|
||||
{ LedId.Keyboard_Space, SteelSeriesLedId.Spacebar },
|
||||
{ LedId.Keyboard_RightAlt, SteelSeriesLedId.RAlt },
|
||||
{ LedId.Keyboard_RightGui, SteelSeriesLedId.RWin },
|
||||
{ LedId.Keyboard_Application, SteelSeriesLedId.SSKey },
|
||||
{ LedId.Keyboard_F12, SteelSeriesLedId.F12 },
|
||||
{ LedId.Keyboard_PrintScreen, SteelSeriesLedId.PrintScreen },
|
||||
{ LedId.Keyboard_ScrollLock, SteelSeriesLedId.ScrollLock },
|
||||
{ LedId.Keyboard_PauseBreak, SteelSeriesLedId.Pause },
|
||||
{ LedId.Keyboard_Insert, SteelSeriesLedId.Insert },
|
||||
{ LedId.Keyboard_Home, SteelSeriesLedId.Home },
|
||||
{ LedId.Keyboard_PageUp, SteelSeriesLedId.PageUp },
|
||||
{ LedId.Keyboard_BracketRight, SteelSeriesLedId.RBracket },
|
||||
{ LedId.Keyboard_Backslash, SteelSeriesLedId.Backslash },
|
||||
{ LedId.Keyboard_Enter, SteelSeriesLedId.Return },
|
||||
{ LedId.Keyboard_EqualsAndPlus, SteelSeriesLedId.Equal },
|
||||
{ LedId.Keyboard_Backspace, SteelSeriesLedId.Backspace },
|
||||
{ LedId.Keyboard_Delete, SteelSeriesLedId.Delete },
|
||||
{ LedId.Keyboard_End, SteelSeriesLedId.End },
|
||||
{ LedId.Keyboard_PageDown, SteelSeriesLedId.PageDown },
|
||||
{ LedId.Keyboard_RightShift, SteelSeriesLedId.RShift },
|
||||
{ LedId.Keyboard_RightCtrl, SteelSeriesLedId.RCtrl },
|
||||
{ LedId.Keyboard_ArrowUp, SteelSeriesLedId.UpArrow },
|
||||
{ LedId.Keyboard_ArrowLeft, SteelSeriesLedId.LeftArrow },
|
||||
{ LedId.Keyboard_ArrowDown, SteelSeriesLedId.DownArrow },
|
||||
{ LedId.Keyboard_ArrowRight, SteelSeriesLedId.RightArrow }
|
||||
};
|
||||
|
||||
public static LedMapping<SteelSeriesLedId> MouseOneZone { get; } = new()
|
||||
{
|
||||
{ LedId.Mouse1, SteelSeriesLedId.ZoneOne }
|
||||
};
|
||||
|
||||
public static LedMapping<SteelSeriesLedId> MouseTwoZone { get; } = new()
|
||||
{
|
||||
{ LedId.Mouse1, SteelSeriesLedId.ZoneOne },
|
||||
{ LedId.Mouse2, SteelSeriesLedId.ZoneTwo }
|
||||
};
|
||||
|
||||
public static LedMapping<SteelSeriesLedId> MouseThreeZone { get; } = new()
|
||||
{
|
||||
{ LedId.Mouse1, SteelSeriesLedId.ZoneOne },
|
||||
{ LedId.Mouse2, SteelSeriesLedId.ZoneTwo },
|
||||
{ LedId.Mouse3, SteelSeriesLedId.ZoneThree }
|
||||
};
|
||||
|
||||
public static LedMapping<SteelSeriesLedId> MouseEightZone { get; } = new()
|
||||
{
|
||||
{ LedId.Mouse1, SteelSeriesLedId.ZoneOne },
|
||||
{ LedId.Mouse2, SteelSeriesLedId.ZoneTwo },
|
||||
{ LedId.Mouse3, SteelSeriesLedId.ZoneThree },
|
||||
{ LedId.Mouse4, SteelSeriesLedId.ZoneFour },
|
||||
{ LedId.Mouse5, SteelSeriesLedId.ZoneFive },
|
||||
{ LedId.Mouse6, SteelSeriesLedId.ZoneSix },
|
||||
{ LedId.Mouse7, SteelSeriesLedId.ZoneSeven },
|
||||
{ LedId.Mouse8, SteelSeriesLedId.ZoneEight }
|
||||
};
|
||||
|
||||
public static LedMapping<SteelSeriesLedId> HeadsetTwoZone { get; } = new()
|
||||
{
|
||||
{ LedId.Headset1, SteelSeriesLedId.ZoneOne },
|
||||
{ LedId.Headset2, SteelSeriesLedId.ZoneTwo }
|
||||
};
|
||||
|
||||
public static LedMapping<SteelSeriesLedId> MousepadTwelveZone { get; } = new()
|
||||
{
|
||||
{ LedId.Mousepad1, SteelSeriesLedId.ZoneOne },
|
||||
{ LedId.Mousepad2, SteelSeriesLedId.ZoneTwo },
|
||||
{ LedId.Mousepad3, SteelSeriesLedId.ZoneThree },
|
||||
{ LedId.Mousepad4, SteelSeriesLedId.ZoneFour },
|
||||
{ LedId.Mousepad5, SteelSeriesLedId.ZoneFive },
|
||||
{ LedId.Mousepad6, SteelSeriesLedId.ZoneSix },
|
||||
{ LedId.Mousepad7, SteelSeriesLedId.ZoneSeven },
|
||||
{ LedId.Mousepad8, SteelSeriesLedId.ZoneEight },
|
||||
{ LedId.Mousepad9, SteelSeriesLedId.ZoneNine },
|
||||
{ LedId.Mousepad10, SteelSeriesLedId.ZoneTen },
|
||||
{ LedId.Mousepad11, SteelSeriesLedId.ZoneEleven },
|
||||
{ LedId.Mousepad12, SteelSeriesLedId.ZoneTwelve },
|
||||
};
|
||||
|
||||
public static LedMapping<SteelSeriesLedId> MonitorOnehundredandthreeZone { get; } = new()
|
||||
{
|
||||
{ LedId.LedStripe1, SteelSeriesLedId.ZoneOne },
|
||||
{ LedId.LedStripe2, SteelSeriesLedId.ZoneTwo },
|
||||
{ LedId.LedStripe3, SteelSeriesLedId.ZoneThree },
|
||||
{ LedId.LedStripe4, SteelSeriesLedId.ZoneFour },
|
||||
{ LedId.LedStripe5, SteelSeriesLedId.ZoneFive },
|
||||
{ LedId.LedStripe6, SteelSeriesLedId.ZoneSix },
|
||||
{ LedId.LedStripe7, SteelSeriesLedId.ZoneSeven },
|
||||
{ LedId.LedStripe8, SteelSeriesLedId.ZoneEight },
|
||||
{ LedId.LedStripe9, SteelSeriesLedId.ZoneNine },
|
||||
{ LedId.LedStripe10, SteelSeriesLedId.ZoneTen },
|
||||
{ LedId.LedStripe11, SteelSeriesLedId.ZoneEleven },
|
||||
{ LedId.LedStripe12, SteelSeriesLedId.ZoneTwelve },
|
||||
{ LedId.LedStripe13, SteelSeriesLedId.ZoneThirteen },
|
||||
{ LedId.LedStripe14, SteelSeriesLedId.ZoneFourteen },
|
||||
{ LedId.LedStripe15, SteelSeriesLedId.ZoneFifteen },
|
||||
{ LedId.LedStripe16, SteelSeriesLedId.ZoneSixteen },
|
||||
{ LedId.LedStripe17, SteelSeriesLedId.ZoneSeventeen },
|
||||
{ LedId.LedStripe18, SteelSeriesLedId.ZoneEighteen },
|
||||
{ LedId.LedStripe19, SteelSeriesLedId.ZoneNineteen },
|
||||
{ LedId.LedStripe20, SteelSeriesLedId.ZoneTwenty },
|
||||
{ LedId.LedStripe21, SteelSeriesLedId.ZoneTwentyOne },
|
||||
{ LedId.LedStripe22, SteelSeriesLedId.ZoneTwentyTwo },
|
||||
{ LedId.LedStripe23, SteelSeriesLedId.ZoneTwentyThree },
|
||||
{ LedId.LedStripe24, SteelSeriesLedId.ZoneTwentyFour },
|
||||
{ LedId.LedStripe25, SteelSeriesLedId.ZoneTwentyFive },
|
||||
{ LedId.LedStripe26, SteelSeriesLedId.ZoneTwentySix },
|
||||
{ LedId.LedStripe27, SteelSeriesLedId.ZoneTwentySeven },
|
||||
{ LedId.LedStripe28, SteelSeriesLedId.ZoneTwentyEight },
|
||||
{ LedId.LedStripe29, SteelSeriesLedId.ZoneTwentyNine },
|
||||
{ LedId.LedStripe30, SteelSeriesLedId.ZoneThirty },
|
||||
{ LedId.LedStripe31, SteelSeriesLedId.ZoneThirtyOne },
|
||||
{ LedId.LedStripe32, SteelSeriesLedId.ZoneThirtyTwo },
|
||||
{ LedId.LedStripe33, SteelSeriesLedId.ZoneThirtyThree },
|
||||
{ LedId.LedStripe34, SteelSeriesLedId.ZoneThirtyFour },
|
||||
{ LedId.LedStripe35, SteelSeriesLedId.ZoneThirtyFive },
|
||||
{ LedId.LedStripe36, SteelSeriesLedId.ZoneThirtySix },
|
||||
{ LedId.LedStripe37, SteelSeriesLedId.ZoneThirtySeven },
|
||||
{ LedId.LedStripe38, SteelSeriesLedId.ZoneThirtyEight },
|
||||
{ LedId.LedStripe39, SteelSeriesLedId.ZoneThirtyNine },
|
||||
{ LedId.LedStripe40, SteelSeriesLedId.ZoneForty },
|
||||
{ LedId.LedStripe41, SteelSeriesLedId.ZoneFortyOne },
|
||||
{ LedId.LedStripe42, SteelSeriesLedId.ZoneFortyTwo },
|
||||
{ LedId.LedStripe43, SteelSeriesLedId.ZoneFortyThree },
|
||||
{ LedId.LedStripe44, SteelSeriesLedId.ZoneFortyFour },
|
||||
{ LedId.LedStripe45, SteelSeriesLedId.ZoneFortyFive },
|
||||
{ LedId.LedStripe46, SteelSeriesLedId.ZoneFortySix },
|
||||
{ LedId.LedStripe47, SteelSeriesLedId.ZoneFortySeven },
|
||||
{ LedId.LedStripe48, SteelSeriesLedId.ZoneFortyEight },
|
||||
{ LedId.LedStripe49, SteelSeriesLedId.ZoneFortyNine },
|
||||
{ LedId.LedStripe50, SteelSeriesLedId.ZoneFifty },
|
||||
{ LedId.LedStripe51, SteelSeriesLedId.ZoneFiftyOne },
|
||||
{ LedId.LedStripe52, SteelSeriesLedId.ZoneFiftyTwo },
|
||||
{ LedId.LedStripe53, SteelSeriesLedId.ZoneFiftyThree },
|
||||
{ LedId.LedStripe54, SteelSeriesLedId.ZoneFiftyFour },
|
||||
{ LedId.LedStripe55, SteelSeriesLedId.ZoneFiftyFive },
|
||||
{ LedId.LedStripe56, SteelSeriesLedId.ZoneFiftySix },
|
||||
{ LedId.LedStripe57, SteelSeriesLedId.ZoneFiftySeven },
|
||||
{ LedId.LedStripe58, SteelSeriesLedId.ZoneFiftyEight },
|
||||
{ LedId.LedStripe59, SteelSeriesLedId.ZoneFiftyNine },
|
||||
{ LedId.LedStripe60, SteelSeriesLedId.ZoneSixty },
|
||||
{ LedId.LedStripe61, SteelSeriesLedId.ZoneSixtyOne },
|
||||
{ LedId.LedStripe62, SteelSeriesLedId.ZoneSixtyTwo },
|
||||
{ LedId.LedStripe63, SteelSeriesLedId.ZoneSixtyThree },
|
||||
{ LedId.LedStripe64, SteelSeriesLedId.ZoneSixtyFour },
|
||||
{ LedId.LedStripe65, SteelSeriesLedId.ZoneSixtyFive },
|
||||
{ LedId.LedStripe66, SteelSeriesLedId.ZoneSixtySix },
|
||||
{ LedId.LedStripe67, SteelSeriesLedId.ZoneSixtySeven },
|
||||
{ LedId.LedStripe68, SteelSeriesLedId.ZoneSixtyEight },
|
||||
{ LedId.LedStripe69, SteelSeriesLedId.ZoneSixtyNine },
|
||||
{ LedId.LedStripe70, SteelSeriesLedId.ZoneSeventy },
|
||||
{ LedId.LedStripe71, SteelSeriesLedId.ZoneSeventyOne },
|
||||
{ LedId.LedStripe72, SteelSeriesLedId.ZoneSeventyTwo },
|
||||
{ LedId.LedStripe73, SteelSeriesLedId.ZoneSeventyThree },
|
||||
{ LedId.LedStripe74, SteelSeriesLedId.ZoneSeventyFour },
|
||||
{ LedId.LedStripe75, SteelSeriesLedId.ZoneSeventyFive },
|
||||
{ LedId.LedStripe76, SteelSeriesLedId.ZoneSeventySix },
|
||||
{ LedId.LedStripe77, SteelSeriesLedId.ZoneSeventySeven },
|
||||
{ LedId.LedStripe78, SteelSeriesLedId.ZoneSeventyEight },
|
||||
{ LedId.LedStripe79, SteelSeriesLedId.ZoneSeventyNine },
|
||||
{ LedId.LedStripe80, SteelSeriesLedId.ZoneEighty },
|
||||
{ LedId.LedStripe81, SteelSeriesLedId.ZoneEightyOne },
|
||||
{ LedId.LedStripe82, SteelSeriesLedId.ZoneEightyTwo },
|
||||
{ LedId.LedStripe83, SteelSeriesLedId.ZoneEightyThree },
|
||||
{ LedId.LedStripe84, SteelSeriesLedId.ZoneEightyFour },
|
||||
{ LedId.LedStripe85, SteelSeriesLedId.ZoneEightyFive },
|
||||
{ LedId.LedStripe86, SteelSeriesLedId.ZoneEightySix },
|
||||
{ LedId.LedStripe87, SteelSeriesLedId.ZoneEightySeven },
|
||||
{ LedId.LedStripe88, SteelSeriesLedId.ZoneEightyEight },
|
||||
{ LedId.LedStripe89, SteelSeriesLedId.ZoneEightyNine },
|
||||
{ LedId.LedStripe90, SteelSeriesLedId.ZoneNinety },
|
||||
{ LedId.LedStripe91, SteelSeriesLedId.ZoneNinetyOne },
|
||||
{ LedId.LedStripe92, SteelSeriesLedId.ZoneNinetyTwo },
|
||||
{ LedId.LedStripe93, SteelSeriesLedId.ZoneNinetyThree },
|
||||
{ LedId.LedStripe94, SteelSeriesLedId.ZoneNinetyFour },
|
||||
{ LedId.LedStripe95, SteelSeriesLedId.ZoneNinetyFive },
|
||||
{ LedId.LedStripe96, SteelSeriesLedId.ZoneNinetySix },
|
||||
{ LedId.LedStripe97, SteelSeriesLedId.ZoneNinetySeven },
|
||||
{ LedId.LedStripe98, SteelSeriesLedId.ZoneNinetyEight },
|
||||
{ LedId.LedStripe99, SteelSeriesLedId.ZoneNinetyNine },
|
||||
{ LedId.LedStripe100, SteelSeriesLedId.ZoneOneHundred },
|
||||
{ LedId.LedStripe101, SteelSeriesLedId.ZoneOneHundredOne },
|
||||
{ LedId.LedStripe102, SteelSeriesLedId.ZoneOneHundredTwo },
|
||||
{ LedId.LedStripe103, SteelSeriesLedId.ZoneOneHundredThree }
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -12,7 +12,7 @@ namespace RGB.NET.Devices.SteelSeries
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private readonly Dictionary<LedId, SteelSeriesLedId> _ledMapping;
|
||||
private readonly LedMapping<SteelSeriesLedId> _ledMapping;
|
||||
|
||||
#endregion
|
||||
|
||||
@ -21,8 +21,7 @@ namespace RGB.NET.Devices.SteelSeries
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SteelSeriesRGBDevice"/> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The generic information provided by SteelSeries for the device.</param>
|
||||
internal SteelSeriesRGBDevice(SteelSeriesRGBDeviceInfo info, string apiName, Dictionary<LedId, SteelSeriesLedId> ledMapping, IDeviceUpdateTrigger updateTrigger)
|
||||
internal SteelSeriesRGBDevice(SteelSeriesRGBDeviceInfo info, string apiName, LedMapping<SteelSeriesLedId> ledMapping, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, new SteelSeriesDeviceUpdateQueue(updateTrigger, apiName))
|
||||
{
|
||||
this._ledMapping = ledMapping;
|
||||
@ -37,8 +36,8 @@ namespace RGB.NET.Devices.SteelSeries
|
||||
private void InitializeLayout()
|
||||
{
|
||||
int counter = 0;
|
||||
foreach (KeyValuePair<LedId, SteelSeriesLedId> mapping in _ledMapping)
|
||||
AddLed(mapping.Key, new Point((counter++) * 10, 0), new Size(10, 10));
|
||||
foreach ((LedId ledId, _) in _ledMapping)
|
||||
AddLed(ledId, new Point((counter++) * 10, 0), new Size(10, 10));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@ -47,15 +46,6 @@ namespace RGB.NET.Devices.SteelSeries
|
||||
/// <inheritdoc />
|
||||
protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate) => UpdateQueue.SetData(GetUpdateData(ledsToUpdate));
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Dispose()
|
||||
{
|
||||
try { UpdateQueue?.Dispose(); }
|
||||
catch { /* at least we tried */ }
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,6 +52,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\RGB.NET.Core\RGB.NET.Core.csproj" />
|
||||
<PackageReference Include="HidSharp" Version="2.1.0" />
|
||||
<ProjectReference Include="..\RGB.NET.HID\RGB.NET.HID.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Devices.SteelSeries.API;
|
||||
using RGB.NET.Devices.SteelSeries.HID;
|
||||
using RGB.NET.HID;
|
||||
|
||||
namespace RGB.NET.Devices.SteelSeries
|
||||
{
|
||||
@ -20,6 +20,51 @@ namespace RGB.NET.Devices.SteelSeries
|
||||
/// </summary>
|
||||
public static SteelSeriesDeviceProvider Instance => _instance ?? new SteelSeriesDeviceProvider();
|
||||
|
||||
private const int VENDOR_ID = 0x1038;
|
||||
|
||||
public static HIDLoader<SteelSeriesLedId, SteelSeriesDeviceType> DeviceDefinitions { get; } = new(VENDOR_ID)
|
||||
{
|
||||
//Mice
|
||||
{ 0x1836, RGBDeviceType.Mouse, "Aerox 3", LedMappings.MouseThreeZone, SteelSeriesDeviceType.ThreeZone },
|
||||
{ 0x183A, RGBDeviceType.Mouse, "Aerox 3 Wireless", LedMappings.MouseThreeZone, SteelSeriesDeviceType.ThreeZone },
|
||||
{ 0x1702, RGBDeviceType.Mouse, "Rival 100", LedMappings.MouseOneZone, SteelSeriesDeviceType.OneZone },
|
||||
{ 0x1814, RGBDeviceType.Mouse, "Rival 105", LedMappings.MouseOneZone, SteelSeriesDeviceType.OneZone },
|
||||
{ 0x1816, RGBDeviceType.Mouse, "Rival 106", LedMappings.MouseOneZone, SteelSeriesDeviceType.OneZone },
|
||||
{ 0x1729, RGBDeviceType.Mouse, "Rival 110", LedMappings.MouseOneZone, SteelSeriesDeviceType.OneZone },
|
||||
{ 0x0472, RGBDeviceType.Mouse, "Rival 150", LedMappings.MouseOneZone, SteelSeriesDeviceType.OneZone },
|
||||
{ 0x1710, RGBDeviceType.Mouse, "Rival 300", LedMappings.MouseTwoZone, SteelSeriesDeviceType.TwoZone },
|
||||
{ 0x1720, RGBDeviceType.Mouse, "Rival 310", LedMappings.MouseTwoZone, SteelSeriesDeviceType.TwoZone },
|
||||
{ 0x170E, RGBDeviceType.Mouse, "Rival 500", LedMappings.MouseTwoZone, SteelSeriesDeviceType.TwoZone },
|
||||
{ 0x1724, RGBDeviceType.Mouse, "Rival 600", LedMappings.MouseEightZone, SteelSeriesDeviceType.EightZone },
|
||||
{ 0x1700, RGBDeviceType.Mouse, "Rival 700", LedMappings.MouseTwoZone, SteelSeriesDeviceType.TwoZone },
|
||||
{ 0x1824, RGBDeviceType.Mouse, "Rival 3 (Old Firmware)", LedMappings.MouseThreeZone, SteelSeriesDeviceType.ThreeZone },
|
||||
{ 0x184C, RGBDeviceType.Mouse, "Rival 3", LedMappings.MouseThreeZone, SteelSeriesDeviceType.ThreeZone },
|
||||
{ 0x1830, RGBDeviceType.Mouse, "Rival 3 Wireless", LedMappings.MouseThreeZone, SteelSeriesDeviceType.ThreeZone },
|
||||
{ 0x1832, RGBDeviceType.Mouse, "Sensei Ten", LedMappings.MouseTwoZone, SteelSeriesDeviceType.TwoZone },
|
||||
|
||||
//Keyboards
|
||||
{ 0x161C, RGBDeviceType.Keyboard, "Apex 5", LedMappings.KeyboardMappingUk, SteelSeriesDeviceType.PerKey },
|
||||
{ 0x1612, RGBDeviceType.Keyboard, "Apex 7", LedMappings.KeyboardMappingUk, SteelSeriesDeviceType.PerKey },
|
||||
{ 0x1618, RGBDeviceType.Keyboard, "Apex 7 TKL", LedMappings.KeyboardTklMappingUk, SteelSeriesDeviceType.PerKey },
|
||||
{ 0x0616, RGBDeviceType.Keyboard, "Apex M750", LedMappings.KeyboardMappingUk, SteelSeriesDeviceType.PerKey },
|
||||
{ 0x1600, RGBDeviceType.Keyboard, "Apex M800", LedMappings.KeyboardMappingUk, SteelSeriesDeviceType.PerKey },
|
||||
{ 0x1610, RGBDeviceType.Keyboard, "Apex Pro", LedMappings.KeyboardMappingUk, SteelSeriesDeviceType.PerKey },
|
||||
{ 0x1614, RGBDeviceType.Keyboard, "Apex Pro TKL", LedMappings.KeyboardTklMappingUk, SteelSeriesDeviceType.PerKey },
|
||||
|
||||
//Headsets
|
||||
{ 0x12AA, RGBDeviceType.Headset, "Arctis 5", LedMappings.HeadsetTwoZone, SteelSeriesDeviceType.TwoZone },
|
||||
{ 0x1250, RGBDeviceType.Headset, "Arctis 5 Game", LedMappings.HeadsetTwoZone, SteelSeriesDeviceType.TwoZone },
|
||||
{ 0x1251, RGBDeviceType.Headset, "Arctis 5 Game - Dota 2 edition", LedMappings.HeadsetTwoZone, SteelSeriesDeviceType.TwoZone },
|
||||
{ 0x12A8, RGBDeviceType.Headset, "Arctis 5 Game - PUBG edition", LedMappings.HeadsetTwoZone, SteelSeriesDeviceType.TwoZone },
|
||||
{ 0x1252, RGBDeviceType.Headset, "Arctis Pro Game", LedMappings.HeadsetTwoZone, SteelSeriesDeviceType.TwoZone },
|
||||
|
||||
//Mousepads
|
||||
{ 0x1507, RGBDeviceType.Mousepad, "QCK Prism", LedMappings.MousepadTwelveZone, SteelSeriesDeviceType.TwelveZone },
|
||||
|
||||
//Monitors
|
||||
{ 0x1126, RGBDeviceType.Monitor, "MGP27C", LedMappings.MonitorOnehundredandthreeZone, SteelSeriesDeviceType.OneHundredAndThreeZone },
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
@ -46,20 +91,20 @@ namespace RGB.NET.Devices.SteelSeries
|
||||
|
||||
protected override IEnumerable<IRGBDevice> GetLoadedDevices(RGBDeviceType loadFilter)
|
||||
{
|
||||
DeviceChecker.LoadDeviceList(loadFilter);
|
||||
DeviceDefinitions.LoadFilter = loadFilter;
|
||||
|
||||
return base.GetLoadedDevices(loadFilter);
|
||||
}
|
||||
|
||||
protected override IEnumerable<IRGBDevice> LoadDevices()
|
||||
{
|
||||
foreach ((string model, RGBDeviceType deviceType, int _, SteelSeriesDeviceType steelSeriesDeviceType, Dictionary<LedId, SteelSeriesLedId> ledMapping) in DeviceChecker.ConnectedDevices)
|
||||
foreach ((HIDDeviceDefinition<SteelSeriesLedId, SteelSeriesDeviceType> definition, _) in DeviceDefinitions.GetConnectedDevices(x => x.CustomData))
|
||||
{
|
||||
string? apiName = steelSeriesDeviceType.GetAPIName();
|
||||
string? apiName = definition.CustomData.GetAPIName();
|
||||
if (apiName == null)
|
||||
Throw(new RGBDeviceException($"Missing API-name for device {model}"));
|
||||
Throw(new RGBDeviceException($"Missing API-name for device {definition.Name}"));
|
||||
else
|
||||
yield return new SteelSeriesRGBDevice(new SteelSeriesRGBDeviceInfo(deviceType, model, steelSeriesDeviceType), apiName, ledMapping, GetUpdateTrigger());
|
||||
yield return new SteelSeriesRGBDevice(new SteelSeriesRGBDeviceInfo(definition.DeviceType, definition.Name, definition.CustomData), apiName, definition.LedMapping, GetUpdateTrigger());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
59
RGB.NET.HID/HIDLoader.cs
Normal file
59
RGB.NET.HID/HIDLoader.cs
Normal file
@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using HidSharp;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.HID
|
||||
{
|
||||
public record HIDDeviceDefinition<TLed, TData>(int ProductId, RGBDeviceType DeviceType, string Name, LedMapping<TLed> LedMapping, TData CustomData) where TLed : notnull;
|
||||
|
||||
public class HIDLoader<TLed, TData> : IEnumerable<HIDDeviceDefinition<TLed, TData>>
|
||||
where TLed : notnull
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private readonly Dictionary<int, HIDDeviceDefinition<TLed, TData>> _deviceDefinitions = new();
|
||||
|
||||
public int VendorId { get; }
|
||||
|
||||
public RGBDeviceType LoadFilter { get; set; } = RGBDeviceType.All;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
public HIDLoader(int vendorId)
|
||||
{
|
||||
this.VendorId = vendorId;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
public void Add(int productId, RGBDeviceType deviceType, string name, LedMapping<TLed> ledMapping, TData customData)
|
||||
=> _deviceDefinitions.Add(productId, new HIDDeviceDefinition<TLed, TData>(productId, deviceType, name, ledMapping, customData));
|
||||
|
||||
public IEnumerable<(HIDDeviceDefinition<TLed, TData> definition, HidDevice device)> GetConnectedDevices()
|
||||
{
|
||||
IEnumerable<HidDevice> devices = DeviceList.Local.GetHidDevices(VendorId);
|
||||
foreach (HidDevice device in devices)
|
||||
{
|
||||
if (_deviceDefinitions.TryGetValue(device.ProductID, out HIDDeviceDefinition<TLed, TData>? definition))
|
||||
if (LoadFilter.HasFlag(definition.DeviceType))
|
||||
yield return (definition, device);
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<(HIDDeviceDefinition<TLed, TData> definition, HidDevice device)> GetConnectedDevices<TKey>(Func<HIDDeviceDefinition<TLed, TData>, TKey> groupBy)
|
||||
=> GetConnectedDevices().GroupBy(x => groupBy(x.definition))
|
||||
.Select(group => group.First());
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
||||
public IEnumerator<HIDDeviceDefinition<TLed, TData>> GetEnumerator() => _deviceDefinitions.Values.GetEnumerator();
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
60
RGB.NET.HID/RGB.NET.HID.csproj
Normal file
60
RGB.NET.HID/RGB.NET.HID.csproj
Normal file
@ -0,0 +1,60 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net5.0</TargetFrameworks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
<Authors>Darth Affe</Authors>
|
||||
<Company>Wyrez</Company>
|
||||
<Language>en-US</Language>
|
||||
<NeutralLanguage>en-US</NeutralLanguage>
|
||||
<Title>RGB.NET.HID</Title>
|
||||
<AssemblyName>RGB.NET.HID</AssemblyName>
|
||||
<AssemblyTitle>RGB.NET.HID</AssemblyTitle>
|
||||
<PackageId>RGB.NET.HID</PackageId>
|
||||
<RootNamespace>RGB.NET.HID</RootNamespace>
|
||||
<Description>HID-Module of RGB.NET</Description>
|
||||
<Summary>HID-Module of RGB.NET, a C# (.NET) library for accessing various RGB-peripherals</Summary>
|
||||
<Copyright>Copyright © Darth Affe 2021</Copyright>
|
||||
<PackageCopyright>Copyright © Darth Affe 2021</PackageCopyright>
|
||||
<PackageIconUrl>http://lib.arge.be/icon.png</PackageIconUrl>
|
||||
<PackageProjectUrl>https://github.com/DarthAffe/RGB.NET</PackageProjectUrl>
|
||||
<PackageLicenseUrl>https://raw.githubusercontent.com/DarthAffe/RGB.NET/master/LICENSE</PackageLicenseUrl>
|
||||
<RepositoryType>Github</RepositoryType>
|
||||
<RepositoryUrl>https://github.com/DarthAffe/RGB.NET</RepositoryUrl>
|
||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||
|
||||
<PackageReleaseNotes></PackageReleaseNotes>
|
||||
|
||||
<Version>0.0.1</Version>
|
||||
<AssemblyVersion>0.0.1</AssemblyVersion>
|
||||
<FileVersion>0.0.1</FileVersion>
|
||||
|
||||
<OutputPath>..\bin\</OutputPath>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<IncludeSource>True</IncludeSource>
|
||||
<IncludeSymbols>True</IncludeSymbols>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<DefineConstants>$(DefineConstants);TRACE;DEBUG</DefineConstants>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>$(NoWarn);CS1591;CS1572;CS1573</NoWarn>
|
||||
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="HidSharp" Version="2.1.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\RGB.NET.Core\RGB.NET.Core.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@ -39,6 +39,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RGB.NET.Devices.Wooting", "
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RGB.NET.Layout", "RGB.NET.Layout\RGB.NET.Layout.csproj", "{8AAB3736-B443-402C-B8AC-63D1A6DAFCCB}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RGB.NET.HID", "RGB.NET.HID\RGB.NET.HID.csproj", "{4F4B7329-4858-4314-BA32-9DF3B1B33482}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -109,6 +111,10 @@ Global
|
||||
{8AAB3736-B443-402C-B8AC-63D1A6DAFCCB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8AAB3736-B443-402C-B8AC-63D1A6DAFCCB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8AAB3736-B443-402C-B8AC-63D1A6DAFCCB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4F4B7329-4858-4314-BA32-9DF3B1B33482}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4F4B7329-4858-4314-BA32-9DF3B1B33482}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4F4B7329-4858-4314-BA32-9DF3B1B33482}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4F4B7329-4858-4314-BA32-9DF3B1B33482}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user