It needs different firmware from the factory, so we need to distinguish
it from software in order to be able to update it correctly.
Signed-off-by: Daniel Schaefer <dhs@frame.work>
Let the keyboard figure out by itself whether the system is asleep by
looking at the USB connection state.
| | USB Active | USB Suspend |
| Lid Open | LED, keys | No LED, keys |
| Lid closed | No LED, no keys | No LED, no keys |
=> lid_open => keys registered
=> lid_open && !suspended => LEDs on
After waking from sleep, backlight does not turn back on.
Remove the custom backlight/sleep logic. Don't try to outsmart the core
quantum logic, let it handle the hard stuff. Our code just
suspends/wakes the keyboard.
Signed-off-by: Daniel Schaefer <dhs@frame.work>
If using VIA the backlight was set to effect 0, the only way to turn it
back on is using VIA or the RGB toggle key. But the user would expect
the next/prev animation key to also work.
Signed-off-by: Daniel Schaefer <dhs@frame.work>
With selective suspend windows likes to suspend the keyboard very
eagerly after 5 seconds without activity. So we send keyboard reports
every second for 25 seconds to keep it awake.
Signed-off-by: Daniel Schaefer <dhs@frame.work>
the tmk_core chibios protocol_pre_task does not
process any usb events when the host is in suspend.
I think there is a race condition where the usb_event_queue_task
will not be processed depending on when usb goes to sleep.
so we may fall into the
while (USB_DRIVER.state == USB_SUSPENDED) {
which comes directly from the hardware interrupt.
and never process pending events in
usb_event_queue_task();
Signed-off-by: Kieran Levin <ktl@frame.work>
Doesn't work yet, on Windows, because Windows will make a special
control request if it sees this.
On Linux lsusb shows it like this:
```
Binary Object Store Descriptor:
bLength 5
bDescriptorType 15
wTotalLength 0x0048
bNumDeviceCaps 2
USB 2.0 Extension Device Capability:
bLength 7
bDescriptorType 16
bDevCapabilityType 2
bmAttributes 0x00000000
(Missing must-be-set LPM bit!)
Platform Device Capability:
bLength 28
bDescriptorType 16
bDevCapabilityType 5
bReserved 0
PlatformCapabilityUUID {d8dd60df-4589-4cc7-9cd2-659d9e648a9f}
CapabilityData[0] 0x00
CapabilityData[1] 0x00
CapabilityData[2] 0x03
CapabilityData[3] 0x06
CapabilityData[4] 0x48
CapabilityData[5] 0x00
CapabilityData[6] 0x01
CapabilityData[7] 0x00
```
Signed-off-by: Daniel Schaefer <dhs@frame.work>