agausmann / atmega-usbd

Rust usb-device support for ATmega chips
BSD Zero Clause License
27 stars 10 forks source link

arduino_keyboard: "Hello World" is typed as "Helo World" #5

Closed agausmann closed 1 year ago

agausmann commented 2 years ago

The reports for the two "L" keypresses are identical, which supposedly makes the host PC think that the "L" key has been held down.

Possible solutions:

kanashimia commented 2 years ago

I fixed this myself by adding a case for b'\0' that sends empty report, and the modified the string to contain it between L's. There is even a simpler solution by replacing Hello world with something that doesn't contain double characters, but than users won't understand why some different string wont work.

stappersg commented 2 years ago

In another attempt to add value, a.k.a. noise warning:

Arent' there "key pressed" and "key released" key codes?

https://www.win.tue.nl/~aeb/linux/kbd/scancodes-1.html says so ...

agausmann commented 2 years ago

Arent' there "key pressed" and "key released" key codes?

"Scan codes" are not the same as the keycodes defined in the HID Usage Tables (usage page 0x07 is the one for keyboard keys)

There is no concept of press and release events in HID (at least not in the standard keyboard report), just the state of whether the key is currently pressed or not.

agausmann commented 1 year ago

Should be fixed by a9b148808886b8b7baf4802c1375cb9fec594711