Skip to contentSkip to conversation

Keyboard problem in qemu 0.6.0-2

Qemu-devel Juergen Keil 4 participants 6 messages Sep 3, 2004 – Sep 7, 2004

lore
Share & tools
lore
#0 lore raw
Quoted 8 lines

I have similar problems with a Solaris10_x86 host running QEMU 0.6.0 when displaying to the default Xsun X-Server at ':0.0' or forwarding to my SPARC machines running several Solaris versions.

These problems make QEMU (any Guest OS's command line, any input fields) completely unusable.

Yep, I noticed that problem, too. On a Solaris9_x86 host / Xsun.

The root cause is probably the sdl.c:sdl_keyevent_to_keycode() subroutine that assumes X11 keycodes can be converted to PC scancodes by substracting 8 from the X11 keycode (for keycodes in the range 8..96):

static uint8_t sdl_keyevent_to_keycode(const SDL_KeyboardEvent *ev)

{
    int keycode;

    keycode = ev->keysym.scancode;

    if (keycode < 9) {
        keycode = 0;
    } else if (keycode < 97) {
        keycode -= 8; /* just an offset */
    } else if (keycode < 158) {
        /* use conversion table */
        keycode = x_keycode_to_pc_keycode[keycode - 97];
    } else {
        keycode = 0;
    }
    return keycode;
}

I guess that (``scancode = keycode - 8'') only works with an XFree86 X11 server.

My current workaround is to compile sdl.c with CONFIG_SDL_GENERIC_KBD defined. This enables a more accurate X11 keysym to PC scancode translation
table. Problem is, the translation table assumes a US keyboard layout.

#1 lore raw

Juergen,

hey, great: I knew you would have the detailed answer :)
You make Sol_x86 user's life easier!
I use your audio drivers (the old 137x as well as the newer audioemu ones) for three years now.

Quoted 1 line

Yep, I noticed that problem, too. On a Solaris9_x86 host / Xsun.

Solaris*9* host? But how did you manage to get around these symbol resolution errors related to 'fesetround', 'lrint' and 'llrint'?

Simply copying over the required libraries from Solaris10:/lib/[required libs] to /lib didn't solve the problem. Do I have to modify ld's database or something like that?

Thank you,

Martin

Quoted 8 lines

Yep, I noticed that problem, too. On a Solaris9_x86 host / Xsun.

The root cause is probably the sdl.c:sdl_keyevent_to_keycode() subroutine that assumes X11 keycodes can be converted to PC scancodes by substracting 8 from the X11 keycode (for keycodes in the range 8..96):

#2 lore raw
Quoted 1 line · Martin

You make Sol_x86 user's life easier!

Solaris user's to be correct.

He offers drivers for both SPARC and x86 platforms.

#3 lore raw
In reply to Juergen Keil

I'll try to merge parts of the VNC patch to solve the problem (rdesktop keyboard mappings support).

Fabrice.

Quoted 50 lines · Juergen Keil
Quoted 4 lines

I have similar problems with a Solaris10_x86 host running QEMU 0.6.0 when displaying to the default Xsun X-Server at ':0.0' or forwarding to my SPARC machines running several Solaris versions.

These problems make QEMU (any Guest OS's command line, any input fields) completely unusable.

Yep, I noticed that problem, too. On a Solaris9_x86 host / Xsun.

The root cause is probably the sdl.c:sdl_keyevent_to_keycode() subroutine that assumes X11 keycodes can be converted to PC scancodes by substracting 8 from the X11 keycode (for keycodes in the range 8..96):

static uint8_t sdl_keyevent_to_keycode(const SDL_KeyboardEvent *ev)

{
    int keycode;

    keycode = ev->keysym.scancode;

    if (keycode < 9) {
        keycode = 0;
    } else if (keycode < 97) {
        keycode -= 8; /* just an offset */
    } else if (keycode < 158) {
        /* use conversion table */
        keycode = x_keycode_to_pc_keycode[keycode - 97];
    } else {
        keycode = 0;
    }
    return keycode;
}

I guess that (``scancode = keycode - 8'') only works with an XFree86 X11 server.

My current workaround is to compile sdl.c with CONFIG_SDL_GENERIC_KBD defined. This enables a more accurate X11 keysym to PC scancode translation
table. Problem is, the translation table assumes a US keyboard layout.

_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel

#4 lore raw

Hi,

Quoted 2 lines · Fabrice Bellard

I'll try to merge parts of the VNC patch to solve the problem (rdesktop keyboard mappings support).

Unfortunately, a few important keys don't work yet (Cursor keys, Delete, AltGr, ...). I did not fix it yet because my priority was VNC. I will try that now.

Now, another question (Hi Fabrice): As the keymaps of rdesktop use the XKeysym names, I had to generate a mapping from XKeysym names to SDL keycodes. In order to do that, I created a little shell script which tries to convert as much as possible automatically from the file SDL_keysym.h, because the constants defined there resemble closely the Xkeysym names.

Is this the preferred way, or should I create a header (Xkeysym2SDLkeysym.h) once and for all?

Ciao,
Dscho

#5 lore raw
In reply to Fabrice Bellard

Hi,

attached is a cut down version of my rfb patch. It now only contains changes necessary to interpret rdesktop's keymaps. After applying ("cd qemu; make distclean; gunzip < attached.patch | patch -p1; ./configure; make") you can specify your keyboard layout via "-k":

qemu -k de
or
qemu -k fr

Any comments, suggestions, etc. welcome.

Ciao,
Dscho