Skip to content

Leonardo keyboard API only allows ASCII input #1386

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

Closed
yahesh opened this issue Apr 27, 2013 · 12 comments
Closed

Leonardo keyboard API only allows ASCII input #1386

yahesh opened this issue Apr 27, 2013 · 12 comments
Assignees
Labels
Component: Core Related to the code for the standard Arduino API Type: Bug

Comments

@yahesh
Copy link

yahesh commented Apr 27, 2013

The Arduino Leonardo keyboard API only allows ASCII input and then converts it to the actual key codes sent to the computer via USB. This is a huge problem because it fails for non-QWERTY systems (e.g. in Germany, France) and even for non-Windows systems (e.g. when it comes to special characters on a Mac).

Take this code as a small example. On a German computer this will actually output "qwerty".

void setup() {
  Keyboard.begin();

  pinMode(2, INPUT);
  digitalWrite(2, HIGH);
}

void loop() {
  while (digitalRead(2) == HIGH) {
    delay(500);
  }
  delay(1000);

  Keyboard.print("qwertz");
}

It would be great to have something like Keyboard.pressKeycode() and Keyboard.releaseKeycode() and actually do the conversions ourselves. That way we could ask the user what keyboard layout he/she has and do everything appropriately.

@sandeepmistry
Copy link
Contributor

Closing, looking at Keyboard.h the following API's are present:

  size_t press(uint8_t k);
  size_t release(uint8_t k);
  void releaseAll(void);

@trahloff
Copy link

How would you modify these APIs in Keyboard.h to achieve a conversion?

@sandeepmistry
Copy link
Contributor

Re-opening this, on closer inspection raw key codes are still not supported currently.

@sandeepmistry sandeepmistry reopened this Mar 15, 2016
@nospam2000
Copy link

look at pull request 1391 it contains the code for the raw key codes

@NicoHood
Copy link
Contributor

We decided that the arduino IDE keeps the library simple while my HID Project will add all those new features. That was made with 1.6.6 or 1.6.7 (?) when the new usb core came out.
https://github.com/NicoHood/HID

I think you can close this issue as "wont fix"

@PaulStoffregen
Copy link
Contributor

@NicoHood - I see you've used my international keyboard layouts code in your project. Please be aware the license for that code includes a requirement to have Teensy installed in the Tools > Boards menu. It may be used on non-Teensy boards, but only when full Teensy support is available to the user in the menu.

@NicoHood
Copy link
Contributor

which international keyboard layouts code? TeensyKeyboardAPI.h etc? That is not working. And well if you say we cannot use it like that i will remove the code in the next release :/

@limpkin
Copy link

limpkin commented Mar 16, 2016

oh that brings back lots of memories for the mooltipass project... we had to make a python script to generate Look Up Tables between ascii codes and keyboard layouts... good times.

@yahesh
Copy link
Author

yahesh commented Mar 20, 2016

IMHO it's still badly solved in the Core.

@NicoHood
Copy link
Contributor

@weizenspreu feel free to buils something on top of HID-Project to use different layouts. It should be possible.

@yahesh
Copy link
Author

yahesh commented Mar 20, 2016

The Arduino/Genuino Leonardo is EOL already, so I won't bother any longer.

@yahesh yahesh closed this as completed Mar 20, 2016
@NicoHood
Copy link
Contributor

Who said that? Those avrs are still widely used. Especially those with a 328 and a 32u4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Core Related to the code for the standard Arduino API Type: Bug
Projects
None yet
Development

No branches or pull requests

9 participants