From e7bb9c81d24c0e5511d5da08c132f8be322dd90c Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Mon, 26 Feb 2024 15:09:08 +0100 Subject: [PATCH 1/4] Support for Strix Impact (P303) (#2121) * Support for Strix Carry (P508) * Fixes polling rate, angle snapping and debounce for Gladius II Origin. * The Gen2 version of the TuF M3 uses 0-100 for brightness. * Adds support for ROG Strix Impact III (P518) * Import/Export feature for mice. * Suppor for Strix Impact (P303) --- app/Peripherals/Mouse/Models/StrixImpact.cs | 247 ++++++++++++++++++++ app/Peripherals/PeripheralsProvider.cs | 1 + 2 files changed, 248 insertions(+) create mode 100644 app/Peripherals/Mouse/Models/StrixImpact.cs diff --git a/app/Peripherals/Mouse/Models/StrixImpact.cs b/app/Peripherals/Mouse/Models/StrixImpact.cs new file mode 100644 index 00000000..a3f66219 --- /dev/null +++ b/app/Peripherals/Mouse/Models/StrixImpact.cs @@ -0,0 +1,247 @@ +namespace GHelper.Peripherals.Mouse.Models +{ + //P303 + public class StrixImpact : AsusMouse + { + public StrixImpact() : base(0x0B05, 0x1847, "mi_02", false) + { + } + + public StrixImpact(ushort productId, string path) : base(0x0B05, productId, path, false) + { + } + + public override int DPIProfileCount() + { + return 2; + } + + public override string GetDisplayName() + { + return "Strix Impact"; + } + + + public override PollingRate[] SupportedPollingrates() + { + return new PollingRate[] { + PollingRate.PR125Hz, + PollingRate.PR250Hz, + PollingRate.PR500Hz, + PollingRate.PR1000Hz + }; + } + + public override int ProfileCount() + { + return 1; + } + public override int MaxDPI() + { + return 5_000; + } + + public override bool HasRGB() + { + return true; + } + + public override bool HasAutoPowerOff() + { + return false; + } + + public override bool HasDebounceSetting() + { + return true; + } + + public override bool HasLowBatteryWarning() + { + return false; + } + + public override bool HasBattery() + { + return false; + } + + public override bool HasDPIColors() + { + return false; + } + + public override bool IsLightingModeSupported(LightingMode lightingMode) + { + return lightingMode == LightingMode.Static + || lightingMode == LightingMode.Breathing + || lightingMode == LightingMode.ColorCycle + || lightingMode == LightingMode.React; + } + + public override LightingZone[] SupportedLightingZones() + { + return new LightingZone[] { LightingZone.Logo }; + } + + public override int DPIIncrements() + { + return 100; + } + + + public override int MinDPI() + { + return 200; + } + + public override bool CanChangeDPIProfile() + { + return true; + } + + public override int MaxBrightness() + { + return 4; + } + + protected override byte[] GetUpdateLightingModePacket(LightingSetting lightingSetting, LightingZone zone) + { + /* + * 51 28 00 00 [00] [04] [35 04 FF] 00 00 00 00 00 00 00 + */ + + return new byte[] { reportId, 0x51, 0x28, 0x00, 0x00, + IndexForLightingMode(lightingSetting.LightingMode), + (byte)lightingSetting.Brightness, + lightingSetting.RGBColor.R, lightingSetting.RGBColor.G, lightingSetting.RGBColor.B + }; + } + + protected override byte[] GetReadLightingModePacket(LightingZone zone) + { + return new byte[] { 0x00, 0x12, 0x03, 0x00 }; + } + + protected LightingSetting? ParseLightingSetting(byte[] packet, LightingZone zone) + { + if (packet[1] != 0x12 || packet[2] != 0x03) + { + return null; + } + + int offset = 5 + (((int)zone) * 5); + + LightingSetting setting = new LightingSetting(); + + setting.LightingMode = LightingModeForIndex(packet[offset + 0]); + setting.Brightness = packet[offset + 1]; + + setting.RGBColor = Color.FromArgb(packet[offset + 2], packet[offset + 3], packet[offset + 4]); + + + return setting; + } + + public override void ReadLightingSetting() + { + if (!HasRGB()) + { + return; + } + //Mouse sends all lighting zones in one response Direction, Random col, Speed + //00 12 03 00 00 [00 04 ff 00 80] [00 04 00 ff ff] [00 04 ff ff ff] 00 [00] [00] [00] 00 00 + //00 12 03 00 00 [03 04 00 00 00] [03 04 00 00 00] [03 04 00 00 00] 00 [00] [00] [07] 00 00 + byte[]? response = WriteForResponse(GetReadLightingModePacket(LightingZone.All)); + if (response is null) return; + + LightingZone[] lz = SupportedLightingZones(); + for (int i = 0; i < lz.Length; ++i) + { + LightingSetting? ls = ParseLightingSetting(response, lz[i]); + if (ls is null) + { + Logger.WriteLine(GetDisplayName() + ": Failed to read RGB Setting for Zone " + lz[i].ToString()); + continue; + } + ls.AnimationDirection = SupportsAnimationDirection(ls.LightingMode) + ? (AnimationDirection)response[21] + : AnimationDirection.Clockwise; + + ls.RandomColor = SupportsRandomColor(ls.LightingMode) && response[22] == 0x01; + + ls.AnimationSpeed = SupportsAnimationSpeed(ls.LightingMode) + ? (AnimationSpeed)response[23] + : AnimationSpeed.Medium; + + if (ls.AnimationSpeed != AnimationSpeed.Fast + && ls.AnimationSpeed != AnimationSpeed.Medium + && ls.AnimationSpeed != AnimationSpeed.Slow) + { + ls.AnimationSpeed = AnimationSpeed.Medium; + } + + Logger.WriteLine(GetDisplayName() + ": Read RGB Setting for Zone " + lz[i].ToString() + ": " + ls.ToString()); + LightingSetting[i] = ls; + } + } + + + + protected override PollingRate ParsePollingRate(byte[] packet) + { + if (packet[1] == 0x12 && packet[2] == 0x04 && packet[3] == 0x00) + { + return (PollingRate)packet[9]; + } + + return PollingRate.PR125Hz; + } + + protected override byte[] GetUpdatePollingRatePacket(PollingRate pollingRate) + { + return new byte[] { reportId, 0x51, 0x31, 0x02, 0x00, (byte)pollingRate }; + } + + protected override bool ParseAngleSnapping(byte[] packet) + { + if (packet[1] == 0x12 && packet[2] == 0x04 && packet[3] == 0x00) + { + return packet[13] == 0x01; + } + + return false; + } + + protected override byte[] GetUpdateAngleSnappingPacket(bool angleSnapping) + { + return new byte[] { reportId, 0x51, 0x31, 0x04, 0x00, (byte)(angleSnapping ? 0x01 : 0x00) }; + } + + protected override DebounceTime ParseDebounce(byte[] packet) + { + if (packet[1] != 0x12 || packet[2] != 0x04 || packet[3] != 0x00) + { + return DebounceTime.MS12; + } + + if (packet[11] < 0x02) + { + return DebounceTime.MS12; + } + + if (packet[11] > 0x07) + { + return DebounceTime.MS32; + } + + return (DebounceTime)packet[11]; + } + + protected override byte[] GetUpdateDebouncePacket(DebounceTime debounce) + { + return new byte[] { reportId, 0x51, 0x31, 0x03, 0x00, ((byte)debounce) }; + } + } + +} diff --git a/app/Peripherals/PeripheralsProvider.cs b/app/Peripherals/PeripheralsProvider.cs index bfef7896..9042c5b1 100644 --- a/app/Peripherals/PeripheralsProvider.cs +++ b/app/Peripherals/PeripheralsProvider.cs @@ -215,6 +215,7 @@ namespace GHelper.Peripherals DetectMouse(new SpathaX()); DetectMouse(new StrixCarry()); DetectMouse(new StrixImpactIII()); + DetectMouse(new StrixImpact()); } public static void DetectMouse(AsusMouse am) From df71595b454ea8b2c4583b70f19f77c4ca0d6380 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Mon, 26 Feb 2024 18:52:36 +0100 Subject: [PATCH 2/4] New translations strings.resx (Spanish) (#2122) --- app/Properties/Strings.es.resx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Properties/Strings.es.resx b/app/Properties/Strings.es.resx index b486af0a..0d6b0823 100644 --- a/app/Properties/Strings.es.resx +++ b/app/Properties/Strings.es.resx @@ -331,7 +331,7 @@ Deshabilitar mando - Disable on lid close + Desactivar al cerrar la tapa Desactivar Overdrive From 43781189512a56738c065427d4f8c0ce49d40b6d Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Tue, 27 Feb 2024 15:28:45 +0100 Subject: [PATCH 3/4] Update README.md --- docs/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/README.md b/docs/README.md index 74117d04..f6cb04f7 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,7 +1,7 @@ # G-Helper - Lightweight control tool for Asus laptops [![United24](https://raw.githubusercontent.com/seerge/g-helper/main/docs/ua.png)](https://u24.gov.ua/) -[![GitHub release](https://img.shields.io/github/release/seerge/g-helper.svg?style=flat-square)](https://GitHub.com/seerge/g-helper/releases/) -[![Github all releases](https://img.shields.io/github/downloads/seerge/g-helper/total.svg?style=flat-square)](https://GitHub.com/seerge/g-helper/releases/) [![GitHub stars](https://img.shields.io/github/stars/seerge/g-helper.svg?style=social)](https://GitHub.com/seerge/g-helper/stargazers/) +[![GitHub release](https://img.shields.io/github/release/seerge/g-helper)](https://GitHub.com/seerge/g-helper/releases/) +[![Github all releases](https://img.shields.io/github/downloads/seerge/g-helper/total)](https://GitHub.com/seerge/g-helper/releases/) [![GitHub stars](https://img.shields.io/github/stars/seerge/g-helper.svg?style=social)](https://GitHub.com/seerge/g-helper/stargazers/) Small and lightweight Armoury Crate alternative for Asus laptops offering almost same functionality without extra bloat and unnecessary services. Works with all popular models, such as ROG Zephyrus G14, G15, G16, M16, Flow X13, Flow X16, Flow Z13, TUF Series, Strix / Scar Series, ProArt, VivoBook, Ally and many more! From 88ab4f396ef776cf30c59d8a8be70a76dc3182af Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Tue, 27 Feb 2024 15:41:41 +0100 Subject: [PATCH 4/4] Update SECURITY.md --- .github/SECURITY.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/SECURITY.md b/.github/SECURITY.md index 7504e677..d24f4109 100644 --- a/.github/SECURITY.md +++ b/.github/SECURITY.md @@ -4,8 +4,8 @@ | Version | Supported | | ------- | ------------------ | -| 0.89+ | :white_check_mark: | -| < 0.89 | :x: | +| 0.151+ | :white_check_mark: | +| < 0.151 | :x: | ## Reporting a Vulnerability