Problems with USB keyboard (keydown and inkey)


Author Message
Amnesie
Guru

Joined: 30/06/2020
Location: Germany
Posts: 757
Posted: 04:52pm 02 Oct 2025      

  matherp said  
If I understand what you are trying to do, you probably don't need MM.USB at all.
Keydown[1] gives you the last key pressed as an ascii character and keydown[7] tells you if any modifier keys are pressed. Together they should allow you program to work out any accented character. Just don't use input$ at all.


Hi Peter, thanks for quick reply!

I already did it like you suggested, but I think you can't try this because you haven't a german keyboard. The whole reason asking for something like MM.USB is the fact that:

keydown(1) does NOT respond to the german keyboard keys "äöüß" so there is nothing I could further process or re-map.

In other words:


Do
Print keyDown(1)
Loop


does not print anything if I hit "ä","ü","ö","ß"

The solution (or at least part of it) is your new function MM.USB, only here I have the chance to "catch" any output from the mentioned keys.

So my only chance is to do the following:

1. read the raw key (ä,ö,ü,ß) via MM.USB
2. check via keyDown(7) if SHIFT-key is pressed
3. manually map the "ä,ö,ü,ß / Ä, Ü, Ö, ?" to a custom FONT, which Martin kindly created

Problem: as soon as I use "keyDown(7)" everything is "laggy", keypresses are skipped or ignored.

With PS/2 I did the same (only of course with MM.Info(PS2)) and it works just perfect! No missed keys, no latency at all. I hoped, that this workaround would also work for the USB version. This way one could implement ANY keyboard layout.

Greetings
Daniel
Edited 2025-10-03 02:56 by Amnesie