Expose IsHostSleeping instead of IsHostSleeping()
This commit is contained in:
@@ -163,16 +163,12 @@ static usb_device_class_config_list_struct_t UsbDeviceCompositeConfigList = {
|
|||||||
}
|
}
|
||||||
}};
|
}};
|
||||||
|
|
||||||
static bool isHostSleeping = false;
|
bool IsHostSleeping = false;
|
||||||
static uint8_t oldKeyBacklightBrightness = 0xFF;
|
static uint8_t oldKeyBacklightBrightness = 0xFF;
|
||||||
static bool capsLockOn = false, agentOn = false, adaptiveOn = false;
|
static bool capsLockOn = false, agentOn = false, adaptiveOn = false;
|
||||||
|
|
||||||
bool IsHostSleeping(void) {
|
|
||||||
return isHostSleeping;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void suspendHost(void) {
|
static void suspendHost(void) {
|
||||||
isHostSleeping = true;
|
IsHostSleeping = true;
|
||||||
// Save the state of the icons
|
// Save the state of the icons
|
||||||
capsLockOn = LedDisplay_GetIcon(LedDisplayIcon_CapsLock);
|
capsLockOn = LedDisplay_GetIcon(LedDisplayIcon_CapsLock);
|
||||||
agentOn = LedDisplay_GetIcon(LedDisplayIcon_Agent);
|
agentOn = LedDisplay_GetIcon(LedDisplayIcon_Agent);
|
||||||
@@ -197,7 +193,7 @@ void WakeUpHost(bool sendResume) {
|
|||||||
USB_DeviceSetStatus(UsbCompositeDevice.deviceHandle, kUSB_DeviceStatusBus, NULL);
|
USB_DeviceSetStatus(UsbCompositeDevice.deviceHandle, kUSB_DeviceStatusBus, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
isHostSleeping = false; // The computer is now awake
|
IsHostSleeping = false; // The computer is now awake
|
||||||
|
|
||||||
// Restore keyboard backlight and text
|
// Restore keyboard backlight and text
|
||||||
KeyBacklightBrightness = oldKeyBacklightBrightness;
|
KeyBacklightBrightness = oldKeyBacklightBrightness;
|
||||||
@@ -223,7 +219,7 @@ static usb_status_t usbDeviceCallback(usb_device_handle handle, uint32_t event,
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isHostSleeping) {
|
if (IsHostSleeping) {
|
||||||
WakeUpHost(false); // Wake up the keyboard if there is any activity on the bus.
|
WakeUpHost(false); // Wake up the keyboard if there is any activity on the bus.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,12 +28,12 @@
|
|||||||
|
|
||||||
// Variables:
|
// Variables:
|
||||||
|
|
||||||
|
extern bool IsHostSleeping;
|
||||||
extern usb_composite_device_t UsbCompositeDevice;
|
extern usb_composite_device_t UsbCompositeDevice;
|
||||||
|
|
||||||
//Functions:
|
//Functions:
|
||||||
|
|
||||||
void InitUsb(void);
|
void InitUsb(void);
|
||||||
bool IsHostSleeping(void);
|
|
||||||
void WakeUpHost(bool sendResume);
|
void WakeUpHost(bool sendResume);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -428,7 +428,7 @@ void UpdateUsbReports(void)
|
|||||||
IsUsbMouseReportSent = false;
|
IsUsbMouseReportSent = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((previousLayer != LayerId_Base || !IsUsbBasicKeyboardReportSent || !IsUsbMediaKeyboardReportSent || !IsUsbSystemKeyboardReportSent || !IsUsbMouseReportSent) && IsHostSleeping()) {
|
if ((previousLayer != LayerId_Base || !IsUsbBasicKeyboardReportSent || !IsUsbMediaKeyboardReportSent || !IsUsbSystemKeyboardReportSent || !IsUsbMouseReportSent) && IsHostSleeping) {
|
||||||
WakeUpHost(true); // Wake up the computer if any key is pressed and the computer is sleeping.
|
WakeUpHost(true); // Wake up the computer if any key is pressed and the computer is sleeping.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user