Skip to content
This repository has been archived by the owner on Jun 12, 2023. It is now read-only.

Commit

Permalink
[Feature] Xg Mobile Lighting API
Browse files Browse the repository at this point in the history
- add ability to toggle xg mobile lighting (and finally disable it without Crate).
- no ui buttons provided, I'm too tired for this. You can add them into Xg mobile section.
- It's impossible to get current status of light (I think this is common issue for Aura API). Even Crate can only set status.

How I managed to find this API: firstly I checked other properties of ASUS WMI, but didn't find anything. Then I decided to check specific AURA devices and found two - both related to Xg Mobile. Then I used Wireshark to trace outcoming data to these USB devices, some pattern-matching and finally I got the params to send
  • Loading branch information
Yazvinsky committed Mar 6, 2023
1 parent 57551c4 commit 539d8a5
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion acControl/Services/XgMobileConnectionService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System;
using HidLibrary;
using System;
using System.Diagnostics;
using System.Linq;

namespace acControl.Services
{
Expand Down Expand Up @@ -64,5 +67,30 @@ private bool IsEGPUConnected()
}
return wmi.DeviceGet(ASUSWmi.eGPU) == 1;
}

public void EnableXgMobileLight()
{
SendXgMobileLightingCommand(new byte[] { 0x5e, 0xc5, 0x50 });
}

public void DisableXgMobileLight()
{
SendXgMobileLightingCommand(new byte[] { 0x5e, 0xc5 });
}

private void SendXgMobileLightingCommand(byte[] command)
{
var devices = HidDevices.Enumerate(0x0b05, new int[] { 0x1970 });
var xgMobileLight = devices.Where(device => device.IsConnected && device.Description.ToLower().StartsWith("hid") && device.Capabilities.FeatureReportByteLength > 64).ToList();
if (xgMobileLight.Count == 1)
{
var device = xgMobileLight[0];
device.OpenDevice();
var paramsArr = new byte[300];
Array.Copy(command, paramsArr, command.Length);
device.WriteFeatureData(paramsArr);
device.CloseDevice();
}
}
}
}

0 comments on commit 539d8a5

Please sign in to comment.