Keyboard listener retry

This commit is contained in:
Serge
2023-07-04 23:07:55 +02:00
parent dc40b317f8
commit 5f1c926527
2 changed files with 16 additions and 2 deletions

View File

@@ -12,7 +12,7 @@ namespace GHelper.Input
public class InputDispatcher
{
System.Timers.Timer timer = new System.Timers.Timer(1000);
public bool backlightActivity = true;
public static bool backlightActivity = true;
public static Keys keyProfile = Keys.F5;
public static Keys keyApp = Keys.F12;
@@ -342,6 +342,7 @@ namespace GHelper.Input
public static void TabletMode()
{
bool touchpadState = GetTouchpadState();
bool tabletState = Program.acpi.DeviceGet(AsusACPI.TabletState) > 0;

View File

@@ -10,7 +10,20 @@ namespace GHelper.Input
public KeyboardListener(Action<int> KeyHandler)
{
HidDevice? input = AsusUSB.GetDevice();
if (input == null) return;
// Fallback
if (input == null)
{
AsusUSB.Init();
Thread.Sleep(1000);
input = AsusUSB.GetDevice();
}
if (input == null)
{
Logger.WriteLine($"Input device not found");
return;
}
Logger.WriteLine($"Input: {input.DevicePath}");