diff --git a/app/AppConfig.cs b/app/AppConfig.cs index 30dc47ba..70da3a1f 100644 --- a/app/AppConfig.cs +++ b/app/AppConfig.cs @@ -391,6 +391,11 @@ public static class AppConfig return ContainsModel("Vivobook") || ContainsModel("Zenbook") || ContainsModel("ProArt"); } + public static bool IsHardwareFnLock() + { + return IsVivoZenPro(); + } + // Devices with bugged bios command to change brightness public static bool SwappedBrightness() { diff --git a/app/Input/InputDispatcher.cs b/app/Input/InputDispatcher.cs index 88681efa..b4f9d1bd 100644 --- a/app/Input/InputDispatcher.cs +++ b/app/Input/InputDispatcher.cs @@ -85,8 +85,7 @@ namespace GHelper.Input InitBacklightTimer(); - if (AppConfig.IsVivoZenbook()) - Program.acpi.DeviceSet(AsusACPI.FnLock, AppConfig.Is("fn_lock") ^ AppConfig.IsInvertedFNLock() ? 1 : 0, "FnLock"); + if (AppConfig.IsHardwareFnLock()) HardwareFnLock(AppConfig.Is("fn_lock")); } @@ -155,7 +154,7 @@ namespace GHelper.Input // FN-Lock group - if (AppConfig.Is("fn_lock") && !AppConfig.IsVivoZenbook()) + if (AppConfig.Is("fn_lock") && !AppConfig.IsHardwareFnLock()) for (Keys i = Keys.F1; i <= Keys.F11; i++) hook.RegisterHotKey(ModifierKeys.None, i); // Arrow-lock group @@ -629,13 +628,19 @@ namespace GHelper.Input Program.toast.RunToast("Arrow-Lock " + (arLock == 1 ? Properties.Strings.On : Properties.Strings.Off), ToastIcon.FnLock); } + public static void HardwareFnLock(bool fnLock) + { + Program.acpi.DeviceSet(AsusACPI.FnLock, fnLock ^ AppConfig.IsInvertedFNLock() ? 1 : 0, "FnLock"); + AsusHid.WriteInput([AsusHid.INPUT_ID, 0xD0, 0x4E, fnLock ? (byte)0x01 : (byte)0x00], "USB FnLock"); + } + public static void ToggleFnLock() { bool fnLock = !AppConfig.Is("fn_lock"); AppConfig.Set("fn_lock", fnLock ? 1 : 0); - if (AppConfig.IsVivoZenbook()) - Program.acpi.DeviceSet(AsusACPI.FnLock, fnLock ^ AppConfig.IsInvertedFNLock() ? 1 : 0, "FnLock"); + if (AppConfig.IsHardwareFnLock()) + HardwareFnLock(fnLock); else Program.settingsForm.BeginInvoke(Program.inputDispatcher.RegisterKeys); diff --git a/app/USB/Aura.cs b/app/USB/Aura.cs index 051a4f83..793c02ca 100644 --- a/app/USB/Aura.cs +++ b/app/USB/Aura.cs @@ -272,11 +272,11 @@ namespace GHelper.USB if (AppConfig.IsProArt()) { AsusHid.WriteInput([AsusHid.INPUT_ID, 0x05, 0x20, 0x31, 0x00, 0x08], "ProArt Init"); - AsusHid.WriteInput([AsusHid.INPUT_ID, 0xD0, 0x4E], "ProArt Init"); + //AsusHid.WriteInput([AsusHid.INPUT_ID, 0xD0, 0x4E], "ProArt Init"); AsusHid.WriteInput([AsusHid.INPUT_ID, 0xBA, 0xC5, 0xC4], "ProArt Init"); AsusHid.WriteInput([AsusHid.INPUT_ID, 0xD0, 0x8F, 0x01], "ProArt Init"); AsusHid.WriteInput([AsusHid.INPUT_ID, 0xD0, 0x85, 0xFF], "ProArt Init"); - AsusHid.WriteInput([AsusHid.INPUT_ID, 0xD0, 0x4E], "ProArt Init"); + //AsusHid.WriteInput([AsusHid.INPUT_ID, 0xD0, 0x4E], "ProArt Init"); } }