Skip to contentSkip to conversation

Keysymbol interpretation missing in QEMU's VNC server?

Qemu-devel Fabian Holler 4 participants 7 messages Mar 7, 2012 – May 23, 2012

lore
Share & tools
lore
#0 lore raw

Hello,

I'm not sure if I found a bug in QEMU's VNC keyboard layout mapping or if it's a general problem in the implemented VNC server:

Scenario:
QEMU started with: "-k de"
Keyboard layout in VM: de
Keyboard layout from Client OS: us

What i expect:
I type the '/' character on the Client OS (key left from the right-shift-key) on US layout. Keysymbol '/' is send over VNC to the QEMU.
QEMU lookup in the de keyboard mapping table for the character '/' and should find the scancodes for the keys shift+'7'.
The Scancodes for shift and '7' are send to the VM's emulated keyboard controller and the '/' appears in the VM.

But what actually happens is that the '7' character shows up in the VM. It seems that QEMU misses to also generate the Shift Scancode.

Is this a general problem in the VNC server implementation?
So that an interpretation (http://tools.ietf.org/html/rfc6143#section-7.5.4)
of the received keysymbols to add eg an additional shift keypress never happens?

If yes would a QEMU patch that adds keysymbol interpretation have a chance to be merged in the upstream version?
Or are there reasons that it isn't a good idea to interpret the keysymbols for the scancode conversion?

regards

Fabian

#1 lore raw

Hello Fabian,

Quoted 2 lines · On Wednesday 07 March 2012 11:53:57 Fabian Holler wrote:

I'm not sure if I found a bug in QEMU's VNC keyboard layout mapping or if it's a general problem in the implemented VNC server:

Daniel P. Berrangé has written some very good blog entries about the VNC problem:
<http://berrange.com/posts/2010/07/04/more-than-you-or-i-ever-wanted-to-know-about-virtual-keyboard-handling/>
They're quiet technical, but after reading them I at least concluded that VNC is normally just broken.
I recommend using virt-viewer, with which I have mostly no such problems.

Sincerely
Philipp

Signature · 4 lines
Philipp Hahn           Open Source Software Engineer      [email protected]
Univention GmbH        Linux for Your Business        fon: +49 421 22 232- 0
Mary-Somerville-Str.1  D-28359 Bremen                 fax: +49 421 22 232-99
                                                   http://www.univention.de/
#2 lore raw

Hello Philipp,

thanks for your answer.

Quoted 9 lines · Philipp Hahn
Quoted 2 lines · On Wednesday 07 March 2012 11:53:57 Fabian Holler wrote:

I'm not sure if I found a bug in QEMU's VNC keyboard layout mapping or if it's a general problem in the implemented VNC server:

Daniel P. Berrangé has written some very good blog entries about the VNC problem:
<http://berrange.com/posts/2010/07/04/more-than-you-or-i-ever-wanted-to-know-about-virtual-keyboard-handling/>
They're quiet technical, but after reading them I at least concluded that VNC is normally just broken.

I already discovered Berrangès articles, helped me very lot to understand the problem.

Quoted 1 line

I recommend using virt-viewer, with which I have mostly no such problems.

Ah, never heard of it, it seems also be gtk-vnc based.
I already tried gtk-vnc and it works but we need a Web based solution for our customers.
I found Java VNC (http://www.jdams.org/java-vnc), which also sends the QEMU extended key event messages (based on TigerVNC). But in the JVM is the same old problem that the scan code/key code isn't known.

So our current plan is to let the customer choose his
local keyboard layout in the applet and recover the key code for the key symbol (+ add/remove if needed metakey events like shift) on the client.

Similar like QEMU's "-k" option, but on the client-side + interpretation. We will only can support a limited number of keyboard layouts but changing the layout without restarting QEMU will be possible. :-)

regards

Fabian

#3 lore raw
In reply to Fabian Holler
Quoted 10 lines · Fabian Holler

Hello,

I'm not sure if I found a bug in QEMU's VNC keyboard layout mapping or if it's a general problem in the implemented VNC server:

Scenario:
QEMU started with: "-k de"
Keyboard layout in VM: de
Keyboard layout from Client OS: us

Quoted 6 lines

What i expect:
I type the '/' character on the Client OS (key left from the right-shift-key) on US layout. Keysymbol '/' is send over VNC to the QEMU.
QEMU lookup in the de keyboard mapping table for the character '/' and should find the scancodes for the keys shift+'7'.
The Scancodes for shift and '7'

This does not exist. There is no such thing as "Scancodes for shift and '7'".

Instead, what's sent to the Client OS is literally, "the key at the fourth column, second row".

The sticker that is on that key is unknown to the physical keyboard. When you select a keyboard type in an OS, you're literally telling the OS what labels are on the physical keyboard.

Yes, it's almost mind blowing that in 2012, keyboards don't tell you what the labels on the keys are... but they don't.

When you tell QEMU to use '-k de', what you're telling it is to figure out what the right key is on a de keyboard for the label '/' which may be "the key at the second 8th column, second row" on a de keyboard, but on a US keyboard, it's a 7.

There's really nothing that can be done about this. The way gtk-vnc fixes this is by obtaining the actual scancode from the user's keyboard. But you can't get this in Java in an applet AFAIK.

Regards,

Anthony Liguori

are send to the VM's emulated keyboard

Quoted 20 lines

controller and the '/' appears in the VM.

But what actually happens is that the '7' character shows up in the VM. It seems that QEMU misses to also generate the Shift Scancode.

Is this a general problem in the VNC server implementation?
So that an interpretation (http://tools.ietf.org/html/rfc6143#section-7.5.4)
of the received keysymbols to add eg an additional shift keypress never happens?

If yes would a QEMU patch that adds keysymbol interpretation have a chance to be merged in the upstream version?
Or are there reasons that it isn't a good idea to interpret the keysymbols for the scancode conversion?

regards

Fabian

#4 lore raw

Hello Anthony,

Quoted 18 lines · Anthony Liguori
Quoted 10 lines · Fabian Holler

Hello,

I'm not sure if I found a bug in QEMU's VNC keyboard layout mapping or if it's a general problem in the implemented VNC server:

Scenario:
QEMU started with: "-k de"
Keyboard layout in VM: de
Keyboard layout from Client OS: us

Quoted 6 lines

What i expect:
I type the '/' character on the Client OS (key left from the right-shift-key) on US layout. Keysymbol '/' is send over VNC to the QEMU.
QEMU lookup in the de keyboard mapping table for the character '/' and should find the scancodes for the keys shift+'7'.
The Scancodes for shift and '7'

Quoted 4 lines

This does not exist. There is no such thing as "Scancodes for shift and '7'".

Instead, what's sent to the Client OS is literally, "the key at the fourth column, second row".

Yes, I know.
What i actually meant was: with the knowledge of the used keyboard layout and the key symbol QEMU could figure out that it has to send scan codes for the keys that are labeled SHIFT & 7 on a keyboard with DE layout.
Afaik QEMU does this already for the 7 labeled key. But it doesn't remove/adds additional needed metakey presses like eg Shift. Or I'm wrong?

The idea was to add these interpretation to also add/remove additional metakey scancodes for the VM if needed.

Quoted 3 lines

There's really nothing that can be done about this. The way gtk-vnc fixes this is by obtaining the actual scancode from the user's keyboard. But you can't get this in Java in an applet AFAIK.

The same should work in a Java Applet but you also have to figure out the used keyboard layout and handle metakeys.

regards

Fabian

#5 lore raw
Quoted 17 lines · Fabian Holler

Hello Anthony,

Quoted 13 lines · Anthony Liguori
Quoted 12 lines · Fabian Holler

Hello,

I'm not sure if I found a bug in QEMU's VNC keyboard layout mapping or if it's a general problem in the implemented VNC server:

Scenario:
QEMU started with: "-k de"
Keyboard layout in VM: de
Keyboard layout from Client OS: us

What i expect:
I type the '/' character on the Client OS (key left from the

right-shift-key) on US layout.

Quoted 6 lines
Quoted 6 lines
Quoted 4 lines

Keysymbol '/' is send over VNC to the QEMU.
QEMU lookup in the de keyboard mapping table for the character '/' and should find the scancodes for the keys shift+'7'.
The Scancodes for shift and '7'

This does not exist. There is no such thing as "Scancodes for shift

and '7'".

Quoted 20 lines
Quoted 3 lines

Instead, what's sent to the Client OS is literally, "the key at the fourth column, second row".

Yes, I know.
What i actually meant was: with the knowledge of the used keyboard layout and the key symbol QEMU could figure out that it has to send scan codes for the keys that are labeled SHIFT & 7 on a keyboard with DE layout.
Afaik QEMU does this already for the 7 labeled key. But it doesn't remove/adds additional needed metakey presses like eg Shift. Or I'm wrong?

The idea was to add these interpretation to also add/remove additional metakey scancodes for the VM if needed.

Quoted 3 lines

There's really nothing that can be done about this. The way gtk-vnc fixes this is by obtaining the actual scancode from the user's keyboard. But you can't get this in Java in an applet AFAIK.

Quoted 8 lines

The same should work in a Java Applet but you also have to figure out the used keyboard layout and handle metakeys.

regards

Fabian

Hi all,

I'm experiencing the same issues.

When using the QEMU VNC server (which I would prefer to Remote Desktop or a VNC server installed on the guest) I get problems when pressing special character keys on the remote keyboard. QEMU reports on the console:
Warning: no scancode found for keysym 180
or
Warning: no scancode found for keysym 223

I just want to route all keypresses to the guest without interfering with the native QEMU key layout. Is that possible? When running QEMU via SDL and a real monitor and keyboard attached, I have no problems with the different keyboard language layouts (I tested US, DE, ES, FR). Well - there I switch the keyboard language layout in Windows for having all keypresses handled correctly (in most cases, Windows detects the correct keyboard layout automatically), but there is no change needed in the QEMU command line when having different hardware attached!

Any ideas how to resolve that? How does the QEMU VNC server receive the key presses? In the same manner as the direct way does by getting scancodes or via "real" characters?
My requirement for the VNC usage is, that all clients that connect via VNC can work independently of their client keyboard layout. The manual switch in Windows for getting the proper key translation is fine for the clients that use VNC.

Best regards,

Erik

#6 lore raw
Quoted 2 lines · Erik Rull

On March 8, 2012 at 11:01 PM Fabian Holler

<[email protected]>

Quoted 10 lines
Quoted 8 lines · wrote:

Hello Anthony,

Quoted 4 lines · Anthony Liguori
Quoted 3 lines · Fabian Holler

Hello,

I'm not sure if I found a bug in QEMU's VNC keyboard layout mapping

or

Quoted 12 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

if it's a general problem in the implemented VNC server:

Scenario:
QEMU started with: "-k de"
Keyboard layout in VM: de
Keyboard layout from Client OS: us

What i expect:
I type the '/' character on the Client OS (key left from the

right-shift-key) on US layout.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Keysymbol '/' is send over VNC to the QEMU.
QEMU lookup in the de keyboard mapping table for the character '/'

and

Quoted 35 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

should find the scancodes for the keys shift+'7'.
The Scancodes for shift and '7'

This does not exist. There is no such thing as "Scancodes for shift

and '7'".

Quoted 20 lines
Quoted 3 lines

Instead, what's sent to the Client OS is literally, "the key at the fourth column, second row".

Yes, I know.
What i actually meant was: with the knowledge of the used keyboard layout and the key symbol QEMU could figure out that it has to send scan codes for the keys that are labeled SHIFT & 7 on a keyboard with DE layout.
Afaik QEMU does this already for the 7 labeled key. But it doesn't remove/adds additional needed metakey presses like eg Shift. Or I'm wrong?

The idea was to add these interpretation to also add/remove additional metakey scancodes for the VM if needed.

Quoted 3 lines

There's really nothing that can be done about this. The way gtk-vnc fixes this is by obtaining the actual scancode from the user's keyboard. But you can't get this in Java in an applet AFAIK.

Quoted 8 lines

The same should work in a Java Applet but you also have to figure out the used keyboard layout and handle metakeys.

regards

Fabian

Quoted 5 lines

Hi all,

I'm experiencing the same issues.

When using the QEMU VNC server (which I would prefer to Remote Desktop or

a

Quoted 8 lines

VNC server installed on the guest) I get problems when pressing special character keys on the remote keyboard. QEMU reports on the console:
Warning: no scancode found for keysym 180
or
Warning: no scancode found for keysym 223

I just want to route all keypresses to the guest without interfering with the native QEMU key layout. Is that possible? When running QEMU via SDL

and

Quoted 1 line

a real monitor and keyboard attached, I have no problems with the

different

Quoted 1 line

keyboard language layouts (I tested US, DE, ES, FR). Well - there I

switch

Quoted 3 lines

the keyboard language layout in Windows for having all keypresses handled correctly (in most cases, Windows detects the correct keyboard layout automatically), but there is no change needed in the QEMU command line

when

Quoted 3 lines

having different hardware attached!

Any ideas how to resolve that? How does the QEMU VNC server receive the

key

Quoted 1 line

presses? In the same manner as the direct way does by getting scancodes

or

Quoted 2 lines

via "real" characters?
My requirement for the VNC usage is, that all clients that connect via

VNC

Quoted 8 lines

can work independently of their client keyboard layout. The manual switch in Windows for getting the proper key translation is fine for the clients that use VNC.

Best regards,

Erik

Just a small addition: The AltGr Keys are not routed correctly through VNC! I had a look at the "de" keymap, it looks as if they are described (e.g. backslash \) which is placed on the german keyboard on the key right to the 0 key (german key ssharp) and accessed via AltGr + this key. Same with } which is at the 0 key position accessed via AltGr + 0. The shifted keys and the Windows standard functions Ctrl + C / Ctrl + V works as well. They are not lost completely but the AltGr press gets lost! So when pressing AltGr + 0, I get only a 0 on the guest instead of a "}".

Any ideas?

Best regards,

Erik