esp32_mouse_keyboard icon indicating copy to clipboard operation
esp32_mouse_keyboard copied to clipboard

BLE - GATT transmission rate limiting

Open benjaminaigner opened this issue 5 years ago • 2 comments

On some phones (currently observed on one older Android device), the received GATT HID reports are processed slower, which leads to noticeable delayed movements.

A possible solution would be a rate limitation for sending GATT data.

Open for discussion:

Relative data (mouse movements):

Should we discard received UART HID data if sent too fast OR should the ESP32 sum up mouse movement values & send them accumulated in one report?

Absolute data (mouse clicks & keyboard keys):

I think these should be sent ASAP (when the rate limiting timeout is finished), without further modification.

@ChrisVeigl what's your opinion?

benjaminaigner avatar Jul 16 '20 12:07 benjaminaigner

Implemented both, behaviour can be changed via make menuconfig or idf.py menuconfig. See: https://github.com/asterics/esp32_mouse_keyboard/tree/rateLimiter

benjaminaigner avatar Jul 17 '20 12:07 benjaminaigner

Should we discard received UART HID data if sent too fast OR should the ESP32 sum up mouse movement values & send them accumulated in one report?

Absolute data (mouse clicks & keyboard keys):

I think these should be sent ASAP (when the rate limiting timeout is finished), without further modification.

wow - you were so fast implementing this i could not even add my comment ;-) great that both options are available now!

i agree that keyboard reports and mouse clicks should not be discarded - but sending them ASAP could also lead to problems (e.g. a mouse clicks at a wrong position). accumulations of relative data is IMO the best method and should be the default.

i added a PR with some comments: https://github.com/asterics/esp32_mouse_keyboard/pull/39

maybe we can now remove the rate limiting which exists in the FlipMouse code: https://github.com/asterics/FLipMouse/blob/56b854f2b889f4f2fac8f5503f65db2b070b8f90/FLipWare/bluetooth.cpp#L66

For this, we should integrate the rate limit settings of the ESP32 into the UART command protocol (to make it accessible from the host system / GUI).

ChrisVeigl avatar Jul 17 '20 15:07 ChrisVeigl