mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Touchpad toggle fix for FA507 https://github.com/seerge/g-helper/issues/1589
This commit is contained in:
@@ -355,7 +355,7 @@ public static class AppConfig
|
||||
|
||||
public static bool IsStrixLimitedRGB()
|
||||
{
|
||||
return ContainsModel("G614JV") || ContainsModel("G614JZ") || ContainsModel("G512LI");
|
||||
return ContainsModel("G614JV") || ContainsModel("G614JZ") || ContainsModel("G512LI") || ContainsModel("G513RS");
|
||||
}
|
||||
|
||||
public static bool IsZ13()
|
||||
@@ -441,4 +441,9 @@ public static class AppConfig
|
||||
return ContainsModel("GV301RA") || ContainsModel("GV302XA") || IsAlly();
|
||||
}
|
||||
|
||||
public static bool IsHardwareTouchpadToggle()
|
||||
{
|
||||
return ContainsModel("FA507");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -564,7 +564,7 @@ namespace GHelper
|
||||
AppConfig.Set("keyboard_sleep_logo", (checkSleepLogo.Checked ? 1 : 0));
|
||||
AppConfig.Set("keyboard_shutdown_logo", (checkShutdownLogo.Checked ? 1 : 0));
|
||||
|
||||
Aura.ApplyAuraPower();
|
||||
Aura.ApplyPower();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -303,10 +303,10 @@ namespace GHelper.Input
|
||||
KeyboardHook.KeyKeyPress(Keys.LWin, Keys.P);
|
||||
break;
|
||||
case Keys.F10:
|
||||
HandleOptimizationEvent(107);
|
||||
ToggleTouchpadEvent(true);
|
||||
break;
|
||||
case Keys.F11:
|
||||
HandleOptimizationEvent(108);
|
||||
SleepEvent();
|
||||
break;
|
||||
case Keys.F12:
|
||||
KeyboardHook.KeyKeyPress(Keys.LWin, Keys.A);
|
||||
@@ -477,11 +477,23 @@ namespace GHelper.Input
|
||||
}
|
||||
}
|
||||
|
||||
static void ToggleTouchpadEvent(bool hotkey = false)
|
||||
{
|
||||
if (hotkey || !AppConfig.IsHardwareTouchpadToggle()) ToggleTouchpad();
|
||||
Thread.Sleep(200);
|
||||
Program.toast.RunToast(GetTouchpadState() ? "On" : "Off", ToastIcon.Touchpad);
|
||||
}
|
||||
|
||||
static void ToggleTouchpad()
|
||||
{
|
||||
KeyboardHook.KeyKeyKeyPress(Keys.LWin, Keys.LControlKey, Keys.F24, 50);
|
||||
}
|
||||
|
||||
static void SleepEvent()
|
||||
{
|
||||
Program.acpi.DeviceSet(AsusACPI.UniversalControl, AsusACPI.KB_Sleep, "Sleep");
|
||||
}
|
||||
|
||||
public static void ToggleArrowLock()
|
||||
{
|
||||
int arLock = AppConfig.Is("arrow_lock") ? 0 : 1;
|
||||
@@ -620,12 +632,10 @@ namespace GHelper.Input
|
||||
Program.acpi.DeviceSet(AsusACPI.UniversalControl, AsusACPI.Brightness_Up, "Brightness");
|
||||
break;
|
||||
case 107: // FN+F10
|
||||
ToggleTouchpad();
|
||||
Thread.Sleep(200);
|
||||
Program.toast.RunToast(GetTouchpadState() ? "On" : "Off", ToastIcon.Touchpad);
|
||||
ToggleTouchpadEvent();
|
||||
break;
|
||||
case 108: // FN+F11
|
||||
Program.acpi.DeviceSet(AsusACPI.UniversalControl, AsusACPI.KB_Sleep, "Sleep");
|
||||
SleepEvent();
|
||||
break;
|
||||
case 106: // Screenpad button on DUO
|
||||
if (Control.ModifierKeys == Keys.Shift)
|
||||
|
||||
@@ -1045,7 +1045,7 @@ namespace GHelper
|
||||
|
||||
if (!AppConfig.Is("skip_aura"))
|
||||
{
|
||||
Aura.ApplyAuraPower();
|
||||
Aura.ApplyPower();
|
||||
Aura.ApplyAura();
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ public static class AsusHid
|
||||
|
||||
static int[] deviceIds = { 0x1a30, 0x1854, 0x1869, 0x1866, 0x19b6, 0x1822, 0x1837, 0x1854, 0x184a, 0x183d, 0x8502, 0x1807, 0x17e0, 0x18c6, 0x1abe };
|
||||
|
||||
static HidStream _stream;
|
||||
static HidStream auraStream;
|
||||
|
||||
public static HidStream FindHidStream(byte reportId, int minFeatureLength = 1)
|
||||
{
|
||||
@@ -50,23 +50,23 @@ public static class AsusHid
|
||||
return null;
|
||||
}
|
||||
|
||||
static void WriteData(HidStream stream, byte[] data)
|
||||
static void WriteData(HidStream stream, byte[] data, string log = "USB")
|
||||
{
|
||||
try
|
||||
{
|
||||
stream.Write(data);
|
||||
Logger.WriteLine("USB " + stream.Device.ProductID + ": " + BitConverter.ToString(data));
|
||||
Logger.WriteLine($"{log} " + stream.Device.ProductID + ": " + BitConverter.ToString(data));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine($"Error writing to HID device: {ex.Message} {BitConverter.ToString(data)}");
|
||||
Debug.WriteLine($"Error writing {log} to HID device: {ex.Message} {BitConverter.ToString(data)}");
|
||||
}
|
||||
}
|
||||
|
||||
public static void Write(byte[] data, byte reportId = AURA_ID)
|
||||
public static void Write(byte[] data, byte reportId = AURA_ID, string log = "USB")
|
||||
{
|
||||
using (var stream = FindHidStream(reportId))
|
||||
WriteData(stream, data);
|
||||
WriteData(stream, data, log);
|
||||
}
|
||||
public static void Write(List<byte[]> dataList, byte reportId = AURA_ID)
|
||||
{
|
||||
@@ -75,19 +75,19 @@ public static class AsusHid
|
||||
WriteData(stream, data);
|
||||
}
|
||||
|
||||
public static void WriteAura(byte[] data, byte reportId = AURA_ID)
|
||||
public static void WriteAura(byte[] data)
|
||||
{
|
||||
|
||||
if (_stream == null) _stream = FindHidStream(reportId);
|
||||
if (_stream == null) return;
|
||||
if (auraStream == null) auraStream = FindHidStream(AURA_ID);
|
||||
if (auraStream == null) return;
|
||||
|
||||
try
|
||||
{
|
||||
_stream.Write(data);
|
||||
auraStream.Write(data);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_stream.Dispose();
|
||||
auraStream.Dispose();
|
||||
Debug.WriteLine($"Error writing data to HID device: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace GHelper.USB
|
||||
|
||||
static bool isOldHeatmap = AppConfig.Is("old_heatmap");
|
||||
|
||||
static System.Timers.Timer timer = new System.Timers.Timer(80);
|
||||
static System.Timers.Timer timer = new System.Timers.Timer(1000);
|
||||
|
||||
static byte[] AuraPowerMessage(AuraPower flags)
|
||||
{
|
||||
@@ -286,15 +286,15 @@ namespace GHelper.USB
|
||||
if (delay) await Task.Delay(TimeSpan.FromSeconds(1));
|
||||
if (isTuf) Program.acpi.TUFKeyboardBrightness(brightness);
|
||||
|
||||
AsusHid.Write(new byte[] { AsusHid.AURA_ID, 0xba, 0xc5, 0xc4, (byte)brightness });
|
||||
if (AppConfig.ContainsModel("GA503")) AsusHid.Write(new byte[] { AsusHid.INPUT_ID, 0xba, 0xc5, 0xc4, (byte)brightness }, AsusHid.INPUT_ID);
|
||||
AsusHid.Write(new byte[] { AsusHid.AURA_ID, 0xba, 0xc5, 0xc4, (byte)brightness }, AsusHid.AURA_ID, log);
|
||||
if (AppConfig.ContainsModel("GA503")) AsusHid.Write(new byte[] { AsusHid.INPUT_ID, 0xba, 0xc5, 0xc4, (byte)brightness }, AsusHid.INPUT_ID, log);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void ApplyAuraPower()
|
||||
public static void ApplyPower()
|
||||
{
|
||||
|
||||
AuraPower flags = new();
|
||||
|
||||
Reference in New Issue
Block a user