寻找QWERTZ KEYBOARD MAP在自己的操作系统中使用

时间:2016-03-11 18:32:46

标签: c operating-system keymapping

有谁知道我在哪里可以找到这样一个关键地图?

我已经有一个(我们的关键地图),但我需要德国Qwertz一个。

例如,这是美国人:

#define STANDARD_KEYMAP_DEF { 0, 0x1B, '1', '2', '3', '4', '5' , '6', \
                          '7', '8', '9', '0', '-', '^', '\b', '\t', \
                          'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', \
                          'o', 'p', '[', ']', '\n', KBD_META_CTRL, 'a', 's', \
                          'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', \
                          '\'', '`', KBD_META_SHIFT, '\\', 'z', 'x', 'c', 'v', \
                          'b', 'n', 'm', ',', '.', '/',KBD_META_SHIFT, '*', \
                          KBD_META_LALT, ' ', KBD_META_CAPS, KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5, \
                          KEY_F6, KEY_F7, KEY_F8, KEY_F9, KEY_F10, KBD_META_NUM, KBD_META_SCRL, '7', \
                          '8', '9', '-', '4', '5', '6', '+', '1', \
                          '2', '3', '0', '.', 0, 0, 0, KEY_F11  , \
                          KEY_F12, 0, 0, 0, 0, 0, 0, 0, \
                          0, '\n', KBD_META_CTRL, '/', KEY_PRNT, KBD_META_RALT, 0, KEY_HOME, \
                          KEY_UP, KEY_PGUP, KEY_LFT, KEY_RT, KEY_END, KEY_DN, KEY_PGDN, KEY_INS, \
                          0, 0, 0, 0, 0, 0, 0, 0, \
                          0, 0, 0, 0, 0, 0, 0, 0, \
                        }

2 个答案:

答案 0 :(得分:0)

根据possibly the sole place on the whole Internet were you'll find relevant information about this,你可以做以下两件事之一:

  • 查看udev / X11的来源。显然,Linux键盘驱动程序只报告扫描代码,应用程序必须知道它的含义。

  • 按照udev / X11的来源编写方式,即连接你的WhateverLanguage键盘,每次按下一个键时让代码打印相应的扫描码。这样,您就可以知道哪些扫描代码映射到密钥ß,您可以将其硬编码到表中。你只需要一点耐心;)。

答案 1 :(得分:0)

我还有另一个建议:loadkeys -d --mktable输出一个很好的Linux表格中的密钥代码表。 dumpkeys -l显示哪个键码绑定到哪个keysym,然后。另一种方法是运行showkey并按下感兴趣的键(因此,显然你需要一个德语键盘)。

我系统上loadkeys -d --mktable的部分输出(带有标准德语QWERTZ布局的笔记本电脑):

unsigned short plain_map[NR_KEYS] = {
    0xf200, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036,
    0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009,
    0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69,
    0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73,
    0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b,
    0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76,
    0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c,
    0xf703, 0xf020, 0xf207, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
    0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307,
    0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
    0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a,
    0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf30e, 0xf702, 0xf30d, 0xf200, 0xf701, 0xf205, 0xf114, 0xf603,
    0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116,
    0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf11d,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf210, 0xf211, 0xf20e,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
};

static unsigned short shift_map[NR_KEYS] = {
    0xf200, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e,
    0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf809,
    0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49,
    0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53,
    0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a,
    0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56,
    0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c,
    0xf703, 0xf020, 0xf207, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110,
    0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307,
    0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301,
    0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120,
    0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf30e, 0xf702, 0xf30d, 0xf200, 0xf701, 0xf205, 0xf114, 0xf603,
    0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116,
    0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf11d,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf206, 0xf206, 0xf210,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
    0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
};

如果从那里取值,例如plain_map[3] 0xf032,只取最低有效字节,然后得到0x32,查看dumpkeys -l的输出(部分)...... / p>

0x0000  nul
0x0001  Control_a
0x0002  Control_b
0x0003  Control_c
0x0004  Control_d
0x0005  Control_e
0x0006  Control_f
0x0007  Control_g
0x0008  BackSpace
0x0009  Tab
0x000a  Linefeed
0x000b  Control_k
0x000c  Control_l
0x000d  Control_m
0x000e  Control_n
0x000f  Control_o
0x0010  Control_p
0x0011  Control_q
0x0012  Control_r
0x0013  Control_s
0x0014  Control_t
0x0015  Control_u
0x0016  Control_v
0x0017  Control_w
0x0018  Control_x
0x0019  Control_y
0x001a  Control_z
0x001b  Escape
0x001c  Control_backslash
0x001d  Control_bracketright
0x001e  Control_asciicircum
0x001f  Control_underscore
0x0020  space
0x0021  exclam
0x0022  quotedbl
0x0023  numbersign
0x0024  dollar
0x0025  percent
0x0026  ampersand
0x0027  apostrophe
0x0028  parenleft
0x0029  parenright
0x002a  asterisk
0x002b  plus
0x002c  comma
0x002d  minus
0x002e  period
0x002f  slash
0x0030  zero
0x0031  one
0x0032  two
0x0033  three
0x0034  four
0x0035  five
0x0036  six
0x0037  seven
0x0038  eight
0x0039  nine
0x003a  colon
0x003b  semicolon
0x003c  less
0x003d  equal
0x003e  greater
0x003f  question
0x0040  at
0x0041  A
0x0042  B
0x0043  C
0x0044  D
0x0045  E
0x0046  F
0x0047  G
0x0048  H
0x0049  I
0x004a  J
0x004b  K
0x004c  L
0x004d  M
0x004e  N
0x004f  O
0x0050  P
0x0051  Q
0x0052  R
0x0053  S
0x0054  T
0x0055  U
0x0056  V
0x0057  W
0x0058  X
0x0059  Y
0x005a  Z
0x005b  bracketleft
0x005c  backslash
0x005d  bracketright
0x005e  asciicircum
0x005f  underscore
0x0060  grave
0x0061  a
0x0062  b
0x0063  c
0x0064  d
0x0065  e
0x0066  f
0x0067  g
0x0068  h
0x0069  i
0x006a  j
0x006b  k
0x006c  l
0x006d  m
0x006e  n
0x006f  o
0x0070  p
0x0071  q
0x0072  r
0x0073  s
0x0074  t
0x0075  u
0x0076  v
0x0077  w
0x0078  x
0x0079  y
0x007a  z
0x007b  braceleft
0x007c  bar
0x007d  braceright
0x007e  asciitilde
0x007f  Delete
// ...

...是keyym two。在运行showkey打印时按下键盘上的两个(非小键盘)

keycode 3   press
keycode 3   release

证实了我(模糊)对那里发生的事情的理解(:D)

我确信通过一个小型的翻译程序" (您需要编写),使用上述信息,您就可以获得映射。 (如果需要,我可以提供完整的文件)