Adjusting (USB) keyboard code mapping

tomicdesu

Member
First off, Paul Stoffregen, I'm just amazed at the amount of code you've contributed here. The USB Keyboard stuff is awesome (correct word). I know only the basics of USB (utterly insufficient! lol), and I was able to adapt Examples/USBHost_t36/KeyboardForeward as a useful keyboard in an afternoon. I've got a Logitech wireless (dongle type) keyboard on a small hub plugged into a USB-C socket wired to the USB-host pins and it came right up.

My keyboard has a few mapping errors (specifically the ENTER key is returning code 10, LF, instead of 13, CR). I'm familiar with how modern keyboards map up/down and modifiers to ASCII and other output codes, I've found the/a four-column keymap table in the guts of the teensy/hardware libraries... but the libraries are fairly convoluted, I can't find a guide to how they are arranged, and what I need to do can't be rare, so can anyone tell me what/where the hooks are for specifying a user-defined motion codes to "ASCII" output character are? Or other hooks to modify the existing table? Just need to juggle ENTER key, at this time.

I may be using the api wrong; I'm using the key code from OnPress (). There's tantalizing hints in https://forum.pjrc.com/index.php?threads/usbhost_t36-library-keyboard-modifier-keys.52231/ but I think I'm missing something to understand the overall approach.
 
Hi,

sorry for not contributing to your question, but what exactly did you adapt in the code? Which Teensy version did you use? I cannot get the code to run properly on my Teensy 3.6, see my posting here:
Mouse/Keyboard Forward Examples From USBHost_t36 Not Working as Expected

Thank you in advance!
I'm running a Teensy 4.1. The example Examples/USBHost_t36/KeyboardForeward worked as-is for me without change. From there I just stripped out the things I didn't need.

Unfortunately I don't have a 3.6 to try, sorry.
 
I'm running a Teensy 4.1. The example Examples/USBHost_t36/KeyboardForeward worked as-is for me without change. From there I just stripped out the things I didn't need.

Unfortunately I don't have a 3.6 to try, sorry.

Thank you very much for your reply, that helps a lot knowing the example runs with the Teensy 4.1! I ordered one for further testing.

Did you take a look at ~/.arduino15/packages/teensy/hardware/avr/1.59.0/cores/keylayouts.h? To me it looks like most of the key mappings are defined there, but it is just a wild guess.
 
Thank you very much for your reply, that helps a lot knowing the example runs with the Teensy 4.1! I ordered one for further testing.

Did you take a look at ~/.arduino15/packages/teensy/hardware/avr/1.59.0/cores/keylayouts.h? To me it looks like most of the key mappings are defined there, but it is just a wild guess.

I haven't delved very deeply into it yet, but thanks for the big hint! I'm also using a really old crappy keyboard, a new one arrives any day now, I'll have two to compare and work with.
 
Back
Top