Skip to content
This repository has been archived by the owner on Dec 14, 2023. It is now read-only.

Added a 10ms delay to work around a problem with Windows Remote Desktop #30

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/MultiReport/Keyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,19 @@ int Keyboard_::sendReport(void) {
int returnCode = HID().SendReport(HID_REPORTID_NKRO_KEYBOARD, &lastKeyReport, sizeof(lastKeyReport));
if (returnCode < 0)
lastKeyReport.modifiers = last_mods;

#if defined(KEYBOARDIOHID_MODIFIER_FLAG_DELAY)
// For Windows Remote Desktop, the problem is even worse. Even if the modifier is sent
// in a separate report, if one or more other keycodes are added in a subsequent
// report that comes too soon (probably before the next "frame" is sent to the remote
// host), it seems that the two reports get combined, and we once again see the
// problem. So, if both a modifier keycode and a non-modified keycode have changed in
// one report, we add a delay between the modifier report (sent above) and the other
// report (sent below).
if (memcmp(lastKeyReport.keys, keyReport.keys, sizeof(keyReport.keys)))
delay(KEYBOARDIOHID_MODIFIER_FLAG_DELAY);
#endif

}

// If the last report is different than the current report, then we need to send a report.
Expand Down