From 1cda8228205c31497c5565705e19c0c0c2e9f7f5 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sat, 27 May 2023 22:44:54 +0200 Subject: [PATCH] Backlight control fix --- app/AsusUSB.cs | 19 +++++++++++-------- app/HardwareControl.cs | 4 ++++ app/Settings.cs | 30 ------------------------------ 3 files changed, 15 insertions(+), 38 deletions(-) diff --git a/app/AsusUSB.cs b/app/AsusUSB.cs index 9c801da3..0480d6ac 100644 --- a/app/AsusUSB.cs +++ b/app/AsusUSB.cs @@ -262,17 +262,20 @@ namespace GHelper device.CloseDevice(); } - // Backup payload for old models - byte[] msgBackup = { INPUT_HID_ID, 0xba, 0xc5, 0xc4, (byte)brightness }; - - var devicesBackup = GetHidDevices(deviceIds, 0); - foreach (HidDevice device in devicesBackup) + if (AppConfig.ContainsModel("503")) { - device.OpenDevice(); - device.WriteFeatureData(msgBackup); - device.CloseDevice(); + byte[] msgBackup = { INPUT_HID_ID, 0xba, 0xc5, 0xc4, (byte)brightness }; + + var devicesBackup = GetHidDevices(deviceIds, 0); + foreach (HidDevice device in devicesBackup) + { + device.OpenDevice(); + device.WriteFeatureData(msgBackup); + device.CloseDevice(); + } } + } diff --git a/app/HardwareControl.cs b/app/HardwareControl.cs index 017a9750..66eb3adf 100644 --- a/app/HardwareControl.cs +++ b/app/HardwareControl.cs @@ -155,6 +155,7 @@ public static class HardwareControl if (_gpuControl.IsValid) { GpuControl = _gpuControl; + Logger.WriteLine(GpuControl.FullName); return; } @@ -164,11 +165,14 @@ public static class HardwareControl if (_gpuControl.IsValid) { GpuControl = _gpuControl; + Logger.WriteLine(GpuControl.FullName); return; } _gpuControl.Dispose(); GpuControl = null; + + } catch (Exception ex) { diff --git a/app/Settings.cs b/app/Settings.cs index f9dba41d..da64e847 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -221,36 +221,6 @@ namespace GHelper Padding padding = new Padding(15, 5, 5, 5); - /* - TableLayoutPanel[] tables = { tablePerf, tableGPU }; - string[] titles = { Properties.Strings.PerformanceMode, Properties.Strings.GPUMode}; - - int index = 0; - foreach (TableLayoutPanel table in tables) - { - - var title = new ToolStripMenuItem(titles[index]); - title.Margin = padding; - title.Enabled = false; - contextMenuStrip.Items.Add(title); - - foreach (Control control in table.Controls) - { - var button = control as RButton; - if (button != null && !button.Secondary && button.Enabled) - { - var menu = new ToolStripMenuItem(button.Text); - menu.Margin = padding; - menu.Checked = button.Activated; - menu.Click += delegate { button.PerformClick(); }; - contextMenuStrip.Items.Add(menu); - } - } - contextMenuStrip.Items.Add("-"); - index++; - }*/ - - var title = new ToolStripMenuItem(Properties.Strings.PerformanceMode); title.Margin = padding; title.Enabled = false;