[Spice-devel] SPICE_INTERFACE_KEYBOARD - scancodes vs. utf8

Dietmar Maurer dietmar at proxmox.com
Tue Aug 6 08:42:29 PDT 2013


> > Having utf8 input was discussed a few weeks ago, it is needed for html
> > and android clients for ex.
> 
> Note that this is a completely different problem.
> 
> When running a virtual machine you need the scancodes, so you can feed the
> guest with the correct virtual keystrokes.  Translating those keystrokes into
> characters is the job of the guest operating system.
> There is no meaningful way to pass a utf-8 character stream into a virtual
> machine.
> 
> So a spice client must somehow figure how to translate the input it gets into
> scancodes.  And IMO this should best be done on the client side so the client can
> use all information it has to do it.  For gtk this is easy as the key events carry not
> only the character but the keycode too.
>  For android/html5 clients this is alot trickier ...

AFAIK, neither java nor javascript have access to scancodes. If you solve the problem
on the server side (spice server library), you need to solve it only once. Else you need
to implement that clumsy code on each client.

If I remember correctly, qemu already has some code to convert VNC input to
scancodes? 

> But, when the server side wants a utf8 stream this is a completely different
> issue.  Maybe the easiest is to send the utf8 stream over a
> SpiceCharDeviceInterface (if present).

Sorry, I am quite new to spice - please can you elaborate a bit more? I can see how 
to create a SpiceCharDeviceInterface at server side, but AFAIK that is used for other things?



More information about the Spice-devel mailing list