mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Ambient mode fix for GA503 https://github.com/seerge/g-helper/issues/1790
This commit is contained in:
@@ -13,6 +13,7 @@ public static class AsusHid
|
|||||||
static int[] deviceIds = { 0x1a30, 0x1854, 0x1869, 0x1866, 0x19b6, 0x1822, 0x1837, 0x1854, 0x184a, 0x183d, 0x8502, 0x1807, 0x17e0, 0x18c6, 0x1abe };
|
static int[] deviceIds = { 0x1a30, 0x1854, 0x1869, 0x1866, 0x19b6, 0x1822, 0x1837, 0x1854, 0x184a, 0x183d, 0x8502, 0x1807, 0x17e0, 0x18c6, 0x1abe };
|
||||||
|
|
||||||
static HidStream? auraStream;
|
static HidStream? auraStream;
|
||||||
|
static int featureLength;
|
||||||
|
|
||||||
public static IEnumerable<HidDevice>? FindDevices(byte reportId)
|
public static IEnumerable<HidDevice>? FindDevices(byte reportId)
|
||||||
{
|
{
|
||||||
@@ -94,7 +95,10 @@ public static class AsusHid
|
|||||||
foreach (var data in dataList)
|
foreach (var data in dataList)
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
stream.Write(data);
|
var payload = new byte[device.GetMaxFeatureReportLength()];
|
||||||
|
Array.Copy(data, payload, data.Length);
|
||||||
|
stream.SetFeature(payload);
|
||||||
|
//stream.Write(data);
|
||||||
Logger.WriteLine($"{log} {device.ProductID.ToString("X")}: {BitConverter.ToString(data)}");
|
Logger.WriteLine($"{log} {device.ProductID.ToString("X")}: {BitConverter.ToString(data)}");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -107,12 +111,20 @@ public static class AsusHid
|
|||||||
public static void WriteAura(byte[] data)
|
public static void WriteAura(byte[] data)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (auraStream == null) auraStream = FindHidStream(AURA_ID);
|
if (auraStream == null)
|
||||||
if (auraStream == null) return;
|
{
|
||||||
|
auraStream = FindHidStream(AURA_ID);
|
||||||
|
if (auraStream == null) return;
|
||||||
|
|
||||||
|
featureLength = auraStream.Device.GetMaxFeatureReportLength();
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
auraStream.Write(data);
|
var payload = new byte[featureLength];
|
||||||
|
Array.Copy(data, payload, data.Length);
|
||||||
|
auraStream.SetFeature(payload);
|
||||||
|
//auraStream.Write(data);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ namespace GHelper.USB
|
|||||||
new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x1a },
|
new byte[] { AsusHid.AURA_ID, 0x05, 0x20, 0x31, 0, 0x1a },
|
||||||
//Encoding.ASCII.GetBytes("^ASUS Tech.Inc."),
|
//Encoding.ASCII.GetBytes("^ASUS Tech.Inc."),
|
||||||
//new byte[] { 0x5e, 0x05, 0x20, 0x31, 0, 0x1a }
|
//new byte[] { 0x5e, 0x05, 0x20, 0x31, 0, 0x1a }
|
||||||
});
|
}, "Init");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -535,6 +535,12 @@ namespace GHelper.USB
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (AppConfig.ContainsModel("GA503"))
|
||||||
|
{
|
||||||
|
AsusHid.Write(new List<byte[]> { AuraMessage(AuraMode.AuraStatic, color, color, 0xeb, isSingleColor), MESSAGE_SET });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (init)
|
if (init)
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
|
|||||||
Reference in New Issue
Block a user