mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-13 10:08:31 +00:00
Compare commits
19 Commits
6665e14e1d
...
4055ee9b0a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4055ee9b0a | ||
|
|
6254eae845 | ||
|
|
63498eb8c3 | ||
| 9241673e7f | |||
| f616390b84 | |||
| 363fc4c066 | |||
| a2a7758978 | |||
| 5fbf716a87 | |||
| b300ac8451 | |||
| 68c5990ccd | |||
| 16aa017e77 | |||
| 5e7ef211f7 | |||
| 7b1d8cfcd9 | |||
| 5d3071235b | |||
| a1955ec377 | |||
| 41edda99f0 | |||
| 1d57f4e988 | |||
|
|
da4c227684 | ||
|
|
6bbcf987b3 |
@ -72,9 +72,9 @@ namespace RGB.NET.Core
|
||||
|
||||
#region Constructors
|
||||
|
||||
protected AbstractRGBDevice(TDeviceInfo deviceOnfo, IUpdateQueue updateQueue)
|
||||
protected AbstractRGBDevice(TDeviceInfo deviceInfo, IUpdateQueue updateQueue)
|
||||
{
|
||||
this.DeviceInfo = deviceOnfo;
|
||||
this.DeviceInfo = deviceInfo;
|
||||
this.UpdateQueue = updateQueue;
|
||||
}
|
||||
|
||||
|
||||
@ -16,13 +16,15 @@ namespace RGB.NET.Core
|
||||
|
||||
public virtual IEnumerable<IRGBDevice> Devices { get; protected set; } = Enumerable.Empty<IRGBDevice>();
|
||||
|
||||
protected Dictionary<int, IDeviceUpdateTrigger> UpdateTriggers { get; } = new();
|
||||
protected Dictionary<int, IDeviceUpdateTrigger> UpdateTriggerMapping { get; } = new();
|
||||
|
||||
public ReadOnlyCollection<(int id, IDeviceUpdateTrigger trigger)> UpdateTriggers => new(UpdateTriggerMapping.Select(x => (x.Key, x.Value)).ToList());
|
||||
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
|
||||
public event EventHandler<Exception>? Exception;
|
||||
public event EventHandler<ExceptionEventArgs>? Exception;
|
||||
|
||||
#endregion
|
||||
|
||||
@ -49,15 +51,20 @@ namespace RGB.NET.Core
|
||||
|
||||
Devices = new ReadOnlyCollection<IRGBDevice>(GetLoadedDevices(loadFilter).ToList());
|
||||
|
||||
foreach (IDeviceUpdateTrigger updateTrigger in UpdateTriggers.Values)
|
||||
foreach (IDeviceUpdateTrigger updateTrigger in UpdateTriggerMapping.Values)
|
||||
updateTrigger.Start();
|
||||
|
||||
IsInitialized = true;
|
||||
}
|
||||
catch (DeviceProviderException)
|
||||
{
|
||||
Reset();
|
||||
throw;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Reset();
|
||||
Throw(ex);
|
||||
Throw(ex, true);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -66,13 +73,23 @@ namespace RGB.NET.Core
|
||||
|
||||
protected virtual IEnumerable<IRGBDevice> GetLoadedDevices(RGBDeviceType loadFilter)
|
||||
{
|
||||
List<IRGBDevice> devices = new();
|
||||
foreach (IRGBDevice device in LoadDevices())
|
||||
{
|
||||
if (loadFilter.HasFlag(device.DeviceInfo.DeviceType))
|
||||
yield return device;
|
||||
else
|
||||
device.Dispose();
|
||||
try
|
||||
{
|
||||
if (loadFilter.HasFlag(device.DeviceInfo.DeviceType))
|
||||
devices.Add(device);
|
||||
else
|
||||
device.Dispose();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Throw(ex);
|
||||
}
|
||||
}
|
||||
|
||||
return devices;
|
||||
}
|
||||
|
||||
protected abstract void InitializeSDK();
|
||||
@ -81,8 +98,8 @@ namespace RGB.NET.Core
|
||||
|
||||
protected virtual IDeviceUpdateTrigger GetUpdateTrigger(int id = -1, double? updateRateHardLimit = null)
|
||||
{
|
||||
if (!UpdateTriggers.TryGetValue(id, out IDeviceUpdateTrigger? updaeTrigger))
|
||||
UpdateTriggers[id] = (updaeTrigger = CreateUpdateTrigger(id, updateRateHardLimit ?? _defaultUpdateRateHardLimit));
|
||||
if (!UpdateTriggerMapping.TryGetValue(id, out IDeviceUpdateTrigger? updaeTrigger))
|
||||
UpdateTriggerMapping[id] = (updaeTrigger = CreateUpdateTrigger(id, updateRateHardLimit ?? _defaultUpdateRateHardLimit));
|
||||
|
||||
return updaeTrigger;
|
||||
}
|
||||
@ -91,30 +108,28 @@ namespace RGB.NET.Core
|
||||
|
||||
protected virtual void Reset()
|
||||
{
|
||||
foreach (IDeviceUpdateTrigger updateTrigger in UpdateTriggers.Values)
|
||||
foreach (IDeviceUpdateTrigger updateTrigger in UpdateTriggerMapping.Values)
|
||||
updateTrigger.Dispose();
|
||||
|
||||
foreach (IRGBDevice device in Devices)
|
||||
device.Dispose();
|
||||
|
||||
Devices = Enumerable.Empty<IRGBDevice>();
|
||||
IsInitialized = false;
|
||||
}
|
||||
|
||||
protected virtual void Throw(Exception ex)
|
||||
protected virtual void Throw(Exception ex, bool isCritical = false)
|
||||
{
|
||||
try { OnException(ex); } catch { /* we don't want to throw due to bad event handlers */ }
|
||||
ExceptionEventArgs args = new(ex, isCritical, ThrowsExceptions);
|
||||
try { OnException(args); } catch { /* we don't want to throw due to bad event handlers */ }
|
||||
|
||||
if (ThrowsExceptions)
|
||||
throw ex;
|
||||
if (args.Throw)
|
||||
throw new DeviceProviderException(ex, isCritical);
|
||||
}
|
||||
|
||||
protected virtual void OnException(Exception ex) => Exception?.Invoke(this, ex);
|
||||
protected virtual void OnException(ExceptionEventArgs args) => Exception?.Invoke(this, args);
|
||||
|
||||
public virtual void Dispose()
|
||||
{
|
||||
IEnumerable<IRGBDevice> devices = Devices;
|
||||
Reset();
|
||||
foreach (IRGBDevice device in devices)
|
||||
device.Dispose();
|
||||
}
|
||||
public virtual void Dispose() => Reset();
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace RGB.NET.Core
|
||||
{
|
||||
@ -20,6 +21,8 @@ namespace RGB.NET.Core
|
||||
/// </summary>
|
||||
IEnumerable<IRGBDevice> Devices { get; }
|
||||
|
||||
ReadOnlyCollection<(int id, IDeviceUpdateTrigger trigger)> UpdateTriggers { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
@ -27,7 +30,7 @@ namespace RGB.NET.Core
|
||||
/// <summary>
|
||||
/// Occurs when an exception is thrown in the device provider
|
||||
/// </summary>
|
||||
event EventHandler<Exception>? Exception;
|
||||
event EventHandler<ExceptionEventArgs>? Exception;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@ -18,6 +18,10 @@ namespace RGB.NET.Core
|
||||
/// </summary>
|
||||
public Exception Exception { get; }
|
||||
|
||||
public bool IsCritical { get; }
|
||||
|
||||
public bool Throw { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
@ -27,9 +31,11 @@ namespace RGB.NET.Core
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Core.ExceptionEventArgs" /> class.
|
||||
/// </summary>
|
||||
/// <param name="exception">The <see cref="T:System.Exception" /> which is responsible for the event-call.</param>
|
||||
public ExceptionEventArgs(Exception exception)
|
||||
public ExceptionEventArgs(Exception exception, bool isCritical = false, bool @throw = false)
|
||||
{
|
||||
this.Exception = exception;
|
||||
this.IsCritical = isCritical;
|
||||
this.Throw = @throw;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
23
RGB.NET.Core/Exceptions/DeviceProviderException.cs
Normal file
23
RGB.NET.Core/Exceptions/DeviceProviderException.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System;
|
||||
|
||||
namespace RGB.NET.Core
|
||||
{
|
||||
public class DeviceProviderException : ApplicationException
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private bool IsCritical { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
public DeviceProviderException(Exception? innerException, bool isCritical)
|
||||
: base(innerException?.Message, innerException)
|
||||
{
|
||||
this.IsCritical = isCritical;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -7,6 +7,12 @@ namespace RGB.NET.Core
|
||||
/// </summary>
|
||||
public abstract class AbstractUpdateTrigger : AbstractBindable, IUpdateTrigger
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
public abstract double LastUpdateTime { get; protected set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@ -53,6 +53,8 @@ namespace RGB.NET.Core
|
||||
}
|
||||
}
|
||||
|
||||
public override double LastUpdateTime { get; protected set; }
|
||||
|
||||
protected AutoResetEvent HasDataEvent { get; set; } = new(false);
|
||||
|
||||
protected bool IsRunning { get; set; }
|
||||
@ -126,9 +128,11 @@ namespace RGB.NET.Core
|
||||
|
||||
OnUpdate();
|
||||
|
||||
double lastUpdateTime = ((Stopwatch.GetTimestamp() - preUpdateTicks) / 10000.0);
|
||||
LastUpdateTime = lastUpdateTime;
|
||||
|
||||
if (UpdateFrequency > 0)
|
||||
{
|
||||
double lastUpdateTime = ((Stopwatch.GetTimestamp() - preUpdateTicks) / 10000.0);
|
||||
int sleep = (int)((UpdateFrequency * 1000.0) - lastUpdateTime);
|
||||
if (sleep > 0)
|
||||
Thread.Sleep(sleep);
|
||||
|
||||
@ -7,6 +7,8 @@ namespace RGB.NET.Core
|
||||
/// </summary>
|
||||
public interface IUpdateTrigger : IDisposable
|
||||
{
|
||||
double LastUpdateTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the trigger is starting up.
|
||||
/// </summary>
|
||||
|
||||
@ -22,7 +22,7 @@ namespace RGB.NET.Core
|
||||
/// <summary>
|
||||
/// Gets the time it took the last update-loop cycle to run.
|
||||
/// </summary>
|
||||
public double LastUpdateTime { get; private set; }
|
||||
public override double LastUpdateTime { get; protected set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ namespace RGB.NET.Core
|
||||
/// <summary>
|
||||
/// Gets the time it took the last update-loop cycle to run.
|
||||
/// </summary>
|
||||
public double LastUpdateTime { get; private set; }
|
||||
public override double LastUpdateTime { get; protected set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@ -65,9 +65,9 @@ namespace RGB.NET.Devices.Asus
|
||||
AsusDeviceType.VGA_RGB => new AsusGraphicsCardRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.GraphicsCard, device), GetUpdateTrigger()),
|
||||
AsusDeviceType.HEADSET_RGB => new AsusHeadsetRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Headset, device), GetUpdateTrigger()),
|
||||
AsusDeviceType.DRAM_RGB => new AsusDramRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.DRAM, device), GetUpdateTrigger()),
|
||||
AsusDeviceType.KEYBOARD_RGB => new AsusKeyboardRGBDevice(new AsusKeyboardRGBDeviceInfo(device), GetUpdateTrigger()),
|
||||
AsusDeviceType.NB_KB_RGB => new AsusKeyboardRGBDevice(new AsusKeyboardRGBDeviceInfo(device), GetUpdateTrigger()),
|
||||
AsusDeviceType.NB_KB_4ZONE_RGB => new AsusKeyboardRGBDevice(new AsusKeyboardRGBDeviceInfo(device), GetUpdateTrigger()),
|
||||
AsusDeviceType.KEYBOARD_RGB => new AsusKeyboardRGBDevice(new AsusKeyboardRGBDeviceInfo(device), LedMappings.KeyboardMapping, GetUpdateTrigger()),
|
||||
AsusDeviceType.NB_KB_RGB => new AsusKeyboardRGBDevice(new AsusKeyboardRGBDeviceInfo(device), LedMappings.KeyboardMapping, GetUpdateTrigger()),
|
||||
AsusDeviceType.NB_KB_4ZONE_RGB => new AsusKeyboardRGBDevice(new AsusKeyboardRGBDeviceInfo(device), null, GetUpdateTrigger()),
|
||||
AsusDeviceType.MOUSE_RGB => new AsusMouseRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Mouse, device), GetUpdateTrigger()),
|
||||
_ => new AsusUnspecifiedRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Unknown, device), LedId.Custom1, GetUpdateTrigger())
|
||||
};
|
||||
|
||||
@ -2,7 +2,10 @@
|
||||
|
||||
namespace RGB.NET.Devices.Asus
|
||||
{
|
||||
internal enum AsusLedId : ushort
|
||||
/// <summary>
|
||||
/// Represents a LED ID as they are known by the ASUS SDK
|
||||
/// </summary>
|
||||
public enum AsusLedId : ushort
|
||||
{
|
||||
KEY_ESCAPE = 0x01,
|
||||
KEY_1 = 0x02,
|
||||
@ -149,5 +152,13 @@ namespace RGB.NET.Devices.Asus
|
||||
KEY_MAIL = 0xEC, // Mail
|
||||
KEY_MEDIASELECT = 0xED, // Media Select
|
||||
KEY_FN = 0x100, // Function key
|
||||
|
||||
// Undocumented
|
||||
UNDOCUMENTED_1 = 0x59,
|
||||
UNDOCUMENTED_2 = 0x56,
|
||||
UNDOCUMENTED_3 = 0x101,
|
||||
UNDOCUMENTED_4 = 0x102,
|
||||
UNDOCUMENTED_5 = 0x103,
|
||||
UNDOCUMENTED_6 = 0xDA, // Bottom-left function on the ROG Zephyrus Duo 15
|
||||
}
|
||||
}
|
||||
|
||||
18
RGB.NET.Devices.Asus/Enum/AsusLedType.cs
Normal file
18
RGB.NET.Devices.Asus/Enum/AsusLedType.cs
Normal file
@ -0,0 +1,18 @@
|
||||
namespace RGB.NET.Devices.Asus
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a type of ASUS LED as known by the ASUS SDK
|
||||
/// </summary>
|
||||
public enum AsusLedType
|
||||
{
|
||||
/// <summary>
|
||||
/// An ASUS LED that is present on a device's IAuraSyncKeyboard.Keys enumerable
|
||||
/// </summary>
|
||||
Key,
|
||||
|
||||
/// <summary>
|
||||
/// An ASUS LED that is present on a device's IAuraSyncDevice.Lights enumerable
|
||||
/// </summary>
|
||||
Light
|
||||
}
|
||||
}
|
||||
@ -44,13 +44,13 @@ namespace RGB.NET.Devices.Asus
|
||||
{
|
||||
if (Device is not IAuraSyncKeyboard keyboard)
|
||||
return;
|
||||
|
||||
|
||||
foreach ((object customData, Color value) in dataSet)
|
||||
{
|
||||
(bool, int) customDataTuple = ((bool, int))customData;
|
||||
if (customDataTuple.Item1)
|
||||
(AsusLedType ledType, int id) = (AsusKeyboardLedCustomData)customData;
|
||||
if (ledType == AsusLedType.Key)
|
||||
{
|
||||
IAuraRgbLight light = keyboard.Key[(ushort)customDataTuple.Item2];
|
||||
IAuraRgbLight light = keyboard.Key[(ushort)id];
|
||||
(_, byte r, byte g, byte b) = value.GetRGBBytes();
|
||||
light.Red = r;
|
||||
light.Green = g;
|
||||
@ -58,7 +58,7 @@ namespace RGB.NET.Devices.Asus
|
||||
}
|
||||
else
|
||||
{
|
||||
IAuraRgbLight light = keyboard.Lights[customDataTuple.Item2];
|
||||
IAuraRgbLight light = keyboard.Lights[id];
|
||||
(_, byte r, byte g, byte b) = value.GetRGBBytes();
|
||||
light.Red = r;
|
||||
light.Green = g;
|
||||
|
||||
@ -9,13 +9,15 @@ namespace RGB.NET.Devices.Asus
|
||||
#region Properties & Fields
|
||||
|
||||
// ReSharper disable InconsistentNaming
|
||||
private static readonly ManagementObjectSearcher? _systemModelSearcher;
|
||||
private static readonly ManagementObjectSearcher? _mainboardSearcher;
|
||||
private static readonly ManagementObjectSearcher? _graphicsCardSearcher;
|
||||
// ReSharper restore InconsistentNaming
|
||||
|
||||
private static string? _systemModelInfo;
|
||||
private static (string manufacturer, string model)? _mainboardInfo;
|
||||
private static string? _graphicsCardInfo;
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
@ -24,6 +26,7 @@ namespace RGB.NET.Devices.Asus
|
||||
{
|
||||
if (OperatingSystem.IsWindows())
|
||||
{
|
||||
_systemModelSearcher = new ManagementObjectSearcher(@"root\CIMV2", "SELECT Model FROM Win32_ComputerSystem");
|
||||
_mainboardSearcher = new ManagementObjectSearcher(@"root\CIMV2", "SELECT Manufacturer,Product FROM Win32_BaseBoard");
|
||||
_graphicsCardSearcher = new ManagementObjectSearcher(@"root\CIMV2", "SELECT Name FROM Win32_VideoController");
|
||||
}
|
||||
@ -33,6 +36,20 @@ namespace RGB.NET.Devices.Asus
|
||||
|
||||
#region Methods
|
||||
|
||||
internal static string? GetSystemModelInfo()
|
||||
{
|
||||
if (!OperatingSystem.IsWindows()) return null;
|
||||
|
||||
if ((_systemModelInfo == null) && (_systemModelSearcher != null))
|
||||
foreach (ManagementBaseObject managementBaseObject in _systemModelSearcher.Get())
|
||||
{
|
||||
_systemModelInfo = managementBaseObject["Model"]?.ToString();
|
||||
break;
|
||||
}
|
||||
|
||||
return _systemModelInfo;
|
||||
}
|
||||
|
||||
internal static (string manufacturer, string model)? GetMainboardInfo()
|
||||
{
|
||||
if (!OperatingSystem.IsWindows()) return null;
|
||||
|
||||
@ -1,156 +1,189 @@
|
||||
using System.Collections.Generic;
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Devices.Asus
|
||||
{
|
||||
internal static class AsusKeyboardLedMapping
|
||||
public static class LedMappings
|
||||
{
|
||||
public static readonly Dictionary<AsusLedId, LedId> MAPPING = new()
|
||||
{
|
||||
{ AsusLedId.KEY_ESCAPE, LedId.Keyboard_Escape },
|
||||
{ AsusLedId.KEY_F1, LedId.Keyboard_F1 },
|
||||
{ AsusLedId.KEY_F2, LedId.Keyboard_F2 },
|
||||
{ AsusLedId.KEY_F3, LedId.Keyboard_F3 },
|
||||
{ AsusLedId.KEY_F4, LedId.Keyboard_F4 },
|
||||
{ AsusLedId.KEY_F5, LedId.Keyboard_F5 },
|
||||
{ AsusLedId.KEY_F6, LedId.Keyboard_F6 },
|
||||
{ AsusLedId.KEY_F7, LedId.Keyboard_F7 },
|
||||
{ AsusLedId.KEY_F8, LedId.Keyboard_F8 },
|
||||
{ AsusLedId.KEY_F9, LedId.Keyboard_F9 },
|
||||
{ AsusLedId.KEY_F10, LedId.Keyboard_F10 },
|
||||
{ AsusLedId.KEY_F11, LedId.Keyboard_F11 },
|
||||
{ AsusLedId.KEY_F12, LedId.Keyboard_F12 },
|
||||
{ AsusLedId.KEY_1, LedId.Keyboard_1 },
|
||||
{ AsusLedId.KEY_2, LedId.Keyboard_2 },
|
||||
{ AsusLedId.KEY_3, LedId.Keyboard_3 },
|
||||
{ AsusLedId.KEY_4, LedId.Keyboard_4 },
|
||||
{ AsusLedId.KEY_5, LedId.Keyboard_5 },
|
||||
{ AsusLedId.KEY_6, LedId.Keyboard_6 },
|
||||
{ AsusLedId.KEY_7, LedId.Keyboard_7 },
|
||||
{ AsusLedId.KEY_8, LedId.Keyboard_8 },
|
||||
{ AsusLedId.KEY_9, LedId.Keyboard_9 },
|
||||
{ AsusLedId.KEY_0, LedId.Keyboard_0 },
|
||||
{ AsusLedId.KEY_MINUS , LedId.Keyboard_MinusAndUnderscore },
|
||||
{ AsusLedId.KEY_EQUALS, LedId.Keyboard_EqualsAndPlus },
|
||||
{ AsusLedId.KEY_BACK, LedId.Keyboard_Backspace },
|
||||
{ AsusLedId.KEY_TAB, LedId.Keyboard_Tab },
|
||||
{ AsusLedId.KEY_Q, LedId.Keyboard_Q },
|
||||
{ AsusLedId.KEY_W, LedId.Keyboard_W },
|
||||
{ AsusLedId.KEY_E, LedId.Keyboard_E },
|
||||
{ AsusLedId.KEY_R, LedId.Keyboard_R },
|
||||
{ AsusLedId.KEY_T, LedId.Keyboard_T },
|
||||
{ AsusLedId.KEY_Y, LedId.Keyboard_Y },
|
||||
{ AsusLedId.KEY_U, LedId.Keyboard_U },
|
||||
{ AsusLedId.KEY_I, LedId.Keyboard_I },
|
||||
{ AsusLedId.KEY_O, LedId.Keyboard_O },
|
||||
{ AsusLedId.KEY_P, LedId.Keyboard_P },
|
||||
{ AsusLedId.KEY_LBRACKET, LedId.Keyboard_BracketLeft },
|
||||
{ AsusLedId.KEY_RBRACKET, LedId.Keyboard_BracketRight },
|
||||
{ AsusLedId.KEY_RETURN, LedId.Keyboard_Enter },
|
||||
{ AsusLedId.KEY_CAPITAL, LedId.Keyboard_CapsLock },
|
||||
{ AsusLedId.KEY_A, LedId.Keyboard_A },
|
||||
{ AsusLedId.KEY_S, LedId.Keyboard_S },
|
||||
{ AsusLedId.KEY_D, LedId.Keyboard_D },
|
||||
{ AsusLedId.KEY_F, LedId.Keyboard_F },
|
||||
{ AsusLedId.KEY_G, LedId.Keyboard_G },
|
||||
{ AsusLedId.KEY_H, LedId.Keyboard_H },
|
||||
{ AsusLedId.KEY_J, LedId.Keyboard_J },
|
||||
{ AsusLedId.KEY_K, LedId.Keyboard_K },
|
||||
{ AsusLedId.KEY_L, LedId.Keyboard_L },
|
||||
{ AsusLedId.KEY_SEMICOLON,LedId.Keyboard_SemicolonAndColon },
|
||||
{ AsusLedId.KEY_APOSTROPHE, LedId.Keyboard_ApostropheAndDoubleQuote },
|
||||
{ AsusLedId.KEY_GRAVE, LedId.Keyboard_GraveAccentAndTilde },
|
||||
{ AsusLedId.KEY_LSHIFT, LedId.Keyboard_LeftShift },
|
||||
{ AsusLedId.KEY_BACKSLASH, LedId.Keyboard_Backslash },
|
||||
{ AsusLedId.KEY_Z, LedId.Keyboard_Z },
|
||||
{ AsusLedId.KEY_X, LedId.Keyboard_X },
|
||||
{ AsusLedId.KEY_C, LedId.Keyboard_C },
|
||||
{ AsusLedId.KEY_V, LedId.Keyboard_V },
|
||||
{ AsusLedId.KEY_B, LedId.Keyboard_B },
|
||||
{ AsusLedId.KEY_N, LedId.Keyboard_N },
|
||||
{ AsusLedId.KEY_M, LedId.Keyboard_M },
|
||||
{ AsusLedId.KEY_COMMA, LedId.Keyboard_CommaAndLessThan },
|
||||
{ AsusLedId.KEY_PERIOD, LedId.Keyboard_PeriodAndBiggerThan },
|
||||
{ AsusLedId.KEY_SLASH, LedId.Keyboard_SlashAndQuestionMark },
|
||||
{ AsusLedId.KEY_RSHIFT, LedId.Keyboard_RightShift },
|
||||
{ AsusLedId.KEY_LCONTROL, LedId.Keyboard_LeftCtrl },
|
||||
{ AsusLedId.KEY_LWIN, LedId.Keyboard_LeftGui },
|
||||
{ AsusLedId.KEY_LMENU, LedId.Keyboard_LeftAlt },
|
||||
{ AsusLedId.KEY_SPACE, LedId.Keyboard_Space },
|
||||
{ AsusLedId.KEY_RMENU, LedId.Keyboard_RightAlt },
|
||||
{ AsusLedId.KEY_RWIN, LedId.Keyboard_RightGui },
|
||||
{ AsusLedId.KEY_APPS, LedId.Keyboard_Application },
|
||||
{ AsusLedId.KEY_RCONTROL, LedId.Keyboard_RightCtrl },
|
||||
{ AsusLedId.KEY_SYSRQ, LedId.Keyboard_PrintScreen },
|
||||
{ AsusLedId.KEY_SCROLL, LedId.Keyboard_ScrollLock },
|
||||
{ AsusLedId.KEY_PAUSE, LedId.Keyboard_PauseBreak },
|
||||
{ AsusLedId.KEY_INSERT, LedId.Keyboard_Insert },
|
||||
{ AsusLedId.KEY_HOME, LedId.Keyboard_Home },
|
||||
{ AsusLedId.KEY_PRIOR, LedId.Keyboard_PageUp },
|
||||
{ AsusLedId.KEY_DELETE, LedId.Keyboard_Delete },
|
||||
{ AsusLedId.KEY_END, LedId.Keyboard_End },
|
||||
{ AsusLedId.KEY_NEXT, LedId.Keyboard_PageDown },
|
||||
{ AsusLedId.KEY_UP, LedId.Keyboard_ArrowUp },
|
||||
{ AsusLedId.KEY_LEFT, LedId.Keyboard_ArrowLeft },
|
||||
{ AsusLedId.KEY_DOWN, LedId.Keyboard_ArrowDown },
|
||||
{ AsusLedId.KEY_RIGHT, LedId.Keyboard_ArrowRight },
|
||||
{ AsusLedId.KEY_NUMLOCK, LedId.Keyboard_NumLock },
|
||||
{ AsusLedId.KEY_DIVIDE, LedId.Keyboard_NumSlash },
|
||||
{ AsusLedId.KEY_MULTIPLY, LedId.Keyboard_NumAsterisk },
|
||||
{ AsusLedId.KEY_SUBTRACT, LedId.Keyboard_NumMinus },
|
||||
{ AsusLedId.KEY_NUMPAD7, LedId.Keyboard_Num7 },
|
||||
{ AsusLedId.KEY_NUMPAD8, LedId.Keyboard_Num8 },
|
||||
{ AsusLedId.KEY_NUMPAD9, LedId.Keyboard_Num9 },
|
||||
{ AsusLedId.KEY_DECIMAL, LedId.Keyboard_NumPeriodAndDelete },
|
||||
{ AsusLedId.KEY_ADD ,LedId.Keyboard_NumPlus },
|
||||
{ AsusLedId.KEY_NUMPAD4, LedId.Keyboard_Num4 },
|
||||
{ AsusLedId.KEY_NUMPAD5, LedId.Keyboard_Num5 },
|
||||
{ AsusLedId.KEY_NUMPAD6, LedId.Keyboard_Num6 },
|
||||
{ AsusLedId.KEY_NUMPAD1, LedId.Keyboard_Num1 },
|
||||
{ AsusLedId.KEY_NUMPAD2, LedId.Keyboard_Num2 },
|
||||
{ AsusLedId.KEY_NUMPAD3, LedId.Keyboard_Num3 },
|
||||
{ AsusLedId.KEY_NUMPAD0, LedId.Keyboard_Num0 },
|
||||
{ AsusLedId.KEY_NUMPADENTER, LedId.Keyboard_NumEnter },
|
||||
{ AsusLedId.KEY_NUMPADCOMMA, LedId.Keyboard_NumComma },
|
||||
{ AsusLedId.KEY_F13, LedId.Keyboard_Custom3 },
|
||||
{ AsusLedId.KEY_F14, LedId.Keyboard_Custom4 },
|
||||
{ AsusLedId.KEY_F15, LedId.Keyboard_Custom5 },
|
||||
{ AsusLedId.KEY_KANA, LedId.Keyboard_Custom6 },
|
||||
{ AsusLedId.KEY_ABNT_C1, LedId.Keyboard_Custom7 },
|
||||
{ AsusLedId.KEY_CONVERT, LedId.Keyboard_Custom8 },
|
||||
{ AsusLedId.KEY_NOCONVERT, LedId.Keyboard_Custom9 },
|
||||
{ AsusLedId.KEY_YEN, LedId.Keyboard_Custom10 },
|
||||
{ AsusLedId.KEY_ABNT_C2, LedId.Keyboard_Custom11 },
|
||||
{ AsusLedId.KEY_NUMPADEQUALS, LedId.Keyboard_Custom12 },
|
||||
{ AsusLedId.KEY_CIRCUMFLEX, LedId.Keyboard_Custom13 },
|
||||
{ AsusLedId.KEY_AT, LedId.Keyboard_Custom14 },
|
||||
{ AsusLedId.KEY_COLON, LedId.Keyboard_Custom15 },
|
||||
{ AsusLedId.KEY_UNDERLINE, LedId.Keyboard_Custom16 },
|
||||
{ AsusLedId.KEY_KANJI, LedId.Keyboard_Custom17 },
|
||||
{ AsusLedId.KEY_STOP, LedId.Keyboard_Custom18 },
|
||||
{ AsusLedId.KEY_AX, LedId.Keyboard_Custom19 },
|
||||
{ AsusLedId.KEY_UNLABELED, LedId.Keyboard_Custom20 },
|
||||
{ AsusLedId.KEY_NEXTTRACK, LedId.Keyboard_Custom21 },
|
||||
{ AsusLedId.KEY_CALCULATOR, LedId.Keyboard_Custom22 },
|
||||
{ AsusLedId.KEY_POWER, LedId.Keyboard_Custom23 },
|
||||
{ AsusLedId.KEY_SLEEP, LedId.Keyboard_Custom24 },
|
||||
{ AsusLedId.KEY_WAKE, LedId.Keyboard_Custom25 },
|
||||
{ AsusLedId.KEY_WEBSEARCH, LedId.Keyboard_Custom26 },
|
||||
{ AsusLedId.KEY_WEBFAVORITES, LedId.Keyboard_Custom27 },
|
||||
{ AsusLedId.KEY_WEBREFRESH, LedId.Keyboard_Custom28 },
|
||||
{ AsusLedId.KEY_WEBSTOP, LedId.Keyboard_Custom29 },
|
||||
{ AsusLedId.KEY_WEBFORWARD, LedId.Keyboard_Custom30 },
|
||||
{ AsusLedId.KEY_WEBHOME, LedId.Keyboard_Custom31 },
|
||||
{ AsusLedId.KEY_WEBBACK, LedId.Keyboard_Custom32 },
|
||||
{ AsusLedId.KEY_MYCOMPUTER, LedId.Keyboard_Custom33 },
|
||||
{ AsusLedId.KEY_MAIL, LedId.Keyboard_Custom34 },
|
||||
{ AsusLedId.KEY_MEDIASELECT, LedId.Keyboard_Custom35 },
|
||||
{ AsusLedId.KEY_FN, LedId.Keyboard_Function },
|
||||
{ AsusLedId.KEY_MUTE, LedId.Keyboard_MediaMute },
|
||||
{ AsusLedId.KEY_PLAYPAUSE, LedId.Keyboard_MediaPlay },
|
||||
{ AsusLedId.KEY_MEDIASTOP, LedId.Keyboard_MediaStop },
|
||||
{ AsusLedId.KEY_VOLUMEDOWN, LedId.Keyboard_MediaVolumeDown },
|
||||
{ AsusLedId.KEY_VOLUMEUP, LedId.Keyboard_MediaVolumeUp },
|
||||
};
|
||||
/// <summary>
|
||||
/// A LED mapping containing ASUS keyboard LED IDs
|
||||
/// </summary>
|
||||
public static readonly LedMapping<AsusLedId> KeyboardMapping =
|
||||
new()
|
||||
{
|
||||
{LedId.Keyboard_Escape, AsusLedId.KEY_ESCAPE},
|
||||
{LedId.Keyboard_F1, AsusLedId.KEY_F1},
|
||||
{LedId.Keyboard_F2, AsusLedId.KEY_F2},
|
||||
{LedId.Keyboard_F3, AsusLedId.KEY_F3},
|
||||
{LedId.Keyboard_F4, AsusLedId.KEY_F4},
|
||||
{LedId.Keyboard_F5, AsusLedId.KEY_F5},
|
||||
{LedId.Keyboard_F6, AsusLedId.KEY_F6},
|
||||
{LedId.Keyboard_F7, AsusLedId.KEY_F7},
|
||||
{LedId.Keyboard_F8, AsusLedId.KEY_F8},
|
||||
{LedId.Keyboard_F9, AsusLedId.KEY_F9},
|
||||
{LedId.Keyboard_F10, AsusLedId.KEY_F10},
|
||||
{LedId.Keyboard_F11, AsusLedId.KEY_F11},
|
||||
{LedId.Keyboard_F12, AsusLedId.KEY_F12},
|
||||
{LedId.Keyboard_1, AsusLedId.KEY_1},
|
||||
{LedId.Keyboard_2, AsusLedId.KEY_2},
|
||||
{LedId.Keyboard_3, AsusLedId.KEY_3},
|
||||
{LedId.Keyboard_4, AsusLedId.KEY_4},
|
||||
{LedId.Keyboard_5, AsusLedId.KEY_5},
|
||||
{LedId.Keyboard_6, AsusLedId.KEY_6},
|
||||
{LedId.Keyboard_7, AsusLedId.KEY_7},
|
||||
{LedId.Keyboard_8, AsusLedId.KEY_8},
|
||||
{LedId.Keyboard_9, AsusLedId.KEY_9},
|
||||
{LedId.Keyboard_0, AsusLedId.KEY_0},
|
||||
{LedId.Keyboard_MinusAndUnderscore, AsusLedId.KEY_MINUS},
|
||||
{LedId.Keyboard_EqualsAndPlus, AsusLedId.KEY_EQUALS},
|
||||
{LedId.Keyboard_Backspace, AsusLedId.KEY_BACK},
|
||||
{LedId.Keyboard_Tab, AsusLedId.KEY_TAB},
|
||||
{LedId.Keyboard_Q, AsusLedId.KEY_Q},
|
||||
{LedId.Keyboard_W, AsusLedId.KEY_W},
|
||||
{LedId.Keyboard_E, AsusLedId.KEY_E},
|
||||
{LedId.Keyboard_R, AsusLedId.KEY_R},
|
||||
{LedId.Keyboard_T, AsusLedId.KEY_T},
|
||||
{LedId.Keyboard_Y, AsusLedId.KEY_Y},
|
||||
{LedId.Keyboard_U, AsusLedId.KEY_U},
|
||||
{LedId.Keyboard_I, AsusLedId.KEY_I},
|
||||
{LedId.Keyboard_O, AsusLedId.KEY_O},
|
||||
{LedId.Keyboard_P, AsusLedId.KEY_P},
|
||||
{LedId.Keyboard_BracketLeft, AsusLedId.KEY_LBRACKET},
|
||||
{LedId.Keyboard_BracketRight, AsusLedId.KEY_RBRACKET},
|
||||
{LedId.Keyboard_Enter, AsusLedId.KEY_RETURN},
|
||||
{LedId.Keyboard_CapsLock, AsusLedId.KEY_CAPITAL},
|
||||
{LedId.Keyboard_A, AsusLedId.KEY_A},
|
||||
{LedId.Keyboard_S, AsusLedId.KEY_S},
|
||||
{LedId.Keyboard_D, AsusLedId.KEY_D},
|
||||
{LedId.Keyboard_F, AsusLedId.KEY_F},
|
||||
{LedId.Keyboard_G, AsusLedId.KEY_G},
|
||||
{LedId.Keyboard_H, AsusLedId.KEY_H},
|
||||
{LedId.Keyboard_J, AsusLedId.KEY_J},
|
||||
{LedId.Keyboard_K, AsusLedId.KEY_K},
|
||||
{LedId.Keyboard_L, AsusLedId.KEY_L},
|
||||
{LedId.Keyboard_SemicolonAndColon, AsusLedId.KEY_SEMICOLON},
|
||||
{LedId.Keyboard_ApostropheAndDoubleQuote, AsusLedId.KEY_APOSTROPHE},
|
||||
{LedId.Keyboard_GraveAccentAndTilde, AsusLedId.KEY_GRAVE},
|
||||
{LedId.Keyboard_LeftShift, AsusLedId.KEY_LSHIFT},
|
||||
{LedId.Keyboard_Backslash, AsusLedId.KEY_BACKSLASH},
|
||||
{LedId.Keyboard_Z, AsusLedId.KEY_Z},
|
||||
{LedId.Keyboard_X, AsusLedId.KEY_X},
|
||||
{LedId.Keyboard_C, AsusLedId.KEY_C},
|
||||
{LedId.Keyboard_V, AsusLedId.KEY_V},
|
||||
{LedId.Keyboard_B, AsusLedId.KEY_B},
|
||||
{LedId.Keyboard_N, AsusLedId.KEY_N},
|
||||
{LedId.Keyboard_M, AsusLedId.KEY_M},
|
||||
{LedId.Keyboard_CommaAndLessThan, AsusLedId.KEY_COMMA},
|
||||
{LedId.Keyboard_PeriodAndBiggerThan, AsusLedId.KEY_PERIOD},
|
||||
{LedId.Keyboard_SlashAndQuestionMark, AsusLedId.KEY_SLASH},
|
||||
{LedId.Keyboard_RightShift, AsusLedId.KEY_RSHIFT},
|
||||
{LedId.Keyboard_LeftCtrl, AsusLedId.KEY_LCONTROL},
|
||||
{LedId.Keyboard_LeftGui, AsusLedId.KEY_LWIN},
|
||||
{LedId.Keyboard_LeftAlt, AsusLedId.KEY_LMENU},
|
||||
{LedId.Keyboard_Space, AsusLedId.KEY_SPACE},
|
||||
{LedId.Keyboard_RightAlt, AsusLedId.KEY_RMENU},
|
||||
{LedId.Keyboard_RightGui, AsusLedId.KEY_RWIN},
|
||||
{LedId.Keyboard_Application, AsusLedId.KEY_APPS},
|
||||
{LedId.Keyboard_RightCtrl, AsusLedId.KEY_RCONTROL},
|
||||
{LedId.Keyboard_PrintScreen, AsusLedId.KEY_SYSRQ},
|
||||
{LedId.Keyboard_ScrollLock, AsusLedId.KEY_SCROLL},
|
||||
{LedId.Keyboard_PauseBreak, AsusLedId.KEY_PAUSE},
|
||||
{LedId.Keyboard_Insert, AsusLedId.KEY_INSERT},
|
||||
{LedId.Keyboard_Home, AsusLedId.KEY_HOME},
|
||||
{LedId.Keyboard_PageUp, AsusLedId.KEY_PRIOR},
|
||||
{LedId.Keyboard_Delete, AsusLedId.KEY_DELETE},
|
||||
{LedId.Keyboard_End, AsusLedId.KEY_END},
|
||||
{LedId.Keyboard_PageDown, AsusLedId.KEY_NEXT},
|
||||
{LedId.Keyboard_ArrowUp, AsusLedId.KEY_UP},
|
||||
{LedId.Keyboard_ArrowLeft, AsusLedId.KEY_LEFT},
|
||||
{LedId.Keyboard_ArrowDown, AsusLedId.KEY_DOWN},
|
||||
{LedId.Keyboard_ArrowRight, AsusLedId.KEY_RIGHT},
|
||||
{LedId.Keyboard_NumLock, AsusLedId.KEY_NUMLOCK},
|
||||
{LedId.Keyboard_NumSlash, AsusLedId.KEY_DIVIDE},
|
||||
{LedId.Keyboard_NumAsterisk, AsusLedId.KEY_MULTIPLY},
|
||||
{LedId.Keyboard_NumMinus, AsusLedId.KEY_SUBTRACT},
|
||||
{LedId.Keyboard_Num7, AsusLedId.KEY_NUMPAD7},
|
||||
{LedId.Keyboard_Num8, AsusLedId.KEY_NUMPAD8},
|
||||
{LedId.Keyboard_Num9, AsusLedId.KEY_NUMPAD9},
|
||||
{LedId.Keyboard_NumPeriodAndDelete, AsusLedId.KEY_DECIMAL},
|
||||
{LedId.Keyboard_NumPlus, AsusLedId.KEY_ADD},
|
||||
{LedId.Keyboard_Num4, AsusLedId.KEY_NUMPAD4},
|
||||
{LedId.Keyboard_Num5, AsusLedId.KEY_NUMPAD5},
|
||||
{LedId.Keyboard_Num6, AsusLedId.KEY_NUMPAD6},
|
||||
{LedId.Keyboard_Num1, AsusLedId.KEY_NUMPAD1},
|
||||
{LedId.Keyboard_Num2, AsusLedId.KEY_NUMPAD2},
|
||||
{LedId.Keyboard_Num3, AsusLedId.KEY_NUMPAD3},
|
||||
{LedId.Keyboard_Num0, AsusLedId.KEY_NUMPAD0},
|
||||
{LedId.Keyboard_NumEnter, AsusLedId.KEY_NUMPADENTER},
|
||||
{LedId.Keyboard_NonUsBackslash, AsusLedId.UNDOCUMENTED_1},
|
||||
{LedId.Keyboard_NonUsTilde, AsusLedId.UNDOCUMENTED_2},
|
||||
{LedId.Keyboard_NumComma, AsusLedId.KEY_NUMPADCOMMA},
|
||||
{LedId.Logo, AsusLedId.UNDOCUMENTED_3},
|
||||
{LedId.Keyboard_Function, AsusLedId.KEY_FN},
|
||||
{LedId.Keyboard_MediaMute, AsusLedId.KEY_MUTE},
|
||||
{LedId.Keyboard_MediaPlay, AsusLedId.KEY_PLAYPAUSE},
|
||||
{LedId.Keyboard_MediaStop, AsusLedId.KEY_MEDIASTOP},
|
||||
{LedId.Keyboard_MediaVolumeDown, AsusLedId.KEY_VOLUMEDOWN},
|
||||
{LedId.Keyboard_MediaVolumeUp, AsusLedId.KEY_VOLUMEUP},
|
||||
{LedId.Keyboard_Custom1, AsusLedId.KEY_F13},
|
||||
{LedId.Keyboard_Custom2, AsusLedId.KEY_F14},
|
||||
{LedId.Keyboard_Custom3, AsusLedId.KEY_F15},
|
||||
{LedId.Keyboard_Custom4, AsusLedId.KEY_KANA},
|
||||
{LedId.Keyboard_Custom5, AsusLedId.KEY_ABNT_C1},
|
||||
{LedId.Keyboard_Custom6, AsusLedId.KEY_CONVERT},
|
||||
{LedId.Keyboard_Custom7, AsusLedId.KEY_NOCONVERT},
|
||||
{LedId.Keyboard_Custom8, AsusLedId.KEY_YEN},
|
||||
{LedId.Keyboard_Custom9, AsusLedId.KEY_ABNT_C2},
|
||||
{LedId.Keyboard_Custom10, AsusLedId.KEY_NUMPADEQUALS},
|
||||
{LedId.Keyboard_Custom11, AsusLedId.KEY_CIRCUMFLEX},
|
||||
{LedId.Keyboard_Custom12, AsusLedId.KEY_AT},
|
||||
{LedId.Keyboard_Custom13, AsusLedId.KEY_COLON},
|
||||
{LedId.Keyboard_Custom14, AsusLedId.KEY_UNDERLINE},
|
||||
{LedId.Keyboard_Custom15, AsusLedId.KEY_KANJI},
|
||||
{LedId.Keyboard_Custom16, AsusLedId.KEY_STOP},
|
||||
{LedId.Keyboard_Custom17, AsusLedId.KEY_AX},
|
||||
{LedId.Keyboard_Custom18, AsusLedId.KEY_UNLABELED},
|
||||
{LedId.Keyboard_Custom19, AsusLedId.KEY_NEXTTRACK},
|
||||
{LedId.Keyboard_Custom20, AsusLedId.KEY_CALCULATOR},
|
||||
{LedId.Keyboard_Custom21, AsusLedId.KEY_POWER},
|
||||
{LedId.Keyboard_Custom22, AsusLedId.KEY_SLEEP},
|
||||
{LedId.Keyboard_Custom23, AsusLedId.KEY_WAKE},
|
||||
{LedId.Keyboard_Custom24, AsusLedId.KEY_WEBSEARCH},
|
||||
{LedId.Keyboard_Custom25, AsusLedId.KEY_WEBFAVORITES},
|
||||
{LedId.Keyboard_Custom26, AsusLedId.KEY_WEBREFRESH},
|
||||
{LedId.Keyboard_Custom27, AsusLedId.KEY_WEBSTOP},
|
||||
{LedId.Keyboard_Custom28, AsusLedId.KEY_WEBFORWARD},
|
||||
{LedId.Keyboard_Custom29, AsusLedId.KEY_WEBHOME},
|
||||
{LedId.Keyboard_Custom30, AsusLedId.KEY_WEBBACK},
|
||||
{LedId.Keyboard_Custom31, AsusLedId.KEY_MYCOMPUTER},
|
||||
{LedId.Keyboard_Custom32, AsusLedId.KEY_MAIL},
|
||||
{LedId.Keyboard_Custom33, AsusLedId.KEY_MEDIASELECT},
|
||||
{LedId.Keyboard_Custom34, AsusLedId.UNDOCUMENTED_4},
|
||||
{LedId.Keyboard_Custom35, AsusLedId.UNDOCUMENTED_5},
|
||||
{LedId.Keyboard_Custom36, AsusLedId.UNDOCUMENTED_6}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// A LED mapping containing extra lights for the ROG Zephyrus Duo 15
|
||||
/// <para>
|
||||
/// ASUS notebooks have extra lights under wide keys like space and backspace, these do not appear as keys on the device.
|
||||
/// Instead they only appear in the Lights enumerable, this mapping maps LED IDs to the index of these lights.
|
||||
/// </para>
|
||||
/// <para>You may add more of these by further populating <see cref="AsusKeyboardRGBDevice.ExtraLedMappings"/>.</para>
|
||||
/// </summary>
|
||||
public static readonly LedMapping<int> ROGZephyrusDuo15 =
|
||||
new()
|
||||
{
|
||||
{LedId.Keyboard_Custom50, 39}, // Mapping starts at Custom50 to avoid possible conflicts with KeyboardMapping above
|
||||
{LedId.Keyboard_Custom51, 40},
|
||||
{LedId.Keyboard_Custom52, 55},
|
||||
{LedId.Keyboard_Custom53, 57},
|
||||
{LedId.Keyboard_Custom54, 97},
|
||||
{LedId.Keyboard_Custom55, 99},
|
||||
{LedId.Keyboard_Custom56, 118},
|
||||
{LedId.Keyboard_Custom57, 120},
|
||||
{LedId.Keyboard_Custom58, 130},
|
||||
{LedId.Keyboard_Custom59, 131},
|
||||
{LedId.Keyboard_Custom60, 133},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,10 +1,21 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using AuraServiceLib;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Devices.Asus
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents custom LED data for ASUS keyboard LEDs.
|
||||
/// </summary>
|
||||
public record AsusKeyboardLedCustomData(AsusLedType LedType, int Id);
|
||||
|
||||
/// <summary>
|
||||
/// Represents a record containing regex that matches to an ASUS device model and a LED mapping mapping to Light indexes.
|
||||
/// </summary>
|
||||
public record AsusKeyboardExtraMapping(Regex Regex, LedMapping<int> LedMapping);
|
||||
|
||||
/// <inheritdoc cref="AsusRGBDevice{TDeviceInfo}" />
|
||||
/// <summary>
|
||||
/// Represents a Asus keyboard.
|
||||
@ -13,11 +24,22 @@ namespace RGB.NET.Devices.Asus
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private readonly LedMapping<AsusLedId>? _ledMapping;
|
||||
private Dictionary<LedId, AsusLedId> _ledAsusLed = new();
|
||||
private Dictionary<LedId, int> _ledAsusLights = new();
|
||||
|
||||
IKeyboardDeviceInfo IKeyboard.DeviceInfo => DeviceInfo;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a list of extra LED mappings to apply to modes that match the provided regex
|
||||
/// <para>Note: These LED mappings should be based on light indexes</para>
|
||||
/// </summary>
|
||||
public static List<AsusKeyboardExtraMapping> ExtraLedMappings =
|
||||
new()
|
||||
{
|
||||
new AsusKeyboardExtraMapping(new Regex("(ROG Zephyrus Duo 15).*?"), LedMappings.ROGZephyrusDuo15)
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
@ -27,9 +49,11 @@ namespace RGB.NET.Devices.Asus
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Asus.AsusKeyboardRGBDevice" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by Asus for the keyboard.</param>
|
||||
internal AsusKeyboardRGBDevice(AsusKeyboardRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
|
||||
internal AsusKeyboardRGBDevice(AsusKeyboardRGBDeviceInfo info, LedMapping<AsusLedId>? ledMapping, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, updateTrigger)
|
||||
{
|
||||
this._ledMapping = ledMapping;
|
||||
|
||||
InitializeLayout();
|
||||
}
|
||||
|
||||
@ -44,41 +68,24 @@ namespace RGB.NET.Devices.Asus
|
||||
int pos = 0;
|
||||
int unknownLed = (int)LedId.Unknown1;
|
||||
|
||||
// A device can have more lights than keys, a space bar with 4 lights per example but only the middle light is represented as a key
|
||||
// This means we want all lights but keys contain more information (a LED ID) so first pick up all keys and 'tag' them by giving them a color of 0x000001
|
||||
|
||||
// Clear tags to make sure no device is already at 0x000001
|
||||
ClearTags();
|
||||
foreach (IAuraRgbKey key in ((IAuraSyncKeyboard)DeviceInfo.Device).Keys)
|
||||
{
|
||||
if (AsusKeyboardLedMapping.MAPPING.TryGetValue((AsusLedId)key.Code, out LedId ledId))
|
||||
if ((_ledMapping != null) && _ledMapping.TryGetValue((AsusLedId)key.Code, out LedId ledId))
|
||||
AddAsusLed((AsusLedId)key.Code, ledId, new Point(pos++ * 19, 0), new Size(19, 19));
|
||||
else
|
||||
{
|
||||
AddAsusLed((AsusLedId)key.Code, (LedId)unknownLed, new Point(pos++ * 19, 0), new Size(19, 19));
|
||||
unknownLed++;
|
||||
}
|
||||
|
||||
TagAsusLed(key);
|
||||
}
|
||||
|
||||
// Give the ASUS SDK some time to catch up
|
||||
Thread.Sleep(100);
|
||||
|
||||
// With keys iterated, add any light that was not tagged, these are lights that aren't represented by keys
|
||||
// Because there's no way to tell which light is which, they're all added as Unknown LEDs
|
||||
for (int index = 0; index < ((IAuraSyncKeyboard)DeviceInfo.Device).Lights.Count; index++)
|
||||
// Add extra LED mapping if required
|
||||
AsusKeyboardExtraMapping? extraMapping = ExtraLedMappings.FirstOrDefault(m => m.Regex.IsMatch(this.DeviceInfo.Model));
|
||||
if (extraMapping != null)
|
||||
{
|
||||
IAuraRgbLight light = ((IAuraSyncKeyboard)DeviceInfo.Device).Lights[index];
|
||||
if (IsAsusLedTagged(light))
|
||||
continue;
|
||||
|
||||
AddAsusLed(index, (LedId)unknownLed, new Point(pos++ * 19, 0), new Size(19, 19));
|
||||
unknownLed++;
|
||||
foreach ((LedId ledId, int lightIndex) in extraMapping.LedMapping)
|
||||
AddAsusLed(lightIndex, ledId, new Point(pos++ * 19, 0), new Size(19, 19));
|
||||
}
|
||||
|
||||
// Clear tags when done, the info is no longer relevant
|
||||
ClearTags();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -92,13 +99,12 @@ namespace RGB.NET.Devices.Asus
|
||||
protected override object? GetLedCustomData(LedId ledId)
|
||||
{
|
||||
if (this._ledAsusLed.TryGetValue(ledId, out AsusLedId asusLedId))
|
||||
return (true, (int)asusLedId);
|
||||
return new AsusKeyboardLedCustomData(AsusLedType.Key, (int)asusLedId);
|
||||
if (this._ledAsusLights.TryGetValue(ledId, out int lightIndex))
|
||||
return (false, lightIndex);
|
||||
return new AsusKeyboardLedCustomData(AsusLedType.Light, lightIndex);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Add an ASUS LED by its LED ID
|
||||
/// </summary>
|
||||
@ -113,7 +119,7 @@ namespace RGB.NET.Devices.Asus
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add an asus LED by its light index
|
||||
/// Add an ASUS LED by its light index
|
||||
/// </summary>
|
||||
private void AddAsusLed(int index, LedId ledId, Point position, Size size)
|
||||
{
|
||||
@ -121,34 +127,6 @@ namespace RGB.NET.Devices.Asus
|
||||
AddLed(ledId, position, size);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears the tags off all keys by setting their color to 0x000000
|
||||
/// </summary>
|
||||
private void ClearTags()
|
||||
{
|
||||
foreach (IAuraRgbLight light in ((IAuraSyncKeyboard)DeviceInfo.Device).Lights)
|
||||
light.Color = 0x000000;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tags a LED by its key by setting its color to 0x000001
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
private void TagAsusLed(IAuraRgbKey key)
|
||||
{
|
||||
key.Color = 0x000001;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a LED is tagged by its light
|
||||
/// </summary>
|
||||
/// <param name="light"></param>
|
||||
/// <returns></returns>
|
||||
private bool IsAsusLedTagged(IAuraRgbLight light)
|
||||
{
|
||||
return light.Color == 0x000001;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using AuraServiceLib;
|
||||
using System.Collections.Generic;
|
||||
using AuraServiceLib;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Devices.Asus
|
||||
@ -10,6 +11,12 @@ namespace RGB.NET.Devices.Asus
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
/// <summary>
|
||||
/// The ASUS SDK returns useless names for notebook keyboards, possibly for others as well.
|
||||
/// Keep a list of those and rely on <see cref="WMIHelper.GetSystemModelInfo()"/> to get the real model
|
||||
/// </summary>
|
||||
private static List<string> GenericDeviceNames = new() {"NotebookKeyboard"};
|
||||
|
||||
/// <inheritdoc />
|
||||
public KeyboardLayoutType Layout => KeyboardLayoutType.Unknown;
|
||||
|
||||
@ -23,9 +30,18 @@ namespace RGB.NET.Devices.Asus
|
||||
/// </summary>
|
||||
/// <param name="device">The <see cref="IAuraSyncDevice"/> backing this RGB.NET device.</param>
|
||||
internal AsusKeyboardRGBDeviceInfo(IAuraSyncDevice device)
|
||||
: base(RGBDeviceType.Keyboard, device, device.Name)
|
||||
: base(RGBDeviceType.Keyboard, device, GetKeyboardModel(device.Name))
|
||||
{ }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
private static string? GetKeyboardModel(string deviceName)
|
||||
{
|
||||
return GenericDeviceNames.Contains(deviceName) ? WMIHelper.GetSystemModelInfo() : deviceName;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ namespace RGB.NET.Devices.CoolerMaster
|
||||
protected override void InitializeSDK()
|
||||
{
|
||||
_CoolerMasterSDK.Reload();
|
||||
if (_CoolerMasterSDK.GetSDKVersion() <= 0) Throw(new RGBDeviceException("Failed to initialize CoolerMaster-SDK"));
|
||||
if (_CoolerMasterSDK.GetSDKVersion() <= 0) Throw(new RGBDeviceException("Failed to initialize CoolerMaster-SDK"), true);
|
||||
}
|
||||
|
||||
protected override IEnumerable<IRGBDevice> LoadDevices()
|
||||
|
||||
@ -16,7 +16,7 @@ namespace RGB.NET.Devices.CoolerMaster.Native
|
||||
#region Libary Management
|
||||
|
||||
private static IntPtr _dllHandle = IntPtr.Zero;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Reloads the SDK.
|
||||
/// </summary>
|
||||
@ -41,6 +41,7 @@ namespace RGB.NET.Devices.CoolerMaster.Native
|
||||
if (dllPath == null) throw new RGBDeviceException($"Can't find the CoolerMaster-SDK at one of the expected locations:\r\n '{string.Join("\r\n", possiblePathList.Select(Path.GetFullPath))}'");
|
||||
|
||||
_dllHandle = LoadLibrary(dllPath);
|
||||
if (_dllHandle == IntPtr.Zero) throw new RGBDeviceException($"CoolerMaster LoadLibrary failed with error code {Marshal.GetLastWin32Error()}");
|
||||
|
||||
_getSDKVersionPointer = (GetSDKVersionPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "GetCM_SDK_DllVer"), typeof(GetSDKVersionPointer));
|
||||
_setControlDevicenPointer = (SetControlDevicePointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "SetControlDevice"), typeof(SetControlDevicePointer));
|
||||
|
||||
@ -71,16 +71,16 @@ namespace RGB.NET.Devices.Corsair
|
||||
|
||||
CorsairError error = LastError;
|
||||
if (error != CorsairError.Success)
|
||||
Throw(new CUEException(error));
|
||||
Throw(new CUEException(error), true);
|
||||
|
||||
if (ProtocolDetails.BreakingChanges)
|
||||
Throw(new RGBDeviceException("The SDK currently used isn't compatible with the installed version of CUE.\r\n"
|
||||
+ $"CUE-Version: {ProtocolDetails.ServerVersion} (Protocol {ProtocolDetails.ServerProtocolVersion})\r\n"
|
||||
+ $"SDK-Version: {ProtocolDetails.SdkVersion} (Protocol {ProtocolDetails.SdkProtocolVersion})"));
|
||||
+ $"SDK-Version: {ProtocolDetails.SdkVersion} (Protocol {ProtocolDetails.SdkProtocolVersion})"), true);
|
||||
|
||||
// DarthAffe 02.02.2021: 127 is iCUE
|
||||
if (!_CUESDK.CorsairSetLayerPriority(128))
|
||||
Throw(new CUEException(LastError));
|
||||
Throw(new CUEException(LastError), false);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@ -36,6 +36,7 @@ namespace RGB.NET.Devices.Corsair.Native
|
||||
if (dllPath == null) throw new RGBDeviceException($"Can't find the CUE-SDK at one of the expected locations:\r\n '{string.Join("\r\n", possiblePathList.Select(Path.GetFullPath))}'");
|
||||
|
||||
_dllHandle = LoadLibrary(dllPath);
|
||||
if (_dllHandle == IntPtr.Zero) throw new RGBDeviceException($"Corsair LoadLibrary failed with error code {Marshal.GetLastWin32Error()}");
|
||||
|
||||
_corsairSetLedsColorsBufferByDeviceIndexPointer = (CorsairSetLedsColorsBufferByDeviceIndexPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "CorsairSetLedsColorsBufferByDeviceIndex"), typeof(CorsairSetLedsColorsBufferByDeviceIndexPointer));
|
||||
_corsairSetLedsColorsFlushBufferPointer = (CorsairSetLedsColorsFlushBufferPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "CorsairSetLedsColorsFlushBuffer"), typeof(CorsairSetLedsColorsFlushBufferPointer));
|
||||
|
||||
@ -124,7 +124,7 @@ namespace RGB.NET.Devices.Logitech
|
||||
_perKeyUpdateQueue = new LogitechPerKeyUpdateQueue(GetUpdateTrigger());
|
||||
|
||||
_LogitechGSDK.Reload();
|
||||
if (!_LogitechGSDK.LogiLedInit()) Throw(new RGBDeviceException("Failed to initialize Logitech-SDK."));
|
||||
if (!_LogitechGSDK.LogiLedInit()) Throw(new RGBDeviceException("Failed to initialize Logitech-SDK."), true);
|
||||
|
||||
_LogitechGSDK.LogiLedSaveCurrentLighting();
|
||||
}
|
||||
|
||||
@ -37,6 +37,7 @@ namespace RGB.NET.Devices.Logitech.Native
|
||||
if (dllPath == null) throw new RGBDeviceException($"Can't find the Logitech-SDK at one of the expected locations:\r\n '{string.Join("\r\n", possiblePathList.Select(Path.GetFullPath))}'");
|
||||
|
||||
_dllHandle = LoadLibrary(dllPath);
|
||||
if (_dllHandle == IntPtr.Zero) throw new RGBDeviceException($"Logitech LoadLibrary failed with error code {Marshal.GetLastWin32Error()}");
|
||||
|
||||
_logiLedInitPointer = (LogiLedInitPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "LogiLedInit"), typeof(LogiLedInitPointer));
|
||||
_logiLedShutdownPointer = (LogiLedShutdownPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "LogiLedShutdown"), typeof(LogiLedShutdownPointer));
|
||||
|
||||
@ -59,14 +59,14 @@ namespace RGB.NET.Devices.Msi
|
||||
|
||||
int errorCode;
|
||||
if ((errorCode = _MsiSDK.Initialize()) != 0)
|
||||
ThrowMsiError(errorCode);
|
||||
ThrowMsiError(errorCode, true);
|
||||
}
|
||||
|
||||
protected override IEnumerable<IRGBDevice> LoadDevices()
|
||||
{
|
||||
int errorCode;
|
||||
if ((errorCode = _MsiSDK.GetDeviceInfo(out string[] deviceTypes, out int[] ledCounts)) != 0)
|
||||
ThrowMsiError(errorCode);
|
||||
ThrowMsiError(errorCode, true);
|
||||
|
||||
for (int i = 0; i < deviceTypes.Length; i++)
|
||||
{
|
||||
@ -93,7 +93,7 @@ namespace RGB.NET.Devices.Msi
|
||||
}
|
||||
}
|
||||
|
||||
private void ThrowMsiError(int errorCode) => Throw(new MysticLightException(errorCode, _MsiSDK.GetErrorMessage(errorCode)));
|
||||
private void ThrowMsiError(int errorCode, bool isCritical = false) => Throw(new MysticLightException(errorCode, _MsiSDK.GetErrorMessage(errorCode)), isCritical);
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Dispose()
|
||||
|
||||
@ -38,6 +38,7 @@ namespace RGB.NET.Devices.Msi.Native
|
||||
SetDllDirectory(Path.GetDirectoryName(Path.GetFullPath(dllPath))!);
|
||||
|
||||
_dllHandle = LoadLibrary(dllPath);
|
||||
if (_dllHandle == IntPtr.Zero) throw new RGBDeviceException($"MSI LoadLibrary failed with error code {Marshal.GetLastWin32Error()}");
|
||||
|
||||
_initializePointer = (InitializePointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "MLAPI_Initialize"), typeof(InitializePointer));
|
||||
_getDeviceInfoPointer = (GetDeviceInfoPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "MLAPI_GetDeviceInfo"), typeof(GetDeviceInfoPointer));
|
||||
|
||||
9
RGB.NET.Devices.PicoPi/Enum/UpdateMode.cs
Normal file
9
RGB.NET.Devices.PicoPi/Enum/UpdateMode.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace RGB.NET.Devices.PicoPi.Enum
|
||||
{
|
||||
public enum UpdateMode
|
||||
{
|
||||
Auto = 0x00,
|
||||
HID = 0x01,
|
||||
BULK = 0x02,
|
||||
}
|
||||
}
|
||||
23
RGB.NET.Devices.PicoPi/PicoPi/LedMappings.cs
Normal file
23
RGB.NET.Devices.PicoPi/PicoPi/LedMappings.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Devices.PicoPi
|
||||
{
|
||||
public static class LedMappings
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
public static LedMapping<int> StripeMapping = new();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
static LedMappings()
|
||||
{
|
||||
for (int i = 0; i < 255; i++)
|
||||
StripeMapping.Add(LedId.LedStripe1 + i, i);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
52
RGB.NET.Devices.PicoPi/PicoPi/PicoPiBulkUpdateQueue.cs
Normal file
52
RGB.NET.Devices.PicoPi/PicoPi/PicoPiBulkUpdateQueue.cs
Normal file
@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Devices.PicoPi
|
||||
{
|
||||
public class PicoPiBulkUpdateQueue : UpdateQueue
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private readonly PicoPiSDK _sdk;
|
||||
private readonly int _channel;
|
||||
|
||||
private readonly byte[] _dataBuffer;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
public PicoPiBulkUpdateQueue(IDeviceUpdateTrigger updateTrigger, PicoPiSDK sdk, int channel, int ledCount)
|
||||
: base(updateTrigger)
|
||||
{
|
||||
this._sdk = sdk;
|
||||
this._channel = channel;
|
||||
|
||||
_dataBuffer = new byte[ledCount * 3];
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
protected override void Update(in ReadOnlySpan<(object key, Color color)> dataSet)
|
||||
{
|
||||
Span<byte> buffer = _dataBuffer;
|
||||
foreach ((object key, Color color) in dataSet)
|
||||
{
|
||||
int index = key as int? ?? -1;
|
||||
if (index < 0) continue;
|
||||
|
||||
(byte _, byte r, byte g, byte b) = color.GetRGBBytes();
|
||||
int offset = index * 3;
|
||||
buffer[offset] = r;
|
||||
buffer[offset + 1] = g;
|
||||
buffer[offset + 2] = b;
|
||||
}
|
||||
|
||||
_sdk.SendBulkUpdate(buffer, _channel);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
66
RGB.NET.Devices.PicoPi/PicoPi/PicoPiHIDUpdateQueue.cs
Normal file
66
RGB.NET.Devices.PicoPi/PicoPi/PicoPiHIDUpdateQueue.cs
Normal file
@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Devices.PicoPi
|
||||
{
|
||||
public class PicoPiHIDUpdateQueue : UpdateQueue
|
||||
{
|
||||
#region Constants
|
||||
|
||||
private const int OFFSET_MULTIPLIER = 60;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties & Fields
|
||||
|
||||
private readonly PicoPiSDK _sdk;
|
||||
private readonly int _channel;
|
||||
|
||||
private readonly byte[] _dataBuffer;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
public PicoPiHIDUpdateQueue(IDeviceUpdateTrigger updateTrigger, PicoPiSDK sdk, int channel, int ledCount)
|
||||
: base(updateTrigger)
|
||||
{
|
||||
this._sdk = sdk;
|
||||
this._channel = channel;
|
||||
|
||||
_dataBuffer = new byte[ledCount * 3];
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
protected override void Update(in ReadOnlySpan<(object key, Color color)> dataSet)
|
||||
{
|
||||
Span<byte> buffer = _dataBuffer;
|
||||
foreach ((object key, Color color) in dataSet)
|
||||
{
|
||||
int index = key as int? ?? -1;
|
||||
if (index < 0) continue;
|
||||
|
||||
(byte _, byte r, byte g, byte b) = color.GetRGBBytes();
|
||||
int offset = index * 3;
|
||||
buffer[offset] = r;
|
||||
buffer[offset + 1] = g;
|
||||
buffer[offset + 2] = b;
|
||||
}
|
||||
|
||||
int chunks = _dataBuffer.Length / OFFSET_MULTIPLIER;
|
||||
if ((chunks * OFFSET_MULTIPLIER) < buffer.Length) chunks++;
|
||||
for (int i = 0; i < chunks; i++)
|
||||
{
|
||||
int offset = i * OFFSET_MULTIPLIER;
|
||||
int length = Math.Min(buffer.Length - offset, OFFSET_MULTIPLIER);
|
||||
bool update = i == (chunks - 1);
|
||||
_sdk.SendHidUpdate(buffer.Slice(offset, length), _channel, i, update);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
36
RGB.NET.Devices.PicoPi/PicoPi/PicoPiRGBDevice.cs
Normal file
36
RGB.NET.Devices.PicoPi/PicoPi/PicoPiRGBDevice.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Devices.PicoPi
|
||||
{
|
||||
public class PicoPiRGBDevice : AbstractRGBDevice<PicoPiRGBDeviceInfo>
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private readonly LedMapping<int> _ledMapping;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
public PicoPiRGBDevice(PicoPiRGBDeviceInfo deviceInfo, IUpdateQueue updateQueue, LedMapping<int> ledMapping)
|
||||
: base(deviceInfo, updateQueue)
|
||||
{
|
||||
this._ledMapping = ledMapping;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
internal void Initialize()
|
||||
{
|
||||
for (int i = 0; i < DeviceInfo.LedCount; i++)
|
||||
AddLed(_ledMapping[i], new Point(i * 10, 0), new Size(10, 10), i);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override object GetLedCustomData(LedId ledId) => _ledMapping.TryGetValue(ledId, out int index) ? index : -1;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
38
RGB.NET.Devices.PicoPi/PicoPi/PicoPiRGBDeviceInfo.cs
Normal file
38
RGB.NET.Devices.PicoPi/PicoPi/PicoPiRGBDeviceInfo.cs
Normal file
@ -0,0 +1,38 @@
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Devices.PicoPi
|
||||
{
|
||||
public class PicoPiRGBDeviceInfo : IRGBDeviceInfo
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
public RGBDeviceType DeviceType { get; }
|
||||
public string DeviceName { get; }
|
||||
public string Manufacturer => "RGB.NET";
|
||||
public string Model { get; }
|
||||
public object? LayoutMetadata { get; set; }
|
||||
|
||||
public string Id { get; }
|
||||
public int Version { get; }
|
||||
public int Channel { get; }
|
||||
public int LedCount { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
internal PicoPiRGBDeviceInfo(RGBDeviceType deviceType, string model, string id, int version, int channel, int ledCount)
|
||||
{
|
||||
this.DeviceType = deviceType;
|
||||
this.Model = model;
|
||||
this.Id = id;
|
||||
this.Version = version;
|
||||
this.Channel = channel;
|
||||
this.LedCount = ledCount;
|
||||
|
||||
DeviceName = DeviceHelper.CreateDeviceName(Manufacturer, $"{Model} {id} (Channel {channel})");
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
219
RGB.NET.Devices.PicoPi/PicoPi/PicoPiSDK.cs
Normal file
219
RGB.NET.Devices.PicoPi/PicoPi/PicoPiSDK.cs
Normal file
@ -0,0 +1,219 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using HidSharp;
|
||||
using LibUsbDotNet.LibUsb;
|
||||
using LibUsbDotNet.Main;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Devices.PicoPi
|
||||
{
|
||||
public class PicoPiSDK : IDisposable
|
||||
{
|
||||
#region Constants
|
||||
|
||||
public const int VENDOR_ID = 0x1209;
|
||||
public const int HID_BULK_CONTROLLER_PID = 0x2812;
|
||||
|
||||
private const byte COMMAND_CHANNEL_COUNT = 0x01;
|
||||
private const byte COMMAND_LEDCOUNTS = 0x0A;
|
||||
private const byte COMMAND_PINS = 0x0B;
|
||||
private const byte COMMAND_ID = 0x0E;
|
||||
private const byte COMMAND_VERSION = 0x0F;
|
||||
private const byte COMMAND_UPDATE = 0x01;
|
||||
private const byte COMMAND_UPDATE_BULK = 0x02;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties & Fields
|
||||
|
||||
private readonly HidDevice _hidDevice;
|
||||
private readonly HidStream _hidStream;
|
||||
|
||||
private UsbContext? _usbContext;
|
||||
private IUsbDevice? _bulkDevice;
|
||||
private UsbEndpointWriter? _bulkWriter;
|
||||
|
||||
private readonly byte[] _hidSendBuffer;
|
||||
private readonly byte[] _bulkSendBuffer;
|
||||
|
||||
private int _bulkTransferLength = 0;
|
||||
|
||||
public bool IsBulkSupported { get; private set; }
|
||||
|
||||
public string Id { get; }
|
||||
public int Version { get; }
|
||||
public IReadOnlyList<(int channel, int ledCount, int pin)> Channels { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
public PicoPiSDK(HidDevice device)
|
||||
{
|
||||
this._hidDevice = device;
|
||||
|
||||
_hidSendBuffer = new byte[_hidDevice.GetMaxOutputReportLength() - 1];
|
||||
|
||||
_hidStream = _hidDevice.Open();
|
||||
LoadBulkDevice();
|
||||
|
||||
Id = GetId();
|
||||
Version = GetVersion();
|
||||
Channels = new ReadOnlyCollection<(int channel, int ledCount, int pin)>(GetChannels().ToList());
|
||||
|
||||
_bulkSendBuffer = new byte[(Channels.Sum(c => c.ledCount + 1) * 3) + 5];
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
public void SetLedCounts(params (int channel, int ledCount)[] ledCounts)
|
||||
{
|
||||
byte[] data = new byte[Channels.Count + 2];
|
||||
data[1] = COMMAND_LEDCOUNTS;
|
||||
foreach ((int channel, int ledCount, _) in Channels)
|
||||
data[channel + 1] = (byte)ledCount;
|
||||
|
||||
foreach ((int channel, int ledCount) in ledCounts)
|
||||
data[channel + 1] = (byte)ledCount;
|
||||
|
||||
SendHID(data);
|
||||
}
|
||||
|
||||
public void SetPins(params (int channel, int pin)[] pins)
|
||||
{
|
||||
byte[] data = new byte[Channels.Count + 2];
|
||||
data[1] = COMMAND_PINS;
|
||||
foreach ((int channel, _, int pin) in Channels)
|
||||
data[channel + 1] = (byte)pin;
|
||||
|
||||
foreach ((int channel, int pin) in pins)
|
||||
data[channel + 1] = (byte)pin;
|
||||
|
||||
SendHID(data);
|
||||
}
|
||||
|
||||
private void LoadBulkDevice()
|
||||
{
|
||||
try
|
||||
{
|
||||
_usbContext = new UsbContext();
|
||||
// DarthAffe 24.04.2021: Not using .Find as it's not returning the device :(
|
||||
IEnumerable<IUsbDevice> devices = _usbContext.List().Where(d => (d.VendorId == _hidDevice.VendorID) && (d.ProductId == _hidDevice.ProductID));
|
||||
foreach (IUsbDevice device in devices)
|
||||
{
|
||||
try
|
||||
{
|
||||
device.Open();
|
||||
if (device.Info.SerialNumber == _hidDevice.GetSerialNumber())
|
||||
{
|
||||
_bulkDevice = device;
|
||||
break;
|
||||
}
|
||||
device.Dispose();
|
||||
}
|
||||
catch { /**/ }
|
||||
}
|
||||
|
||||
if (_bulkDevice != null)
|
||||
{
|
||||
_bulkDevice.ClaimInterface(1);
|
||||
_bulkWriter = _bulkDevice.OpenEndpointWriter(WriteEndpointID.Ep02, EndpointType.Bulk);
|
||||
|
||||
IsBulkSupported = true;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
_bulkWriter = null;
|
||||
try { _bulkDevice?.Dispose(); } catch { /**/ }
|
||||
try { _usbContext?.Dispose(); } catch { /**/ }
|
||||
_bulkDevice = null;
|
||||
}
|
||||
}
|
||||
|
||||
private string GetId()
|
||||
{
|
||||
SendHID(0x00, COMMAND_ID);
|
||||
return ConversionHelper.ToHex(Read().Skip(1).Take(8).ToArray());
|
||||
}
|
||||
|
||||
private int GetVersion()
|
||||
{
|
||||
SendHID(0x00, COMMAND_VERSION);
|
||||
return Read()[1];
|
||||
}
|
||||
|
||||
private IEnumerable<(int channel, int ledCount, int pin)> GetChannels()
|
||||
{
|
||||
SendHID(0x00, COMMAND_CHANNEL_COUNT);
|
||||
int channelCount = Read()[1];
|
||||
|
||||
for (int i = 1; i <= channelCount; i++)
|
||||
{
|
||||
SendHID(0x00, (byte)((i << 4) | COMMAND_LEDCOUNTS));
|
||||
int ledCount = Read()[1];
|
||||
|
||||
SendHID(0x00, (byte)((i << 4) | COMMAND_PINS));
|
||||
int pin = Read()[1];
|
||||
|
||||
yield return (i, ledCount, pin);
|
||||
}
|
||||
}
|
||||
|
||||
public void SendHidUpdate(in Span<byte> data, int channel, int chunk, bool update)
|
||||
{
|
||||
if (data.Length == 0) return;
|
||||
|
||||
Span<byte> sendBuffer = _hidSendBuffer;
|
||||
sendBuffer[0] = 0x00;
|
||||
sendBuffer[1] = (byte)((channel << 4) | COMMAND_UPDATE);
|
||||
sendBuffer[2] = update ? (byte)1 : (byte)0;
|
||||
sendBuffer[3] = (byte)chunk;
|
||||
data.CopyTo(sendBuffer.Slice(4, data.Length));
|
||||
SendHID(_hidSendBuffer);
|
||||
}
|
||||
|
||||
public void SendBulkUpdate(in Span<byte> data, int channel)
|
||||
{
|
||||
if ((data.Length == 0) || !IsBulkSupported) return;
|
||||
|
||||
Span<byte> sendBuffer = new Span<byte>(_bulkSendBuffer).Slice(2);
|
||||
int payloadSize = data.Length;
|
||||
|
||||
sendBuffer[_bulkTransferLength++] = (byte)((channel << 4) | COMMAND_UPDATE_BULK);
|
||||
sendBuffer[_bulkTransferLength++] = (byte)((payloadSize >> 8) & 0xFF);
|
||||
sendBuffer[_bulkTransferLength++] = (byte)(payloadSize & 0xFF);
|
||||
data.CopyTo(sendBuffer.Slice(_bulkTransferLength, payloadSize));
|
||||
_bulkTransferLength += payloadSize;
|
||||
}
|
||||
|
||||
public void FlushBulk()
|
||||
{
|
||||
if (_bulkTransferLength == 0) return;
|
||||
|
||||
_bulkSendBuffer[0] = (byte)((_bulkTransferLength >> 8) & 0xFF);
|
||||
_bulkSendBuffer[1] = (byte)(_bulkTransferLength & 0xFF);
|
||||
SendBulk(_bulkSendBuffer, _bulkTransferLength + 2);
|
||||
|
||||
_bulkTransferLength = 0;
|
||||
}
|
||||
|
||||
private void SendHID(params byte[] data) => _hidStream.Write(data);
|
||||
private void SendBulk(byte[] data, int count) => _bulkWriter!.Write(data, 0, count, 1000, out int _);
|
||||
|
||||
private byte[] Read() => _hidStream.Read();
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_hidStream.Dispose();
|
||||
_bulkDevice?.Dispose();
|
||||
_usbContext?.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
122
RGB.NET.Devices.PicoPi/PicoPiDeviceProvider.cs
Normal file
122
RGB.NET.Devices.PicoPi/PicoPiDeviceProvider.cs
Normal file
@ -0,0 +1,122 @@
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using HidSharp;
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Devices.PicoPi.Enum;
|
||||
using RGB.NET.HID;
|
||||
|
||||
namespace RGB.NET.Devices.PicoPi
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Represents a device provider responsible for PicoPi-devices.
|
||||
/// </summary>
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public class PicoPiDeviceProvider : AbstractRGBDeviceProvider
|
||||
{
|
||||
#region Constants
|
||||
|
||||
private const int AUTO_UPDATE_MODE_CHUNK_THRESHOLD = 2;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties & Fields
|
||||
|
||||
private static PicoPiDeviceProvider? _instance;
|
||||
/// <summary>
|
||||
/// Gets the singleton <see cref="PicoPiDeviceProvider"/> instance.
|
||||
/// </summary>
|
||||
public static PicoPiDeviceProvider Instance => _instance ?? new PicoPiDeviceProvider();
|
||||
|
||||
public static HIDLoader<int, int> DeviceDefinitions { get; } = new(PicoPiSDK.VENDOR_ID)
|
||||
{
|
||||
{ PicoPiSDK.HID_BULK_CONTROLLER_PID, RGBDeviceType.LedStripe, "WS2812B-Controller", LedMappings.StripeMapping, 0 },
|
||||
};
|
||||
|
||||
private readonly List<PicoPiSDK> _sdks = new();
|
||||
|
||||
public UpdateMode UpdateMode { get; set; } = UpdateMode.Auto;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PicoPiDeviceProvider"/> class.
|
||||
/// </summary>
|
||||
/// <exception cref="InvalidOperationException">Thrown if this constructor is called even if there is already an instance of this class.</exception>
|
||||
public PicoPiDeviceProvider()
|
||||
{
|
||||
if (_instance != null) throw new InvalidOperationException($"There can be only one instance of type {nameof(PicoPiDeviceProvider)}");
|
||||
_instance = this;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
protected override void InitializeSDK() { }
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override IEnumerable<IRGBDevice> GetLoadedDevices(RGBDeviceType loadFilter)
|
||||
{
|
||||
DeviceDefinitions.LoadFilter = loadFilter;
|
||||
|
||||
return base.GetLoadedDevices(loadFilter);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override IEnumerable<IRGBDevice> LoadDevices()
|
||||
{
|
||||
IEnumerable<(HIDDeviceDefinition<int, int> definition, HidDevice device)> devices = DeviceDefinitions.GetConnectedDevices();
|
||||
foreach ((HIDDeviceDefinition<int, int> definition, HidDevice device) in devices)
|
||||
{
|
||||
PicoPiSDK sdk = new(device);
|
||||
_sdks.Add(sdk);
|
||||
IDeviceUpdateTrigger updateTrigger = GetUpdateTrigger(sdk.Id.GetHashCode());
|
||||
foreach ((int channel, int ledCount, _) in sdk.Channels.Where(c => c.ledCount > 0))
|
||||
{
|
||||
PicoPiRGBDevice picoPiDevice = new(new PicoPiRGBDeviceInfo(definition.DeviceType, definition.Name, sdk.Id, sdk.Version, channel, ledCount), GetUpdateQueue(updateTrigger, sdk, channel, ledCount), definition.LedMapping);
|
||||
picoPiDevice.Initialize();
|
||||
yield return picoPiDevice;
|
||||
}
|
||||
|
||||
if (sdk.IsBulkSupported)
|
||||
updateTrigger.Update += (_, _) => sdk.FlushBulk();
|
||||
}
|
||||
}
|
||||
|
||||
private IUpdateQueue GetUpdateQueue(IDeviceUpdateTrigger updateTrigger, PicoPiSDK sdk, int channel, int ledCount)
|
||||
{
|
||||
switch (UpdateMode)
|
||||
{
|
||||
case UpdateMode.HID:
|
||||
return new PicoPiHIDUpdateQueue(updateTrigger, sdk, channel, ledCount);
|
||||
|
||||
case UpdateMode.BULK:
|
||||
if (!sdk.IsBulkSupported) throw new NotSupportedException("Bulk updates aren't supported for this device. Make sure the firmware is built with bulk support and the libusb driver is installed.");
|
||||
return new PicoPiBulkUpdateQueue(updateTrigger, sdk, channel, ledCount);
|
||||
|
||||
case UpdateMode.Auto:
|
||||
if (!sdk.IsBulkSupported || (sdk.Channels.Sum(c => (int)Math.Ceiling(c.ledCount / 20.0)) <= AUTO_UPDATE_MODE_CHUNK_THRESHOLD)) return new PicoPiHIDUpdateQueue(updateTrigger, sdk, channel, ledCount);
|
||||
return new PicoPiBulkUpdateQueue(updateTrigger, sdk, channel, ledCount);
|
||||
|
||||
default: throw new IndexOutOfRangeException($"Update mode {UpdateMode} is not supported.");
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
|
||||
foreach (PicoPiSDK sdk in _sdks)
|
||||
sdk.Dispose();
|
||||
_sdks.Clear();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
61
RGB.NET.Devices.PicoPi/RGB.NET.Devices.PicoPi.csproj
Normal file
61
RGB.NET.Devices.PicoPi/RGB.NET.Devices.PicoPi.csproj
Normal file
@ -0,0 +1,61 @@
|
||||
<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.Devices.PicoPi</Title>
|
||||
<AssemblyName>RGB.NET.Devices.PicoPi</AssemblyName>
|
||||
<AssemblyTitle>RGB.NET.Devices.PicoPi</AssemblyTitle>
|
||||
<PackageId>RGB.NET.Devices.PicoPi</PackageId>
|
||||
<RootNamespace>RGB.NET.Devices.PicoPi</RootNamespace>
|
||||
<Description>PicoPi-Device-Implementations of RGB.NET</Description>
|
||||
<Summary>PicoPi-Device-Implementations of RGB.NET, a C# (.NET) library for accessing various RGB-peripherals</Summary>
|
||||
<Copyright>Copyright © Darth Affe 2020</Copyright>
|
||||
<PackageCopyright>Copyright © Darth Affe 2020</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="LibUsbDotNet" Version="3.0.87-alpha" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\RGB.NET.Core\RGB.NET.Core.csproj" />
|
||||
<ProjectReference Include="..\RGB.NET.HID\RGB.NET.HID.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@ -0,0 +1,2 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=picopi/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
1
RGB.NET.Devices.PicoPi/ReadMe.md
Normal file
1
RGB.NET.Devices.PicoPi/ReadMe.md
Normal file
@ -0,0 +1 @@
|
||||
Check https://github.com/DarthAffe/RGB.NET-PicoPi for the required firmware.
|
||||
@ -32,7 +32,7 @@ namespace RGB.NET.Devices.Razer
|
||||
private void InitializeLayout()
|
||||
{
|
||||
for (int i = 0; i < _Defines.CHROMALINK_MAX_LEDS; i++)
|
||||
AddLed(LedId.Custom1 + i, new Point(i * 11, 0), new Size(10, 10));
|
||||
AddLed(LedId.Custom1 + i, new Point(i * 10, 0), new Size(10, 10));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@ -1,10 +1,327 @@
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Devices.Razer.Native;
|
||||
|
||||
namespace RGB.NET.Devices.Razer
|
||||
{
|
||||
public static class LedMappings
|
||||
{
|
||||
public static LedMapping<int> TODO { get; } = new()
|
||||
{ };
|
||||
public static readonly LedMapping<int> Keyboard = new()
|
||||
{
|
||||
//Row 0 is empty
|
||||
|
||||
#region Row 1
|
||||
|
||||
[LedId.Keyboard_Escape] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 2,
|
||||
[LedId.Keyboard_F1] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 4,
|
||||
[LedId.Keyboard_F2] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 5,
|
||||
[LedId.Keyboard_F3] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 6,
|
||||
[LedId.Keyboard_F4] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 7,
|
||||
[LedId.Keyboard_F5] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 8,
|
||||
[LedId.Keyboard_F6] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 9,
|
||||
[LedId.Keyboard_F7] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 10,
|
||||
[LedId.Keyboard_F8] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 11,
|
||||
[LedId.Keyboard_F9] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 12,
|
||||
[LedId.Keyboard_F10] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 13,
|
||||
[LedId.Keyboard_F11] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 14,
|
||||
[LedId.Keyboard_F12] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 15,
|
||||
[LedId.Keyboard_PrintScreen] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 16,
|
||||
[LedId.Keyboard_ScrollLock] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 17,
|
||||
[LedId.Keyboard_PauseBreak] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 18,
|
||||
[LedId.Logo] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 21,
|
||||
|
||||
#endregion
|
||||
|
||||
#region Row 2
|
||||
|
||||
[LedId.Keyboard_Macro1] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 1,
|
||||
[LedId.Keyboard_GraveAccentAndTilde] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 2,
|
||||
[LedId.Keyboard_1] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 3,
|
||||
[LedId.Keyboard_2] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 4,
|
||||
[LedId.Keyboard_3] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 5,
|
||||
[LedId.Keyboard_4] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 6,
|
||||
[LedId.Keyboard_5] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 7,
|
||||
[LedId.Keyboard_6] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 8,
|
||||
[LedId.Keyboard_7] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 9,
|
||||
[LedId.Keyboard_8] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 10,
|
||||
[LedId.Keyboard_9] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 11,
|
||||
[LedId.Keyboard_0] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 12,
|
||||
[LedId.Keyboard_MinusAndUnderscore] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 13,
|
||||
[LedId.Keyboard_EqualsAndPlus] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 14,
|
||||
[LedId.Keyboard_Backspace] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 15,
|
||||
[LedId.Keyboard_Insert] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 16,
|
||||
[LedId.Keyboard_Home] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 17,
|
||||
[LedId.Keyboard_PageUp] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 18,
|
||||
[LedId.Keyboard_NumLock] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 19,
|
||||
[LedId.Keyboard_NumSlash] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 20,
|
||||
[LedId.Keyboard_NumAsterisk] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 21,
|
||||
[LedId.Keyboard_NumMinus] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 22,
|
||||
|
||||
#endregion
|
||||
|
||||
#region Row 3
|
||||
|
||||
[LedId.Keyboard_Macro2] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 1,
|
||||
[LedId.Keyboard_Tab] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 2,
|
||||
[LedId.Keyboard_Q] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 3,
|
||||
[LedId.Keyboard_W] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 4,
|
||||
[LedId.Keyboard_E] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 5,
|
||||
[LedId.Keyboard_R] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 6,
|
||||
[LedId.Keyboard_T] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 7,
|
||||
[LedId.Keyboard_Y] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 8,
|
||||
[LedId.Keyboard_U] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 9,
|
||||
[LedId.Keyboard_I] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 10,
|
||||
[LedId.Keyboard_O] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 11,
|
||||
[LedId.Keyboard_P] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 12,
|
||||
[LedId.Keyboard_BracketLeft] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 13,
|
||||
[LedId.Keyboard_BracketRight] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 14,
|
||||
[LedId.Keyboard_Backslash] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 15,
|
||||
[LedId.Keyboard_Delete] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 16,
|
||||
[LedId.Keyboard_End] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 17,
|
||||
[LedId.Keyboard_PageDown] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 18,
|
||||
[LedId.Keyboard_Num7] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 19,
|
||||
[LedId.Keyboard_Num8] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 20,
|
||||
[LedId.Keyboard_Num9] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 21,
|
||||
[LedId.Keyboard_NumPlus] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 22,
|
||||
|
||||
#endregion
|
||||
|
||||
#region Row 4
|
||||
|
||||
[LedId.Keyboard_Macro3] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 1,
|
||||
[LedId.Keyboard_CapsLock] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 2,
|
||||
[LedId.Keyboard_A] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 3,
|
||||
[LedId.Keyboard_S] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 4,
|
||||
[LedId.Keyboard_D] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 5,
|
||||
[LedId.Keyboard_F] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 6,
|
||||
[LedId.Keyboard_G] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 7,
|
||||
[LedId.Keyboard_H] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 8,
|
||||
[LedId.Keyboard_J] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 9,
|
||||
[LedId.Keyboard_K] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 10,
|
||||
[LedId.Keyboard_L] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 11,
|
||||
[LedId.Keyboard_SemicolonAndColon] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 12,
|
||||
[LedId.Keyboard_ApostropheAndDoubleQuote] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 13,
|
||||
[LedId.Keyboard_NonUsTilde] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 14,
|
||||
[LedId.Keyboard_Enter] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 15,
|
||||
[LedId.Keyboard_Num4] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 19,
|
||||
[LedId.Keyboard_Num5] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 20,
|
||||
[LedId.Keyboard_Num6] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 21,
|
||||
|
||||
#endregion
|
||||
|
||||
#region Row 5
|
||||
|
||||
[LedId.Keyboard_Macro4] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 1,
|
||||
[LedId.Keyboard_LeftShift] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 2,
|
||||
[LedId.Keyboard_NonUsBackslash] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 3,
|
||||
[LedId.Keyboard_Z] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 4,
|
||||
[LedId.Keyboard_X] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 5,
|
||||
[LedId.Keyboard_C] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 6,
|
||||
[LedId.Keyboard_V] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 7,
|
||||
[LedId.Keyboard_B] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 8,
|
||||
[LedId.Keyboard_N] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 9,
|
||||
[LedId.Keyboard_M] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 10,
|
||||
[LedId.Keyboard_CommaAndLessThan] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 11,
|
||||
[LedId.Keyboard_PeriodAndBiggerThan] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 12,
|
||||
[LedId.Keyboard_SlashAndQuestionMark] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 13,
|
||||
[LedId.Keyboard_RightShift] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 15,
|
||||
[LedId.Keyboard_ArrowUp] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 17,
|
||||
[LedId.Keyboard_Num1] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 19,
|
||||
[LedId.Keyboard_Num2] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 20,
|
||||
[LedId.Keyboard_Num3] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 21,
|
||||
[LedId.Keyboard_NumEnter] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 22,
|
||||
|
||||
#endregion
|
||||
|
||||
#region Row 6
|
||||
|
||||
[LedId.Keyboard_Macro5] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 1,
|
||||
[LedId.Keyboard_LeftCtrl] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 2,
|
||||
[LedId.Keyboard_LeftGui] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 3,
|
||||
[LedId.Keyboard_LeftAlt] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 4,
|
||||
[LedId.Keyboard_Space] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 8,
|
||||
[LedId.Keyboard_RightAlt] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 12,
|
||||
[LedId.Keyboard_RightGui] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 13,
|
||||
[LedId.Keyboard_Application] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 14,
|
||||
[LedId.Keyboard_RightCtrl] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 15,
|
||||
[LedId.Keyboard_ArrowLeft] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 16,
|
||||
[LedId.Keyboard_ArrowDown] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 17,
|
||||
[LedId.Keyboard_ArrowRight] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 18,
|
||||
[LedId.Keyboard_Num0] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 20,
|
||||
[LedId.Keyboard_NumPeriodAndDelete] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 21,
|
||||
|
||||
#endregion
|
||||
|
||||
//Row 7 is also empty
|
||||
};
|
||||
|
||||
public static readonly LedMapping<int> LaptopKeyboard = new()
|
||||
{
|
||||
//Row 0 is empty
|
||||
|
||||
#region Row 1
|
||||
|
||||
[LedId.Keyboard_Escape] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 1,
|
||||
[LedId.Keyboard_F1] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 2,
|
||||
[LedId.Keyboard_F2] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 3,
|
||||
[LedId.Keyboard_F3] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 4,
|
||||
[LedId.Keyboard_F4] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 5,
|
||||
[LedId.Keyboard_F5] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 6,
|
||||
[LedId.Keyboard_F6] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 7,
|
||||
[LedId.Keyboard_F7] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 8,
|
||||
[LedId.Keyboard_F8] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 9,
|
||||
[LedId.Keyboard_F9] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 10,
|
||||
[LedId.Keyboard_F10] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 11,
|
||||
[LedId.Keyboard_F11] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 12,
|
||||
[LedId.Keyboard_F12] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 13,
|
||||
[LedId.Keyboard_Insert] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 14,
|
||||
[LedId.Keyboard_Delete] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 15,
|
||||
|
||||
#endregion
|
||||
|
||||
#region Row 2
|
||||
|
||||
[LedId.Keyboard_GraveAccentAndTilde] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 1,
|
||||
[LedId.Keyboard_1] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 2,
|
||||
[LedId.Keyboard_2] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 3,
|
||||
[LedId.Keyboard_3] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 4,
|
||||
[LedId.Keyboard_4] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 5,
|
||||
[LedId.Keyboard_5] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 6,
|
||||
[LedId.Keyboard_6] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 7,
|
||||
[LedId.Keyboard_7] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 8,
|
||||
[LedId.Keyboard_8] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 9,
|
||||
[LedId.Keyboard_9] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 10,
|
||||
[LedId.Keyboard_0] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 11,
|
||||
[LedId.Keyboard_MinusAndUnderscore] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 12,
|
||||
[LedId.Keyboard_EqualsAndPlus] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 13,
|
||||
[LedId.Keyboard_Backspace] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 14,
|
||||
|
||||
#endregion
|
||||
|
||||
#region Row 3
|
||||
|
||||
[LedId.Keyboard_Tab] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 2,
|
||||
[LedId.Keyboard_Q] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 3,
|
||||
[LedId.Keyboard_W] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 4,
|
||||
[LedId.Keyboard_E] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 5,
|
||||
[LedId.Keyboard_R] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 6,
|
||||
[LedId.Keyboard_T] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 7,
|
||||
[LedId.Keyboard_Y] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 8,
|
||||
[LedId.Keyboard_U] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 9,
|
||||
[LedId.Keyboard_I] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 10,
|
||||
[LedId.Keyboard_O] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 11,
|
||||
[LedId.Keyboard_P] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 12,
|
||||
[LedId.Keyboard_BracketLeft] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 13,
|
||||
[LedId.Keyboard_BracketRight] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 14,
|
||||
[LedId.Keyboard_Backslash] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 15,
|
||||
|
||||
#endregion
|
||||
|
||||
#region Row 4
|
||||
|
||||
[LedId.Keyboard_CapsLock] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 1,
|
||||
[LedId.Keyboard_A] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 3,
|
||||
[LedId.Keyboard_S] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 4,
|
||||
[LedId.Keyboard_D] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 5,
|
||||
[LedId.Keyboard_F] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 6,
|
||||
[LedId.Keyboard_G] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 7,
|
||||
[LedId.Keyboard_H] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 8,
|
||||
[LedId.Keyboard_J] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 9,
|
||||
[LedId.Keyboard_K] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 10,
|
||||
[LedId.Keyboard_L] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 11,
|
||||
[LedId.Keyboard_SemicolonAndColon] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 12,
|
||||
[LedId.Keyboard_ApostropheAndDoubleQuote] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 13,
|
||||
//[LedId.Keyboard_NonUsTilde] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 14, //TODO diogotr7 15.04.2021: investigate
|
||||
[LedId.Keyboard_Enter] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 16,
|
||||
|
||||
#endregion
|
||||
|
||||
#region Row 5
|
||||
|
||||
[LedId.Keyboard_LeftShift] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 2,
|
||||
[LedId.Keyboard_Z] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 3,
|
||||
[LedId.Keyboard_X] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 4,
|
||||
[LedId.Keyboard_C] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 5,
|
||||
[LedId.Keyboard_V] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 6,
|
||||
[LedId.Keyboard_B] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 7,
|
||||
[LedId.Keyboard_N] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 8,
|
||||
[LedId.Keyboard_M] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 9,
|
||||
[LedId.Keyboard_CommaAndLessThan] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 10,
|
||||
[LedId.Keyboard_PeriodAndBiggerThan] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 11,
|
||||
[LedId.Keyboard_SlashAndQuestionMark] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 12,
|
||||
[LedId.Keyboard_ArrowUp] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 13,
|
||||
[LedId.Keyboard_RightShift] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 14,
|
||||
|
||||
#endregion
|
||||
|
||||
#region Row 6
|
||||
|
||||
[LedId.Keyboard_LeftCtrl] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 1,
|
||||
[LedId.Keyboard_Custom1] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 2,//left fn
|
||||
[LedId.Keyboard_LeftGui] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 3,
|
||||
[LedId.Keyboard_LeftAlt] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 4,
|
||||
[LedId.Keyboard_Space] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 7,
|
||||
[LedId.Keyboard_RightAlt] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 10,
|
||||
[LedId.Keyboard_RightCtrl] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 11,
|
||||
[LedId.Keyboard_ArrowLeft] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 12,
|
||||
[LedId.Keyboard_ArrowDown] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 13,
|
||||
[LedId.Keyboard_ArrowRight] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 14,
|
||||
[LedId.Keyboard_Custom2] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 15,//right fn
|
||||
|
||||
#endregion
|
||||
|
||||
//Row 7 is also empty
|
||||
};
|
||||
|
||||
public static readonly LedMapping<int> Mouse = new()
|
||||
{
|
||||
//row 0 empty
|
||||
|
||||
//row 1
|
||||
[LedId.Mouse1] = (_Defines.MOUSE_MAX_COLUMN * 1) + 0,
|
||||
[LedId.Mouse2] = (_Defines.MOUSE_MAX_COLUMN * 1) + 6,
|
||||
|
||||
//row 2
|
||||
[LedId.Mouse3] = (_Defines.MOUSE_MAX_COLUMN * 2) + 0,
|
||||
[LedId.Mouse4] = (_Defines.MOUSE_MAX_COLUMN * 2) + 3,
|
||||
[LedId.Mouse5] = (_Defines.MOUSE_MAX_COLUMN * 2) + 6,
|
||||
|
||||
//row 3
|
||||
[LedId.Mouse6] = (_Defines.MOUSE_MAX_COLUMN * 3) + 0,
|
||||
[LedId.Mouse7] = (_Defines.MOUSE_MAX_COLUMN * 3) + 6,
|
||||
|
||||
//row 4
|
||||
[LedId.Mouse8] = (_Defines.MOUSE_MAX_COLUMN * 4) + 0,
|
||||
[LedId.Mouse9] = (_Defines.MOUSE_MAX_COLUMN * 4) + 3,
|
||||
[LedId.Mouse10] = (_Defines.MOUSE_MAX_COLUMN * 4) + 6,
|
||||
|
||||
//row 5
|
||||
[LedId.Mouse11] = (_Defines.MOUSE_MAX_COLUMN * 5) + 0,
|
||||
[LedId.Mouse12] = (_Defines.MOUSE_MAX_COLUMN * 5) + 6,
|
||||
|
||||
//row 6
|
||||
[LedId.Mouse13] = (_Defines.MOUSE_MAX_COLUMN * 6) + 0,
|
||||
[LedId.Mouse14] = (_Defines.MOUSE_MAX_COLUMN * 6) + 6,
|
||||
|
||||
//row 7
|
||||
[LedId.Mouse15] = (_Defines.MOUSE_MAX_COLUMN * 7) + 0,
|
||||
[LedId.Mouse16] = (_Defines.MOUSE_MAX_COLUMN * 7) + 3,
|
||||
[LedId.Mouse17] = (_Defines.MOUSE_MAX_COLUMN * 7) + 6,
|
||||
|
||||
//row 8
|
||||
[LedId.Mouse18] = (_Defines.MOUSE_MAX_COLUMN * 8) + 1,
|
||||
[LedId.Mouse19] = (_Defines.MOUSE_MAX_COLUMN * 8) + 2,
|
||||
[LedId.Mouse20] = (_Defines.MOUSE_MAX_COLUMN * 8) + 3,
|
||||
[LedId.Mouse21] = (_Defines.MOUSE_MAX_COLUMN * 8) + 4,
|
||||
[LedId.Mouse22] = (_Defines.MOUSE_MAX_COLUMN * 8) + 5,
|
||||
};
|
||||
|
||||
//TODO DarthAffe 27.04.2021: Are mappings for these possible?
|
||||
public static readonly LedMapping<int> Mousepad = new();
|
||||
|
||||
public static readonly LedMapping<int> Headset = new();
|
||||
|
||||
public static readonly LedMapping<int> Keypad = new();
|
||||
|
||||
public static readonly LedMapping<int> ChromaLink = new();
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ namespace RGB.NET.Devices.Razer
|
||||
private void InitializeLayout()
|
||||
{
|
||||
for (int i = 0; i < _Defines.HEADSET_MAX_LEDS; i++)
|
||||
AddLed(LedId.Headset1 + i, new Point(i * 11, 0), new Size(10, 10));
|
||||
AddLed(LedId.Headset1 + i, new Point(i * 10, 0), new Size(10, 10));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@ -14,7 +14,9 @@ namespace RGB.NET.Devices.Razer
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
IKeyboardDeviceInfo IKeyboard.DeviceInfo => (IKeyboardDeviceInfo) DeviceInfo;
|
||||
IKeyboardDeviceInfo IKeyboard.DeviceInfo => (IKeyboardDeviceInfo)DeviceInfo;
|
||||
|
||||
private readonly LedMapping<int> _ledMapping;
|
||||
|
||||
#endregion
|
||||
|
||||
@ -25,9 +27,11 @@ namespace RGB.NET.Devices.Razer
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Razer.RazerKeyboardRGBDevice" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by CUE for the keyboard.</param>
|
||||
internal RazerKeyboardRGBDevice(RazerKeyboardRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
|
||||
internal RazerKeyboardRGBDevice(RazerKeyboardRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger, LedMapping<int> ledMapping)
|
||||
: base(info, new RazerKeyboardUpdateQueue(updateTrigger))
|
||||
{
|
||||
this._ledMapping = ledMapping;
|
||||
|
||||
InitializeLayout();
|
||||
}
|
||||
|
||||
@ -37,14 +41,14 @@ namespace RGB.NET.Devices.Razer
|
||||
|
||||
private void InitializeLayout()
|
||||
{
|
||||
// TODO Look at DeviceInfo.EndpointType and act accordingly for both Keyboard and LaptopKeyboard
|
||||
for (int i = 0; i < _Defines.KEYBOARD_MAX_ROW; i++)
|
||||
for (int j = 0; j < _Defines.KEYBOARD_MAX_COLUMN; j++)
|
||||
AddLed(LedId.Keyboard_Escape + ((i * _Defines.KEYBOARD_MAX_COLUMN) + j), new Point(j * 20, i * 20), new Size(19, 19));
|
||||
for (int row = 0; row < _Defines.KEYBOARD_MAX_ROW; row++)
|
||||
for (int column = 0; column < _Defines.KEYBOARD_MAX_COLUMN; column++)
|
||||
if (_ledMapping.TryGetValue((row * _Defines.KEYBOARD_MAX_COLUMN) + column, out LedId id))
|
||||
AddLed(id, new Point(column * 19, row * 19), new Size(19, 19));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override object? GetLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Keyboard_Escape;
|
||||
protected override object? GetLedCustomData(LedId ledId) => _ledMapping[ledId];
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
@ -31,9 +31,9 @@ namespace RGB.NET.Devices.Razer
|
||||
|
||||
private void InitializeLayout()
|
||||
{
|
||||
for (int i = 0; i < _Defines.KEYPAD_MAX_ROW; i++)
|
||||
for (int j = 0; j < _Defines.KEYPAD_MAX_COLUMN; j++)
|
||||
AddLed(LedId.Keypad1 + ((i * _Defines.KEYPAD_MAX_COLUMN) + j), new Point(j * 20, i * 20), new Size(19, 19));
|
||||
for (int row = 0; row < _Defines.KEYPAD_MAX_ROW; row++)
|
||||
for (int column = 0; column < _Defines.KEYPAD_MAX_COLUMN; column++)
|
||||
AddLed(LedId.Keypad1 + ((row * _Defines.KEYPAD_MAX_COLUMN) + column), new Point(column * 19, row * 19), new Size(19, 19));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@ -12,6 +12,12 @@ namespace RGB.NET.Devices.Razer
|
||||
/// </summary>
|
||||
public class RazerMouseRGBDevice : RazerRGBDevice, IMouse
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private readonly LedMapping<int> _ledMapping;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <inheritdoc />
|
||||
@ -19,9 +25,11 @@ namespace RGB.NET.Devices.Razer
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Razer.RazerMouseRGBDevice" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by CUE for the mouse.</param>
|
||||
internal RazerMouseRGBDevice(RazerRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
|
||||
internal RazerMouseRGBDevice(RazerRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger, LedMapping<int> ledMapping)
|
||||
: base(info, new RazerMouseUpdateQueue(updateTrigger))
|
||||
{
|
||||
this._ledMapping = ledMapping;
|
||||
|
||||
InitializeLayout();
|
||||
}
|
||||
|
||||
@ -31,13 +39,14 @@ namespace RGB.NET.Devices.Razer
|
||||
|
||||
private void InitializeLayout()
|
||||
{
|
||||
for (int i = 0; i < _Defines.MOUSE_MAX_ROW; i++)
|
||||
for (int j = 0; j < _Defines.MOUSE_MAX_COLUMN; j++)
|
||||
AddLed(LedId.Mouse1 + ((i * _Defines.MOUSE_MAX_COLUMN) + j), new Point(j * 11, i * 11), new Size(10, 10));
|
||||
for (int row = 0; row < _Defines.MOUSE_MAX_ROW; row++)
|
||||
for (int column = 0; column < _Defines.MOUSE_MAX_COLUMN; column++)
|
||||
if (_ledMapping.TryGetValue((row * _Defines.MOUSE_MAX_COLUMN) + column, out LedId ledId))
|
||||
AddLed(ledId, new Point(column * 10, row * 10), new Size(10, 10));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override object? GetLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Mouse1;
|
||||
protected override object? GetLedCustomData(LedId ledId) => _ledMapping[ledId];
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ namespace RGB.NET.Devices.Razer
|
||||
private void InitializeLayout()
|
||||
{
|
||||
for (int i = 0; i < _Defines.MOUSEPAD_MAX_LEDS; i++)
|
||||
AddLed(LedId.Mousepad1 + i, new Point(i * 11, 0), new Size(10, 10));
|
||||
AddLed(LedId.Mousepad1 + i, new Point(i * 10, 0), new Size(10, 10));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@ -36,6 +36,7 @@ namespace RGB.NET.Devices.Razer.Native
|
||||
if (dllPath == null) throw new RGBDeviceException($"Can't find the Razer-SDK at one of the expected locations:\r\n '{string.Join("\r\n", possiblePathList.Select(Path.GetFullPath))}'");
|
||||
|
||||
_dllHandle = LoadLibrary(dllPath);
|
||||
if (_dllHandle == IntPtr.Zero) throw new RGBDeviceException($"Razer LoadLibrary failed with error code {Marshal.GetLastWin32Error()}");
|
||||
|
||||
_initPointer = (InitPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "Init"), typeof(InitPointer));
|
||||
_unInitPointer = (UnInitPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "UnInit"), typeof(UnInitPointer));
|
||||
|
||||
@ -47,149 +47,151 @@ namespace RGB.NET.Devices.Razer
|
||||
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 },
|
||||
{ 0x010D, RGBDeviceType.Keyboard, "BlackWidow Ultimate 2012", LedMappings.Keyboard, RazerEndpointType.Keyboard },
|
||||
{ 0x010E, RGBDeviceType.Keyboard, "BlackWidow Classic (Alternate)", LedMappings.Keyboard, RazerEndpointType.Keyboard },
|
||||
{ 0x010F, RGBDeviceType.Keyboard, "Anansi", LedMappings.Keyboard, RazerEndpointType.Keyboard },
|
||||
{ 0x011A, RGBDeviceType.Keyboard, "BlackWidow Ultimate 2013", LedMappings.Keyboard, RazerEndpointType.Keyboard },
|
||||
{ 0x011B, RGBDeviceType.Keyboard, "BlackWidow Stealth", LedMappings.Keyboard, RazerEndpointType.Keyboard },
|
||||
{ 0x0202, RGBDeviceType.Keyboard, "DeathStalker Expert", LedMappings.Keyboard, RazerEndpointType.Keyboard },
|
||||
{ 0x0203, RGBDeviceType.Keyboard, "BlackWidow Chroma", LedMappings.Keyboard, RazerEndpointType.Keyboard },
|
||||
{ 0x0204, RGBDeviceType.Keyboard, "DeathStalker Chroma", LedMappings.Keyboard, RazerEndpointType.Keyboard },
|
||||
{ 0x0205, RGBDeviceType.Keyboard, "Blade Stealth", LedMappings.LaptopKeyboard, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x0209, RGBDeviceType.Keyboard, "BlackWidow Tournament Edition Chroma", LedMappings.Keyboard, RazerEndpointType.Keyboard },
|
||||
{ 0x020F, RGBDeviceType.Keyboard, "Blade QHD", LedMappings.Keyboard, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x0210, RGBDeviceType.Keyboard, "Blade Pro (Late 2016)", LedMappings.LaptopKeyboard, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x0211, RGBDeviceType.Keyboard, "BlackWidow Chroma (Overwatch)", LedMappings.Keyboard, RazerEndpointType.Keyboard },
|
||||
{ 0x0214, RGBDeviceType.Keyboard, "BlackWidow Ultimate 2016", LedMappings.Keyboard, RazerEndpointType.Keyboard },
|
||||
{ 0x0216, RGBDeviceType.Keyboard, "BlackWidow X Chroma", LedMappings.Keyboard, RazerEndpointType.Keyboard },
|
||||
{ 0x0217, RGBDeviceType.Keyboard, "BlackWidow X Ultimate", LedMappings.Keyboard, RazerEndpointType.Keyboard },
|
||||
{ 0x021A, RGBDeviceType.Keyboard, "BlackWidow X Tournament Edition Chroma", LedMappings.Keyboard, RazerEndpointType.Keyboard },
|
||||
{ 0x021E, RGBDeviceType.Keyboard, "Ornata Chroma", LedMappings.Keyboard, RazerEndpointType.Keyboard },
|
||||
{ 0x021F, RGBDeviceType.Keyboard, "Ornata", LedMappings.Keyboard, RazerEndpointType.Keyboard },
|
||||
{ 0x0220, RGBDeviceType.Keyboard, "Blade Stealth (Late 2016)", LedMappings.LaptopKeyboard, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x0221, RGBDeviceType.Keyboard, "BlackWidow Chroma V2", LedMappings.Keyboard, RazerEndpointType.Keyboard },
|
||||
{ 0x0224, RGBDeviceType.Keyboard, "Blade (Late 2016)", LedMappings.LaptopKeyboard, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x0225, RGBDeviceType.Keyboard, "Blade Pro (2017)", LedMappings.LaptopKeyboard, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x0226, RGBDeviceType.Keyboard, "Huntsman Elite", LedMappings.Keyboard, RazerEndpointType.Keyboard },
|
||||
{ 0x0227, RGBDeviceType.Keyboard, "Huntsman", LedMappings.Keyboard, RazerEndpointType.Keyboard },
|
||||
{ 0x0228, RGBDeviceType.Keyboard, "BlackWidow Elite", LedMappings.Keyboard, RazerEndpointType.Keyboard },
|
||||
{ 0x022A, RGBDeviceType.Keyboard, "Cynosa Chroma", LedMappings.Keyboard, RazerEndpointType.Keyboard },
|
||||
{ 0x022D, RGBDeviceType.Keyboard, "Blade Stealth (Mid 2017)", LedMappings.LaptopKeyboard, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x022F, RGBDeviceType.Keyboard, "Blade Pro FullHD (2017)", LedMappings.LaptopKeyboard, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x0232, RGBDeviceType.Keyboard, "Blade Stealth (Late 2017)", LedMappings.LaptopKeyboard, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x0233, RGBDeviceType.Keyboard, "Blade 15 (2018)", LedMappings.LaptopKeyboard, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x0234, RGBDeviceType.Keyboard, "Blade Pro 17 (2019)", LedMappings.LaptopKeyboard, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x0235, RGBDeviceType.Keyboard, "BlackWidow Lite (2018)", LedMappings.Keyboard, RazerEndpointType.Keyboard },
|
||||
{ 0x0237, RGBDeviceType.Keyboard, "BlackWidow Essential", LedMappings.Keyboard, RazerEndpointType.Keyboard },
|
||||
{ 0x0239, RGBDeviceType.Keyboard, "Blade Stealth (2019)", LedMappings.LaptopKeyboard, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x023A, RGBDeviceType.Keyboard, "Blade 15 (2019) Advanced", LedMappings.LaptopKeyboard, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x023B, RGBDeviceType.Keyboard, "Blade 15 (2018) Base Model", LedMappings.LaptopKeyboard, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x023F, RGBDeviceType.Keyboard, "Cynosa Lite", LedMappings.Keyboard, RazerEndpointType.Keyboard },
|
||||
{ 0x0240, RGBDeviceType.Keyboard, "Blade 15 (2018) Mercury", LedMappings.LaptopKeyboard, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x0241, RGBDeviceType.Keyboard, "BlackWidow (2019)", LedMappings.Keyboard, RazerEndpointType.Keyboard },
|
||||
{ 0x0243, RGBDeviceType.Keyboard, "Huntsman Tournament Edition", LedMappings.Keyboard, RazerEndpointType.Keyboard },
|
||||
{ 0x0245, RGBDeviceType.Keyboard, "Blade 15 (Mid 2019) Mercury", LedMappings.LaptopKeyboard, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x0246, RGBDeviceType.Keyboard, "Blade 15 (Mid 2019) Base", LedMappings.LaptopKeyboard, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x024A, RGBDeviceType.Keyboard, "Blade Stealth (Late 2019)", LedMappings.LaptopKeyboard, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x024C, RGBDeviceType.Keyboard, "Blade Pro (Late 2019)", LedMappings.LaptopKeyboard, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x024D, RGBDeviceType.Keyboard, "Blade 15 Studio Edition (2019)", LedMappings.LaptopKeyboard, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x0252, RGBDeviceType.Keyboard, "Blade Stealth (Early 2020)", LedMappings.LaptopKeyboard, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x0253, RGBDeviceType.Keyboard, "Blade 15 Advanced (2020)", LedMappings.LaptopKeyboard, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x0255, RGBDeviceType.Keyboard, "Blade 15 (Early 2020) Base", LedMappings.LaptopKeyboard, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x0259, RGBDeviceType.Keyboard, "Blade Stealth (Late 2020)", LedMappings.LaptopKeyboard, RazerEndpointType.LaptopKeyboard },
|
||||
{ 0x25A, RGBDeviceType.Keyboard, "BlackWidow V3 Pro", LedMappings.Keyboard, RazerEndpointType.Keyboard }, // The keyboard, only present when connected with cable
|
||||
{ 0x25C, RGBDeviceType.Keyboard, "BlackWidow V3 Pro", LedMappings.Keyboard, RazerEndpointType.Keyboard }, // The dongle, may not be present when connected with cable
|
||||
{ 0x025D, RGBDeviceType.Keyboard, "Ornata Chroma V2", LedMappings.Keyboard, RazerEndpointType.Keyboard },
|
||||
{ 0x025E, RGBDeviceType.Keyboard, "Cynosa V2", LedMappings.Keyboard, 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 },
|
||||
{ 0x0013, RGBDeviceType.Mouse, "Orochi 2011", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x0016, RGBDeviceType.Mouse, "DeathAdder 3.5G", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x0020, RGBDeviceType.Mouse, "Abyssus 1800", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x0024, RGBDeviceType.Mouse, "Mamba 2012 (Wired)", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x0025, RGBDeviceType.Mouse, "Mamba 2012 (Wireless)", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x002E, RGBDeviceType.Mouse, "Naga 2012", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x002F, RGBDeviceType.Mouse, "Imperator 2012", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x0032, RGBDeviceType.Mouse, "Ouroboros 2012", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x0034, RGBDeviceType.Mouse, "Taipan", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x0036, RGBDeviceType.Mouse, "Naga Hex (Red)", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x0037, RGBDeviceType.Mouse, "DeathAdder 2013", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x0038, RGBDeviceType.Mouse, "DeathAdder 1800", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x0039, RGBDeviceType.Mouse, "Orochi 2013", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x0040, RGBDeviceType.Mouse, "Naga 2014", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x0041, RGBDeviceType.Mouse, "Naga Hex", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x0042, RGBDeviceType.Mouse, "Abyssus 2014", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x0043, RGBDeviceType.Mouse, "DeathAdder Chroma", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x0044, RGBDeviceType.Mouse, "Mamba (Wired)", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x0045, RGBDeviceType.Mouse, "Mamba (Wireless)", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x0046, RGBDeviceType.Mouse, "Mamba Tournament Edition", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x0048, RGBDeviceType.Mouse, "Orochi (Wired)", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x004C, RGBDeviceType.Mouse, "Diamondback Chroma", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x004F, RGBDeviceType.Mouse, "DeathAdder 2000", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x0050, RGBDeviceType.Mouse, "Naga Hex V2", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x0053, RGBDeviceType.Mouse, "Naga Chroma", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x0054, RGBDeviceType.Mouse, "DeathAdder 3500", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x0059, RGBDeviceType.Mouse, "Lancehead (Wired)", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x005A, RGBDeviceType.Mouse, "Lancehead (Wireless)", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x005B, RGBDeviceType.Mouse, "Abyssus V2", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x005C, RGBDeviceType.Mouse, "DeathAdder Elite", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x005E, RGBDeviceType.Mouse, "Abyssus 2000", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x0060, RGBDeviceType.Mouse, "Lancehead Tournament Edition", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x0062, RGBDeviceType.Mouse, "Atheris (Receiver)", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x0064, RGBDeviceType.Mouse, "Basilisk", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x0067, RGBDeviceType.Mouse, "Naga Trinity", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x006A, RGBDeviceType.Mouse, "Abyssus Elite (D.Va Edition)", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x006B, RGBDeviceType.Mouse, "Abyssus Essential", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x006C, RGBDeviceType.Mouse, "Mamba Elite (Wired)", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x006E, RGBDeviceType.Mouse, "DeathAdder Essential", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x006F, RGBDeviceType.Mouse, "Lancehead Wireless (Receiver)", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x0070, RGBDeviceType.Mouse, "Lancehead Wireless (Wired)", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x0071, RGBDeviceType.Mouse, "DeathAdder Essential (White Edition)", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x0072, RGBDeviceType.Mouse, "Mamba Wireless (Receiver)", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x0073, RGBDeviceType.Mouse, "Mamba Wireless (Wired)", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x0078, RGBDeviceType.Mouse, "Viper", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x007A, RGBDeviceType.Mouse, "Viper Ultimate (Wired)", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x007B, RGBDeviceType.Mouse, "Viper Ultimate (Wireless)", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x007C, RGBDeviceType.Mouse, "DeathAdder V2 Pro (Wired)", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x007D, RGBDeviceType.Mouse, "DeathAdder V2 Pro (Wireless)", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x0083, RGBDeviceType.Mouse, "Basilisk X HyperSpeed", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x0088, RGBDeviceType.Mouse, "Basilisk Ultimate", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x0084, RGBDeviceType.Mouse, "DeathAdder V2", LedMappings.Mouse, RazerEndpointType.Mouse },
|
||||
{ 0x008A, RGBDeviceType.Mouse, "Viper Mini", LedMappings.Mouse, 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 },
|
||||
{ 0x0068, RGBDeviceType.Mousepad, "Firefly Hyperflux", LedMappings.Mousepad, RazerEndpointType.Mousepad },
|
||||
{ 0x0C00, RGBDeviceType.Mousepad, "Firefly", LedMappings.Mousepad, RazerEndpointType.Mousepad },
|
||||
{ 0x0C01, RGBDeviceType.Mousepad, "Goliathus", LedMappings.Mousepad, RazerEndpointType.ChromaLink },
|
||||
{ 0x0C02, RGBDeviceType.Mousepad, "Goliathus Extended", LedMappings.Mousepad, RazerEndpointType.ChromaLink },
|
||||
{ 0x0C04, RGBDeviceType.Mousepad, "Firefly v2", LedMappings.Mousepad, 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 },
|
||||
{ 0x0501, RGBDeviceType.Headset, "Kraken 7.1", LedMappings.Headset, RazerEndpointType.Headset },
|
||||
{ 0x0504, RGBDeviceType.Headset, "Kraken 7.1 Chroma", LedMappings.Headset, RazerEndpointType.Headset },
|
||||
{ 0x0506, RGBDeviceType.Headset, "Kraken 7.1", LedMappings.Headset, RazerEndpointType.Headset },
|
||||
{ 0x0510, RGBDeviceType.Headset, "Kraken 7.1 V2", LedMappings.Headset, RazerEndpointType.Headset },
|
||||
{ 0x051A, RGBDeviceType.Headset, "Nari Ultimate", LedMappings.Headset, RazerEndpointType.Headset },
|
||||
{ 0x0527, RGBDeviceType.Headset, "Kraken Ultimate", LedMappings.Headset, RazerEndpointType.Headset },
|
||||
{ 0x0F19, RGBDeviceType.Headset, "Kraken Kitty Edition", LedMappings.Headset, 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 },
|
||||
{ 0x0111, RGBDeviceType.Keypad, "Nostromo", LedMappings.Keypad, RazerEndpointType.Keypad },
|
||||
{ 0x0113, RGBDeviceType.Keypad, "Orbweaver", LedMappings.Keypad, RazerEndpointType.Keypad },
|
||||
{ 0x0201, RGBDeviceType.Keypad, "Tartarus", LedMappings.Keypad, RazerEndpointType.Keypad },
|
||||
{ 0x0207, RGBDeviceType.Keypad, "Orbweaver Chroma", LedMappings.Keypad, RazerEndpointType.Keypad },
|
||||
{ 0x0208, RGBDeviceType.Keypad, "Tartarus Chroma", LedMappings.Keypad, RazerEndpointType.Keypad },
|
||||
{ 0x022B, RGBDeviceType.Keypad, "Tartarus V2", LedMappings.Keypad, RazerEndpointType.Keypad },
|
||||
{ 0x0244, RGBDeviceType.Keypad, "Tartarus Pro", LedMappings.Keypad, 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 }
|
||||
{ 0x0215, RGBDeviceType.GraphicsCard, "Core", LedMappings.ChromaLink, RazerEndpointType.ChromaLink },
|
||||
{ 0x0F08, RGBDeviceType.HeadsetStand, "Base Station Chroma", LedMappings.ChromaLink, RazerEndpointType.ChromaLink },
|
||||
{ 0x0517, RGBDeviceType.Speaker, "Nommo Chroma", LedMappings.ChromaLink, RazerEndpointType.ChromaLink },
|
||||
{ 0x0518, RGBDeviceType.Speaker, "Nommo Pro", LedMappings.ChromaLink, RazerEndpointType.ChromaLink },
|
||||
{ 0x0F07, RGBDeviceType.Unknown, "Chroma Mug Holder", LedMappings.ChromaLink, RazerEndpointType.ChromaLink },
|
||||
{ 0x0F09, RGBDeviceType.Unknown, "Chroma Hardware Development Kit (HDK)", LedMappings.ChromaLink, RazerEndpointType.ChromaLink },
|
||||
{ 0x0F13, RGBDeviceType.Unknown, "Lian Li O11", LedMappings.ChromaLink, RazerEndpointType.ChromaLink },
|
||||
{ 0x0F1D, RGBDeviceType.Unknown, "Mouse Bungee V3 Chroma", LedMappings.ChromaLink, RazerEndpointType.ChromaLink },
|
||||
{ 0x0F20, RGBDeviceType.Unknown, "Base Station V2 Chroma", LedMappings.ChromaLink, RazerEndpointType.ChromaLink }
|
||||
};
|
||||
|
||||
#endregion
|
||||
@ -218,7 +220,7 @@ namespace RGB.NET.Devices.Razer
|
||||
|
||||
RazerError error;
|
||||
if (((error = _RazerSDK.Init()) != RazerError.Success) && Enum.IsDefined(typeof(RazerError), error)) //HACK DarthAffe 08.02.2018: The x86-SDK seems to have a problem here ...
|
||||
ThrowRazerError(error);
|
||||
ThrowRazerError(error, true);
|
||||
}
|
||||
|
||||
protected override IEnumerable<IRGBDevice> GetLoadedDevices(RGBDeviceType loadFilter)
|
||||
@ -230,9 +232,9 @@ namespace RGB.NET.Devices.Razer
|
||||
if (LoadEmulatorDevices)
|
||||
{
|
||||
if (loadFilter.HasFlag(RGBDeviceType.Keyboard) && devices.All(d => d is not RazerKeyboardRGBDevice))
|
||||
devices.Add(new RazerKeyboardRGBDevice(new RazerKeyboardRGBDeviceInfo("Emulator Keyboard", RazerEndpointType.Keyboard), GetUpdateTrigger()));
|
||||
devices.Add(new RazerKeyboardRGBDevice(new RazerKeyboardRGBDeviceInfo("Emulator Keyboard", RazerEndpointType.Keyboard), GetUpdateTrigger(), LedMappings.Keyboard));
|
||||
if (loadFilter.HasFlag(RGBDeviceType.Mouse) && devices.All(d => d is not RazerMouseRGBDevice))
|
||||
devices.Add(new RazerMouseRGBDevice(new RazerRGBDeviceInfo(RGBDeviceType.Mouse, RazerEndpointType.Mouse, "Emulator Mouse"), GetUpdateTrigger()));
|
||||
devices.Add(new RazerMouseRGBDevice(new RazerRGBDeviceInfo(RGBDeviceType.Mouse, RazerEndpointType.Mouse, "Emulator Mouse"), GetUpdateTrigger(), LedMappings.Mouse));
|
||||
if (loadFilter.HasFlag(RGBDeviceType.Headset) && devices.All(d => d is not RazerHeadsetRGBDevice))
|
||||
devices.Add(new RazerHeadsetRGBDevice(new RazerRGBDeviceInfo(RGBDeviceType.Headset, RazerEndpointType.Headset, "Emulator Headset"), GetUpdateTrigger()));
|
||||
if (loadFilter.HasFlag(RGBDeviceType.Mousepad) && devices.All(d => d is not RazerMousepadRGBDevice))
|
||||
@ -253,9 +255,9 @@ namespace RGB.NET.Devices.Razer
|
||||
{
|
||||
yield return definition.CustomData switch
|
||||
{
|
||||
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.Keyboard => new RazerKeyboardRGBDevice(new RazerKeyboardRGBDeviceInfo(definition.Name, definition.CustomData), GetUpdateTrigger(), definition.LedMapping),
|
||||
RazerEndpointType.LaptopKeyboard => new RazerKeyboardRGBDevice(new RazerKeyboardRGBDeviceInfo(definition.Name, definition.CustomData), GetUpdateTrigger(), definition.LedMapping),
|
||||
RazerEndpointType.Mouse => new RazerMouseRGBDevice(new RazerRGBDeviceInfo(definition.DeviceType, definition.CustomData, definition.Name), GetUpdateTrigger(), definition.LedMapping),
|
||||
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()),
|
||||
@ -265,7 +267,7 @@ namespace RGB.NET.Devices.Razer
|
||||
}
|
||||
}
|
||||
|
||||
private void ThrowRazerError(RazerError errorCode) => throw new RazerException(errorCode);
|
||||
private void ThrowRazerError(RazerError errorCode, bool isCritical) => Throw(new RazerException(errorCode), isCritical);
|
||||
|
||||
private void TryUnInit()
|
||||
{
|
||||
|
||||
@ -38,6 +38,7 @@ namespace RGB.NET.Devices.Wooting.Native
|
||||
SetDllDirectory(Path.GetDirectoryName(Path.GetFullPath(dllPath))!);
|
||||
|
||||
_dllHandle = LoadLibrary(dllPath);
|
||||
if (_dllHandle == IntPtr.Zero) throw new RGBDeviceException($"Wooting LoadLibrary failed with error code {Marshal.GetLastWin32Error()}");
|
||||
|
||||
_getDeviceInfoPointer = (GetDeviceInfoPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "wooting_rgb_device_info"), typeof(GetDeviceInfoPointer));
|
||||
_keyboardConnectedPointer = (KeyboardConnectedPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "wooting_rgb_kbd_connected"), typeof(KeyboardConnectedPointer));
|
||||
|
||||
@ -41,6 +41,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RGB.NET.Layout", "RGB.NET.L
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RGB.NET.HID", "RGB.NET.HID\RGB.NET.HID.csproj", "{4F4B7329-4858-4314-BA32-9DF3B1B33482}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RGB.NET.Devices.PicoPi", "RGB.NET.Devices.PicoPi\RGB.NET.Devices.PicoPi.csproj", "{7FC5C7A8-7B27-46E7-A8E8-DB80568F49C5}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -115,6 +117,10 @@ Global
|
||||
{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
|
||||
{7FC5C7A8-7B27-46E7-A8E8-DB80568F49C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7FC5C7A8-7B27-46E7-A8E8-DB80568F49C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7FC5C7A8-7B27-46E7-A8E8-DB80568F49C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7FC5C7A8-7B27-46E7-A8E8-DB80568F49C5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@ -133,6 +139,7 @@ Global
|
||||
{A3FD5AD7-040A-47CA-A278-53493A25FF8A} = {92D7C263-D4C9-4D26-93E2-93C1F9C2CD16}
|
||||
{E0732B34-3F96-4DD9-AFD5-0E34B833AD6D} = {D13032C6-432E-4F43-8A32-071133C22B16}
|
||||
{DD46DB2D-85BE-4962-86AE-E38C9053A548} = {D13032C6-432E-4F43-8A32-071133C22B16}
|
||||
{7FC5C7A8-7B27-46E7-A8E8-DB80568F49C5} = {D13032C6-432E-4F43-8A32-071133C22B16}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {7F222AD4-1F9E-4AAB-9D69-D62372D4C1BA}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user