arduino / arduino/Arduino

Leonardo Keyboard.write generates incorrect codes for certain input values

Open
#1,358 6 comments 0 reactions 1 assignee Claimed by @cmaglie View on GitHub
Component: Core Library: HID Type: Bug
Dominant language
Java
Stars
14.6k
Forks
7k
PR merge metrics
No merged PRs in 30d

Description

The Arduino Leonardo Keyboard.write command generates incorrect KeyDown & KeyUp wParam values as follows:

KEY_LEFT_CTRL & KEY_RIGHT_CTRL both generate 17 but should generate 162 & 163 respectively.
KEY_LEFT_SHIFT & KEY_RIGHT_SHIFT both generate 16 but should generate 160 & 161 respectively.
KEY_LEFT_ALT & KEY_RIGHT_ALT both generate 18 but should generate 164 & 165 respectively.

I believe the following should also happen although it may have been done on purpose by the designers.

Keyboard.write() values of 48 to 57 generate the correct codes of 48 to 57 for the main pad keys 0 thru 9.
I believe the values of 166 to 174 should generate the Numpad key values of 96 to 105 but instead they also generate the main pad key ones of 48 to 57.

No other values generate 96 to 105, 160 to 165 so there is no way to generate the Numpad numeric keys or the Left & Right versions of the 3 modifiers.

All the remaining values generate the expected KeyDown/KeyUp wParam values.

These results are all on a Windows 7 system although I suspect that isn't relevant and that they in fact would be true of any Windows system.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.