mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Backlight control fix
This commit is contained in:
@@ -262,17 +262,20 @@ namespace GHelper
|
|||||||
device.CloseDevice();
|
device.CloseDevice();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Backup payload for old models
|
// Backup payload for old models
|
||||||
byte[] msgBackup = { INPUT_HID_ID, 0xba, 0xc5, 0xc4, (byte)brightness };
|
if (AppConfig.ContainsModel("503"))
|
||||||
|
|
||||||
var devicesBackup = GetHidDevices(deviceIds, 0);
|
|
||||||
foreach (HidDevice device in devicesBackup)
|
|
||||||
{
|
{
|
||||||
device.OpenDevice();
|
byte[] msgBackup = { INPUT_HID_ID, 0xba, 0xc5, 0xc4, (byte)brightness };
|
||||||
device.WriteFeatureData(msgBackup);
|
|
||||||
device.CloseDevice();
|
var devicesBackup = GetHidDevices(deviceIds, 0);
|
||||||
|
foreach (HidDevice device in devicesBackup)
|
||||||
|
{
|
||||||
|
device.OpenDevice();
|
||||||
|
device.WriteFeatureData(msgBackup);
|
||||||
|
device.CloseDevice();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -155,6 +155,7 @@ public static class HardwareControl
|
|||||||
if (_gpuControl.IsValid)
|
if (_gpuControl.IsValid)
|
||||||
{
|
{
|
||||||
GpuControl = _gpuControl;
|
GpuControl = _gpuControl;
|
||||||
|
Logger.WriteLine(GpuControl.FullName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,11 +165,14 @@ public static class HardwareControl
|
|||||||
if (_gpuControl.IsValid)
|
if (_gpuControl.IsValid)
|
||||||
{
|
{
|
||||||
GpuControl = _gpuControl;
|
GpuControl = _gpuControl;
|
||||||
|
Logger.WriteLine(GpuControl.FullName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_gpuControl.Dispose();
|
_gpuControl.Dispose();
|
||||||
|
|
||||||
GpuControl = null;
|
GpuControl = null;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -221,36 +221,6 @@ namespace GHelper
|
|||||||
|
|
||||||
Padding padding = new Padding(15, 5, 5, 5);
|
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);
|
var title = new ToolStripMenuItem(Properties.Strings.PerformanceMode);
|
||||||
title.Margin = padding;
|
title.Margin = padding;
|
||||||
title.Enabled = false;
|
title.Enabled = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user