From ab24e78a5b2c1bee228468f139c694de049153f9 Mon Sep 17 00:00:00 2001 From: Kristian Sloth Lauszus Date: Sun, 11 Mar 2018 20:05:10 +0100 Subject: [PATCH] Wake up the keyboard if there is any activity on the bus This fixes: https://github.com/UltimateHackingKeyboard/firmware/pull/97#issuecomment-372091423 --- right/src/usb_composite_device.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/right/src/usb_composite_device.c b/right/src/usb_composite_device.c index 2b43662..1a0ddf2 100644 --- a/right/src/usb_composite_device.c +++ b/right/src/usb_composite_device.c @@ -227,6 +227,9 @@ static usb_status_t usbDeviceCallback(usb_device_handle handle, uint32_t event, return status; } + if (computerSleeping) + WakeupComputer(false); // Wake up the keyboard if there is any activity on the bus + switch (event) { case kUSB_DeviceEventBusReset: UsbCompositeDevice.attach = 0; @@ -239,10 +242,9 @@ static usb_status_t usbDeviceCallback(usb_device_handle handle, uint32_t event, } break; case kUSB_DeviceEventResume: - if (computerSleeping) { - WakeupComputer(false); // The computer just woke up, so restore the LEDs - status = kStatus_USB_Success; - } + // We will just wake up the computer if there is any activity on the bus + // The problem is that the computer won't send a resume event when it boots, so the lights will never come back on + status = kStatus_USB_Success; break; case kUSB_DeviceEventSetConfiguration: UsbCompositeDevice.attach = 1;