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

Re: [libvirt] problem of escaped scancodes



On Thu, Aug 25, 2011 at 10:25:57AM +0900, KAMEZAWA Hiroyuki wrote:
> On Tue, 23 Aug 2011 14:54:11 +0100
> "Daniel P. Berrange" <berrange redhat com> wrote:
>  
> > No, we just need to switch to use the correct scancode set.
> > 
> > The original keymap-gen.pl script in GTK-VNC has code for auto-generating
> > the RFB scancode set, from the data for the XT KBD scancode set. It is a
> > straighforward re-encoding for the extended keys:
> > 
> >     # RFB keycodes are XT kbd keycodes with a slightly
> >     # different encoding of 0xe0 scan codes. RFB uses
> >     # the high bit of the first byte, instead of the low
> >     # bit of the second byte.
> >     rfbkey = (xtkbdkey & 0x100) >> 1 | (ktkbdkey & 0x7f)
> > 
> like this ?
> 
> ==
> From 7ea5214b7832acbb7bae81d7d8ceeaa19890e32b Mon Sep 17 00:00:00 2001
> From: KAMEZAWA Hiroyuki <kamezawa hiroyu jp fujitsu com>
> Date: Thu, 25 Aug 2011 10:29:57 +0900
> Subject: [PATCH] fix to adjust xt_kbd scancode
> 
> The keycode in http://git.gnome.org/browse/gtk-vnc/plain/src/keymaps.csv
> handles escaped scancode in different way from qemu's one.
> 
> all escaped scancode "e0 ??" are encoded as "0x100 | ??" in this csv.
> But qemu handles escaped scancode as "0x80 | ??" and this scancode
> is more common.
> ---
>  src/util/virkeycode-mapgen.py |   14 +++++++++++++-
>  1 files changed, 13 insertions(+), 1 deletions(-)
> 
> diff --git a/src/util/virkeycode-mapgen.py b/src/util/virkeycode-mapgen.py
> index acf7364..5d83a39 100755
> --- a/src/util/virkeycode-mapgen.py
> +++ b/src/util/virkeycode-mapgen.py
> @@ -14,6 +14,7 @@ import sys
>  import re
>  
>  namecolums = (0,2,10)
> +xtkbdkey_index = 8
>  
>  def quotestring(str):
>      if str[0] != '"':
> @@ -38,7 +39,18 @@ for line in sys.stdin.xreadlines():
>      for i in namecolums:
>          b = b + (a[i] and quotestring(a[i]) or 'NULL') + ','
>      for i in [ x for x in range(12) if not x in namecolums ]:
> -        b = b + (a[i] or '0') + ','
> +        if i != xtkbdkey_index :
> +            b = b + (a[i] or '0') + ','
> +        elif a[i] == '' :
> +            b = b + '0' + ','
> +        else :
> +            # RFB keycodes are XT kbd keycodes with a slightly
> +            # different encoding of 0xe0 scan codes. RFB uses
> +            # the high bit of the first byte, instead of the low
> +            # bit of the second byte.
> +            code = int(a[i])
> +            code = (code & 0x100) >> 1 | (code & 0x7f)
> +            b = b + str(code) + ','
>      print "    { " + b + "},"
>  
>  print '};'

This is not quite right. We don't want to change the XT KBD codeset
since that's defined that way by the Linux driver. We instead want
to add a new RFB codeset and make the QEMU driver use that. Check
out this patch

https://www.redhat.com/archives/libvir-list/2011-August/msg01256.html

In my tests it made  'virsh send-key f16x86_64 KEY_RIGHTCTRL KEY_C'
work correctly

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


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