-
-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Leonardo Keyboard.write generates incorrect codes for certain input values #1358
Comments
Just curious as to whether anyone (dev or other) has even read this thread? Even if nothing's going to be done anytime soon it'd be nice to know that it's at least been noted and maybe put on a list of things to be fixed someday. |
We read it, the list is the github issues, and this one is correctly submitted. |
Thanks cmaglie! It's nice to know I haven't been wasting my time for the last month just checking for updates and will continue to watch. I'm simply using work arounds for the time being but would love to eliminate them once a fix is issued. |
You should look at the issue #1391. There you can find the changes which make it possible to send any key code (actually USB HID "usages"), not only ASCII based codes plus some special codes. Some of the allowed keycodes are defined in the changed file hardware/arduino/cores/arduino/USBAPI.h the complete list can be found in chapter 10 "Keyboard/Keypad Page (0x07)" of http://www.usb.org/developers/devclass_docs/Hut1_11.pdf. Some of the codes (any "usage" value below 120) can be reached today without patches to the Arduino code by adding 136 to the value. To send the key <Keypad 1>, use Keyboard.press(136+89) |
The last sentence of the previous comment should be |
Thank You! nospam2000! The codes you supplied properly generate the Numpad Enter, Dot & the numeric keys. The left/right ctrl, shift & alt were less of an issue for my current projects so I'm quite content to live with those issues. |
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.
The text was updated successfully, but these errors were encountered: