* suspend: suppress wake up keypress
Waking the host from suspend is done by pressing any key on the
keyboard, the regular key codes assigned to the keys are not important
and must not be sent - otherwise they usually end up in password prompts
as ghost characters that have to be deleted again. This commit adds
suppression for all keys pressed at the time of wake up. Once a key is
released it functions as a regular key again.
Signed-off-by: Stefan Kerkmann <karlk90@pm.me>
* suspend: update wake up matrix after wake up delay
If USB_SUSPEND_WAKEUP_DELAY is set, the keyboard sleeps during wake up -
which can be up to multiple seconds. To handle key presses and releases
in that time frame we have to handle the following cases:
1. Key not pressed before suspend, and not pressed after wakeup → do
nothing (normal case).
2. Key not pressed before suspend, but pressed after wakeup → set the
wakeup_matrix bit to 1 (so that the press and release events would be
suppressed).
3. Key pressed before suspend, but not pressed after wakeup → do nothing
(the release event will be generated on the first matrix_task() call
after the wakeup).
4. Key pressed before suspend, and still pressed after wakeup → do
nothing (the release event will be generated some time later).
Signed-off-by: Stefan Kerkmann <karlk90@pm.me>
Co-authored-by: Sergey Vlasov <sigprof@gmail.com>
* keyboards: anavi: macropad8: disable snake and rgb_test effects
...to shrink the binary size.
* docs: fix misspellings
* docs: do line breaks with HTML instead of spaces
To remove trailing spaces and to avoid breaking things, line breaks can
be done with the HTML br tag.
chibios: usb_main: remove OTG sof workaround
With the update of ChibiOS and ChibiOS-Contrib containing fixes for the
OTGv1 LLD the workaround is not necessarry anymore.
Signed-off-by: Stefan Kerkmann <karlk90@pm.me>
* usb_device_state: add idle_rate, led and protocol
Previously all usb drivers and platform implementations (expect for our
oddball atsam) tracked the same two global variables:
- keyboard_protocol: to indicate if we are in report or boot protocol
- keyboard_idle: for the idle_rate of the keyboard endpoint
And a local variable that was exposed trough some indirection:
- keyboard_led_state: for the currently set indicator leds (caps lock etc.)
These have all been moved into the usb_device_state struct wich is
accessible by getters and setters.
This reduces code duplication and centralizes the state management
across platforms and drivers.
Signed-off-by: Stefan Kerkmann <karlk90@pm.me>
* usb_device_state: reset protocol on reset
The usb hid specification section 7.2.6 states:
When initialized, all devices default to report protocol. However the
host should not make any assumptions about the device’s state and should
set the desired protocol whenever initializing a device.
Thus on reset we should always do exactly that.
Signed-off-by: Stefan Kerkmann <karlk90@pm.me>
* keyboards: fix oversize warnings
Signed-off-by: Stefan Kerkmann <karlk90@pm.me>
---------
Signed-off-by: Stefan Kerkmann <karlk90@pm.me>
* Allow for `get_hardware_id()` to be used for serial number.
* Length checks.
* Explain length.
* Cleanup.
* Preprocessor magic.
* Use the force, Batman.
* Swap logic; if SERIAL_NUMBER is defined use that, otherwise derive it.
* Cleanup.
* Cleanup.
* ChibiOS: USB HID control request as dedicated struct
Instead of accessing the raw USB setup packet and documenting the values
as the corresponding USB HID control request fields we introduce a
struct that allows direct access to the fields. This is safer and self
documenting.
* Rename usb_request.h to usb_types.h
In the future all shared USB data types can live in this file.
* Clean up some keyboard/userspace code
* Rename `KEYBOARD_REPORT_BITS` -> `NKRO_REPORT_BITS`
* Add some missing includes
* Use `PACKED` define for report types
* Fix incorrect function signatures for FlexRAM EEPROM driver