Key mappings to all characters

Asked by Chafnan

The issue that I am having is that that my system is set to use a dvorak keyboard. So, when pressing the buttons on the n52te game pad, I get the correct dvorak mappings. The problem is the the top row has the period, comma, and apostrophe buttons because of the dvorak mapping. The "KEY_COMMA" and "IKEY_APOSTROPHE" work but the "KEY_PERIOD" is not working.

Is there a list of each keyboard character and the corresponding "KEY_" to it?

Question information

Language:
English Edit question
Status:
Solved
For:
Pystromo Edit question
Assignee:
No assignee Edit question
Solved by:
Raumkraut
Solved:
Last query:
Last reply:
Revision history for this message
Raumkraut (raumkraut) said :
#1

I think the code you're looking for is KEY_DOT.

But if I'm wrong, or you need to find the code for another key, you can run the pystromo-remap script with a -vv argument and see all the input events (including the codes) for every input device that has been configured in the mapping file.

Eg., for my mouse:
$ ./pystromo-remap.py -vv -m config/mx510.map
Using output: <lib.devices.OutputDevice object at 0xb7cecc0c>
Loading mappings
config/mx510.map
Using device: <InputDevice "mx510" on 1 device nodes>
Incoming event: <Event timestamp=1230289677.6038339, type='EV_KEY', code='BTN_LEFT', value=1>
Incoming event: <Event timestamp=1230289677.731885, type='EV_KEY', code='BTN_LEFT', value=0>
Incoming event: <Event timestamp=1230289687.5963991, type='EV_REL', code='REL_WHEEL', value=-1>
Incoming event: <Event timestamp=1230289688.2764831, type='EV_REL', code='REL_WHEEL', value=1>

Revision history for this message
Chafnan (chafnan) said :
#2

The weird thing that is happening is that the keys are qwerty is the
remapper. So, to got a "C" to character, I have to map the a key to
"KEY_I", because the "C" on the dvorak layout is where the "I" is in on the
qwerty layout. Where my problem was before was is that to get the character
"V" i need the "KEY_DOT". Since, the keys are showing to be qwerty the
period was not showing in the pystromo-remap -vv. Thanks for pointing the
"KEY_DOT" out to me. Worked great.

I am trying to find a setting that I can use that xorg will leave the n52te
as qwerty and my keyboard as dvorak. If I could do that, then the mapping
would all be straight forward and easier to use. Any suggestions how to
accomplish this?

Revision history for this message
Best Raumkraut (raumkraut) said :
#3

Keyboards generally don't know or care what's marked on their buttons (hence the Das Keyboard). The signal they send depends only on how the buttons are wired, and those generic signals are mapped to the relevant keyboard layout by the computer.
There is a discrepancy between what is marked on your keyboard and what the appropriate KEY_ code is, because the KEY_* names are just arbitrary strings mapped onto the signals the keyboards send, for convenience. The strings Pystromo uses are based on a Qwerty keyboard, an American one I think.

As to the multiple-layout issue, there is a "xkblayout" option used in xorg.conf, and also a cli-app called `setxkbmap`. I haven't tried using either of them explicitly though.

Revision history for this message
Chafnan (chafnan) said :
#4

I got this program working with Linux and the n52te. Works good. Thanks for the help.

An interesting note about the n52te is that it has on board memory. This means that if you remap the key in Windows, it is changed in the device. So the changes appear is Linux when used again. It was a good way to discover what the "KEY_" codes are. The only thing that the wont work in the Windows version is putting multiple keys together. It will only allow one. I could do a macro but those weren't working either.

Thanks for the help.