Skip to content

Commit

Permalink
Retry USB Aura command once #3449
Browse files Browse the repository at this point in the history
  • Loading branch information
seerge committed Dec 11, 2024
1 parent 463d184 commit a679ad0
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions app/USB/AsusHid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,20 +119,26 @@ public static void Write(List<byte[]> dataList, string log = "USB")
}
}

public static void WriteAura(byte[] data)
public static void WriteAura(byte[] data, bool retry = true)
{

if (auraStream == null) auraStream = FindHidStream(AURA_ID);
if (auraStream == null) return;
if (auraStream == null)
{
Logger.WriteLine("Aura stream not found");
return;
}

try
{
auraStream.Write(data);
}
catch (Exception ex)
{
Logger.WriteLine($"Error writing data to HID device: {ex.Message} {BitConverter.ToString(data)}");
auraStream.Dispose();
Debug.WriteLine($"Error writing data to HID device: {ex.Message} {BitConverter.ToString(data)}");
auraStream = null;
if (retry) WriteAura(data, false);
}
}

Expand Down

0 comments on commit a679ad0

Please sign in to comment.