When an AOA HID keyboard is registered, CAPSLOCK and NUMLOCK are both disabled, regardless of the state of the computer keyboard. To synchronize the state, on first key event, inject CAPSLOCK and/or NUMLOCK if necessary.
This provides a better input experience, by simulating a physical keyboard. It converts SDL keyboard events to proper HID events, and send them over AOAv2. This is a rewriting and bugfix of the origin code from @amosbird: <https://github.com/Genymobile/scrcpy/issues/279#issuecomment-453819354> The feature is enabled the command line option -K or --hid-keyboard, and is only available on Linux, over USB. Refs <https://source.android.com/devices/accessories/aoa2#hid-support> Refs <https://www.usb.org/sites/default/files/hid1_11.pdf> PR #2632 <https://github.com/Genymobile/scrcpy/pull/2632> Signed-off-by: Romain Vimont <rom@rom1v.com>