Merge pull request #98 from Lauszus/sleep

Wake up the keyboard if there is any activity on the bus
This commit is contained in:
László Monda
2018-03-11 20:07:59 +01:00
committed by GitHub
+6 -4
View File
@@ -227,6 +227,9 @@ static usb_status_t usbDeviceCallback(usb_device_handle handle, uint32_t event,
return status; return status;
} }
if (computerSleeping)
WakeupComputer(false); // Wake up the keyboard if there is any activity on the bus
switch (event) { switch (event) {
case kUSB_DeviceEventBusReset: case kUSB_DeviceEventBusReset:
UsbCompositeDevice.attach = 0; UsbCompositeDevice.attach = 0;
@@ -239,10 +242,9 @@ static usb_status_t usbDeviceCallback(usb_device_handle handle, uint32_t event,
} }
break; break;
case kUSB_DeviceEventResume: case kUSB_DeviceEventResume:
if (computerSleeping) { // We will just wake up the computer if there is any activity on the bus
WakeupComputer(false); // The computer just woke up, so restore the LEDs // 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; status = kStatus_USB_Success;
}
break; break;
case kUSB_DeviceEventSetConfiguration: case kUSB_DeviceEventSetConfiguration:
UsbCompositeDevice.attach = 1; UsbCompositeDevice.attach = 1;