[libvirt] [PATCH 00/13] Add support for send keys to guest

Lai Jiangshan laijs at cn.fujitsu.com
Wed May 25 09:37:42 UTC 2011


Add API virDomainSendKey() and virsh send-key command.

# virsh help send-key
  NAME
    send-key - Send keycodes to the guest

  SYNOPSIS
    send-key <domain> [--codeset <string>] [--holdtime <number>] <keycode>...

  DESCRIPTION
    Send keycodes to the guest, the keycodes must be integers
    or the qemu-style key strings for the "xt:keystring" codeset
    or the KEY_* strings listed below for the "linux" codeset.

    Available codeset:
        linux          the keycodes specified in 
                        /usr/include/linux/input.h(default)
        default        linux codeset will be used
        driver_default the hypervisor default codeset will be used
        xt             XT(set1) scancode of standard AT keyboards and PS/2 keyboards
        atset1         set1 scancode of standard AT keyboards and PS/2 keyboards
        atset2         set2 scancode of standard AT keyboards and PS/2 keyboards
        atset3         set3 scancode of standard AT keyboards and PS/2 keyboards
        xt:keystring   XT scancode, but <keycode>... must be the qemu-style key strings

    Examples:

        virsh # send-key <domain> 37 18 21
        virsh # send-key <domain> --holdtime 1000 0x15 18 0xf
        virsh # send-key <domain> KEY_LEFTCTRL KEY_LEFTALT KEY_F1
        virsh # send-key <domain> --codeset xt:keystring alt-sysrq h

    KEY_XXX strings for the "linux" codeset:
.
.
.
  OPTIONS
    [--domain] <string>  domain name, id or uuid
    --codeset <string>  the codeset of keycodes, default:linux
    --holdtime <number>  the time (in millsecond) how long the keys will be held
    <keycode>        the key code


PATCH 01~04 prepare
PATCH 05~10 Add support for send keys to guest
PATCH 11~13 improve usage of send keys.

Python version of virDomainSendKey() has not been implemented yet,
it will be done soon.

Lai Jiangshan (13):
  allow name for VSH_OT_ARGV options
  improve the iteration of VSH_OT_ARGV options
  add VSH_OFLAG_REQ_OPT options
  remote_generator: support general dynamic array
  send-key: Defining the public API
  send-key: Defining the internal API
  send-key: Implementing the public API
  send-key: Implementing the remote protocol
  send-key: Expose the new API in virsh
  qemu:send-key: Implement the driver methods
  send-key: support KEY_XXX names for the linux keycode
  qemu,send-key: map linux keycode to xt keycode
  virsh,send-key: add --codeset xt:keystring support

 daemon/remote_generator.pl   |   18 ++
 include/libvirt/libvirt.h.in |    7 +
 include/libvirt/virtkeys.h   |  276 ++++++++++++++++++++++++++++
 python/generator.py          |    1 +
 src/driver.h                 |    8 +
 src/libvirt.c                |   54 ++++++
 src/libvirt_public.syms      |    1 +
 src/qemu/qemu_driver.c       |   50 +++++
 src/qemu/qemu_monitor.c      |   75 ++++++++
 src/qemu/qemu_monitor.h      |    6 +
 src/qemu/qemu_monitor_json.c |   15 ++
 src/qemu/qemu_monitor_json.h |    5 +
 src/qemu/qemu_monitor_text.c |   48 +++++
 src/qemu/qemu_monitor_text.h |    5 +
 src/remote/remote_driver.c   |    1 +
 src/remote/remote_protocol.x |   19 ++-
 src/remote_protocol-structs  |   11 +
 tools/virsh.c                |  415 +++++++++++++++++++++++++++++++++++++++---
 tools/virsh.pod              |    4 +
 19 files changed, 989 insertions(+), 30 deletions(-)
 create mode 100644 include/libvirt/virtkeys.h

-- 
1.7.4.4




More information about the libvir-list mailing list