qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 5/6] input: switch sparc32 kbd to new input api


From: Mark Cave-Ayland
Subject: Re: [Qemu-devel] [PATCH 5/6] input: switch sparc32 kbd to new input api
Date: Sun, 04 May 2014 22:55:29 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131103 Icedove/17.0.10

On 02/05/14 22:26, Olivier Danet wrote:

On 29/04/2014 13:16, Gerd Hoffmann wrote:
   Hi,

+    [Q_KEY_CODE_META_R]        = 122,
+    [Q_KEY_CODE_COMPOSE]       = 67,
  };
This mapping does not look good on some details.

  COPY, FIND and CUT does not match the standard :
    [Q_KEY_CODE_COPY]          = 52 : Should be 0x33=51

    [Q_KEY_CODE_FIND]          = 97 : Should be 0x5F=95

    [Q_KEY_CODE_CUT]           = 99 : Should be 0x61=97

Hmm, can I type those somehow on a ps/2 kbd?
The sendkey monitor command doesn't work for them (in master).

Most likely those are not a regression from master.  Good to fix
nevertheless, I'll do it as incremental patch.  And it proves that this
cleanup is a good thing as it makes it *alot* easier to spot this kind
of bugs ;)

+    keycode = qcode_to_keycode[qcode];
+    if (evt->key->down) {
+        keycode |= 0x80;
      }

Instead :
     if (!evt->key->down) {
         keycode |= 0x80;
     }
keycode +0x80 is for KeyUp events.

Good spotting, thanks.

You can do some tests with "sparc-test-0.2.tar.gz" on qemu.org

Thanks.  Doesn't help much for the cut+copy keys though.

cheers,
   Gerd



Here is a mapping for Sun type 5c/6 keyboards :
http://temlib.org/pub/sun/keyboard.pdf

The International keyboard arrangement have one more key than the US, but codes 
are otherwise identical.
These keyboards still identifies as "Type 4".

For US/QWERTY, the layout should be set to 0x21 : (hw/char/escc.c)
      case 7: // Query layout
      case 0xf:
          clear_queue(s);
          put_queue(s, 0xfe);
-         put_queue(s, 0); // XXX, layout?
+         put_queue(s, 0x21); // USA layout
          break;
      default:

Here is a mapping with corrected codes for arrows/pgup/pgdown... :

static const uint8_t qcode_to_keycode[Q_KEY_CODE_MAX] = {
     [Q_KEY_CODE_SHIFT]         = 99,
     [Q_KEY_CODE_SHIFT_R]       = 110,
     [Q_KEY_CODE_ALT]           = 19,
     [Q_KEY_CODE_ALT_R]         = 13,
     [Q_KEY_CODE_ALTGR]         = 13,
     [Q_KEY_CODE_CTRL]          = 76,
     [Q_KEY_CODE_CTRL_R]        = 76,
     [Q_KEY_CODE_ESC]           = 29,
     [Q_KEY_CODE_1]             = 30,
     [Q_KEY_CODE_2]             = 31,
     [Q_KEY_CODE_3]             = 32,
     [Q_KEY_CODE_4]             = 33,
     [Q_KEY_CODE_5]             = 34,
     [Q_KEY_CODE_6]             = 35,
     [Q_KEY_CODE_7]             = 36,
     [Q_KEY_CODE_8]             = 37,
     [Q_KEY_CODE_9]             = 38,
     [Q_KEY_CODE_0]             = 39,
     [Q_KEY_CODE_MINUS]         = 40,
     [Q_KEY_CODE_EQUAL]         = 41,
     [Q_KEY_CODE_BACKSPACE]     = 43,
     [Q_KEY_CODE_TAB]           = 53,
     [Q_KEY_CODE_Q]             = 54,
     [Q_KEY_CODE_W]             = 55,
     [Q_KEY_CODE_E]             = 56,
     [Q_KEY_CODE_R]             = 57,
     [Q_KEY_CODE_T]             = 58,
     [Q_KEY_CODE_Y]             = 59,
     [Q_KEY_CODE_U]             = 60,
     [Q_KEY_CODE_I]             = 61,
     [Q_KEY_CODE_O]             = 62,
     [Q_KEY_CODE_P]             = 63,
     [Q_KEY_CODE_BRACKET_LEFT]  = 64,
     [Q_KEY_CODE_BRACKET_RIGHT] = 65,
     [Q_KEY_CODE_RET]           = 89,
     [Q_KEY_CODE_A]             = 77,
     [Q_KEY_CODE_S]             = 78,
     [Q_KEY_CODE_D]             = 79,
     [Q_KEY_CODE_F]             = 80,
     [Q_KEY_CODE_G]             = 81,
     [Q_KEY_CODE_H]             = 82,
     [Q_KEY_CODE_J]             = 83,
     [Q_KEY_CODE_K]             = 84,
     [Q_KEY_CODE_L]             = 85,
     [Q_KEY_CODE_SEMICOLON]     = 86,
     [Q_KEY_CODE_APOSTROPHE]    = 87,
     [Q_KEY_CODE_GRAVE_ACCENT]  = 42,
     [Q_KEY_CODE_BACKSLASH]     = 88,
     [Q_KEY_CODE_Z]             = 100,
     [Q_KEY_CODE_X]             = 101,
     [Q_KEY_CODE_C]             = 102,
     [Q_KEY_CODE_V]             = 103,
     [Q_KEY_CODE_B]             = 104,
     [Q_KEY_CODE_N]             = 105,
     [Q_KEY_CODE_M]             = 106,
     [Q_KEY_CODE_COMMA]         = 107,
     [Q_KEY_CODE_DOT]           = 108,
     [Q_KEY_CODE_SLASH]         = 109,
     [Q_KEY_CODE_ASTERISK]      = 47,
     [Q_KEY_CODE_SPC]           = 121,
     [Q_KEY_CODE_CAPS_LOCK]     = 119,
     [Q_KEY_CODE_F1]            = 5,
     [Q_KEY_CODE_F2]            = 6,
     [Q_KEY_CODE_F3]            = 8,
     [Q_KEY_CODE_F4]            = 10,
     [Q_KEY_CODE_F5]            = 12,
     [Q_KEY_CODE_F6]            = 14,
     [Q_KEY_CODE_F7]            = 16,
     [Q_KEY_CODE_F8]            = 17,
     [Q_KEY_CODE_F9]            = 18,
     [Q_KEY_CODE_F10]           = 7,
     [Q_KEY_CODE_NUM_LOCK]      = 98,
     [Q_KEY_CODE_SCROLL_LOCK]   = 23,
     [Q_KEY_CODE_KP_DIVIDE]     = 46,
     [Q_KEY_CODE_KP_MULTIPLY]   = 47,
     [Q_KEY_CODE_KP_SUBTRACT]   = 71,
     [Q_KEY_CODE_KP_ADD]        = 125,
     [Q_KEY_CODE_KP_ENTER]      = 90,
     [Q_KEY_CODE_KP_DECIMAL]    = 50,
     [Q_KEY_CODE_KP_0]          = 94,
     [Q_KEY_CODE_KP_1]          = 112,
     [Q_KEY_CODE_KP_2]          = 113,
     [Q_KEY_CODE_KP_3]          = 114,
     [Q_KEY_CODE_KP_4]          = 91,
     [Q_KEY_CODE_KP_5]          = 92,
     [Q_KEY_CODE_KP_6]          = 93,
     [Q_KEY_CODE_KP_7]          = 68,
     [Q_KEY_CODE_KP_8]          = 69,
     [Q_KEY_CODE_KP_9]          = 70,
     [Q_KEY_CODE_LESS]          = 124,
     [Q_KEY_CODE_F11]           = 9,
     [Q_KEY_CODE_F12]           = 11,
     [Q_KEY_CODE_HOME]          = 52,
     [Q_KEY_CODE_PGUP]          = 96,
     [Q_KEY_CODE_PGDN]          = 123,
     [Q_KEY_CODE_END]           = 74,
     [Q_KEY_CODE_LEFT]          = 24,
     [Q_KEY_CODE_UP]            = 20,
     [Q_KEY_CODE_DOWN]          = 27,
     [Q_KEY_CODE_RIGHT]         = 28,
     [Q_KEY_CODE_INSERT]        = 44,
     [Q_KEY_CODE_DELETE]        = 66,
     [Q_KEY_CODE_STOP]          = 1,
     [Q_KEY_CODE_AGAIN]         = 3,
     [Q_KEY_CODE_PROPS]         = 25,
     [Q_KEY_CODE_UNDO]          = 26,
     [Q_KEY_CODE_FRONT]         = 49,
     [Q_KEY_CODE_COPY]          = 51,
     [Q_KEY_CODE_OPEN]          = 72,
     [Q_KEY_CODE_PASTE]         = 73,
     [Q_KEY_CODE_FIND]          = 95,
     [Q_KEY_CODE_CUT]           = 97,
     [Q_KEY_CODE_LF]            = 111,
     [Q_KEY_CODE_HELP]          = 118,
     [Q_KEY_CODE_META_L]        = 120,
     [Q_KEY_CODE_META_R]        = 122,
     [Q_KEY_CODE_COMPOSE]       = 67,
     [Q_KEY_CODE_PRINT]         = 22,
     [Q_KEY_CODE_SYSRQ]         = 21,
};

The sound control and power keys are still lacking. but QEMU does not emulate 
the sound anyway.

I have tried a 119 keys Sun USB keyboard but the additional keys do not seem to
be detected by QEMU. Needs more work...

(Playing thread catch-up)

Since Olivier has hardware-level knowledge of Sun keyboards, I'm happy to defer to his knowledge in this area. I'll keep an eye out for the respin of this series and test on some of my images next time it goes through the list though.


ATB,

Mark.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]