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

Re: [libvirt] [PATCH 12/13] qemu, send-key: map linux keycode to xt keycode



On Wed, May 25, 2011 at 05:37:54PM +0800, Lai Jiangshan wrote:
> It allows us use linux keycode for qemu driver.
> 
> Signed-off-by: Lai Jiangshan <laijs fujitsu com>
> ---
>  src/qemu/qemu_monitor.c |   49 ++++++++++++++++++++++++++++++++++++++++++++++-
>  1 files changed, 48 insertions(+), 1 deletions(-)
> 
> diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
> index c0688fd..f6cdff1 100644
> --- a/src/qemu/qemu_monitor.c
> +++ b/src/qemu/qemu_monitor.c
> @@ -2296,6 +2296,41 @@ int qemuMonitorInjectNMI(qemuMonitorPtr mon)
>      return ret;
>  }
>  
> +unsigned int linux2xt_keycode[256] = {
> +    /* 00: */ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
> +    /* 08: */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
> +    /* 10: */ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
> +    /* 18: */ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
> +    /* 20: */ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
> +    /* 28: */ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
> +    /* 30: */ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
> +    /* 38: */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
> +    /* 40: */ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
> +    /* 48: */ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x00, 0x4f,
> +    /* 50: */ 0x50, 0x51, 0x52, 0x00, 0x00, 0x00, 0x00, 0x57,
> +    /* 58: */ 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> +    /* 60: */ 0x00, 0x9d, 0xb5, 0x54, 0xb8, 0x00, 0xc7, 0xc8,
> +    /* 68: */ 0xc9, 0xcb, 0xcd, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3,
> +    /* 70: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> +    /* 78: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> +    /* 80: */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
> +    /* 88: */ 0xf8, 0xf9, 0xfb, 0xdd, 0x00, 0x00, 0x00, 0x00,
> +    /* 90: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> +    /* 98: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> +    /* a0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> +    /* a8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> +    /* b0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> +    /* b8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> +    /* c0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> +    /* c8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> +    /* d0: */ 0x00, 0x00, 0xb7, 0x00, 0x00, 0x00, 0x00, 0x00,
> +    /* d8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> +    /* e0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> +    /* e8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> +    /* f0: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> +    /* f8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> +};

See my comment in the previous patch. This table can be
automatically generated by my  keymap-gen.pl script
during build, so we don't need to manually have this
table of wierd magic numbers.

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]