On Tue, Jun 07, 2011 at 05:11:12PM +0800, Lai Jiangshan wrote:
Add public virDomainSendKey() and enum libvirt_keycode_set
for the @codeset.
Python version of virDomainSendKey() has not been implemented yet,
it will be done soon.
Signed-off-by: Lai Jiangshan <laijs(a)cn.fujitsu.com>
---
include/libvirt/libvirt.h.in | 7 +++++++
include/libvirt/virtkeys.h | 22 ++++++++++++++++++++++
python/generator.py | 1 +
src/libvirt_public.syms | 5 +++++
4 files changed, 35 insertions(+), 0 deletions(-)
create mode 100644 include/libvirt/virtkeys.h
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index df213f1..94da205 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -2673,6 +2673,13 @@ typedef struct _virTypedParameter virMemoryParameter;
*/
typedef virMemoryParameter *virMemoryParameterPtr;
+int virDomainSendKey(virDomainPtr domain,
+ unsigned int codeset,
+ unsigned int holdtime,
+ unsigned int *keycodes,
+ unsigned int nkeycodes,
+ unsigned int flags);
+
#ifdef __cplusplus
}
#endif
diff --git a/include/libvirt/virtkeys.h b/include/libvirt/virtkeys.h
new file mode 100644
index 0000000..854594a
--- /dev/null
+++ b/include/libvirt/virtkeys.h
@@ -0,0 +1,22 @@
+#ifndef _LIBVIRT_VIRTKEYS_H
+#define _LIBVIRT_VIRTKEYS_H
+
+/*
+ * Copyright (c) 2011 Lai Jiangshan
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ */
+
+enum libvirt_keycode_set {
+ LIBVIRT_KEYCODE_LINUX = 0,
+ LIBVIRT_KEYCODE_XT = 1,
+ LIBVIRT_KEYCODE_ATSET1 = 2,
+ LIBVIRT_KEYCODE_ATSET2 = 3,
+ LIBVIRT_KEYCODE_ATSET3 = 4,
+};
+
+#define MAX_SEND_KEY 16
+
+#endif
I think this enum + #define should be in the main libvirt.h
header file, alongside the virDomainSendKey API definition.
Keep the separate 'virtkeys.h' file to be used only for the
large list of keycode names.
Also, using 'libvirt_' or LIBVIRT_ isn't our normal namespace,
and enums use capital letters for separation, rather than
underscores. Any enum should have a typedef, and finally the
constant should have a VIR_DOMAIN prefix
So should be more like
typedef enum {
VIR_KEYCODE_LINUX = 0,
...
} virKeycodeSet;
#define VIR_DOMAIN_SEND_KEY_MAX_KEYS 16
diff --git a/python/generator.py b/python/generator.py
index 7c38fdd..57373f0 100755
--- a/python/generator.py
+++ b/python/generator.py
@@ -356,6 +356,7 @@ skip_impl = (
'virNodeDeviceListCaps',
'virConnectBaselineCPU',
'virDomainRevertToSnapshot',
+ 'virDomainSendKey',
)
diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
index 4d4299a..ddfed44 100644
--- a/src/libvirt_public.syms
+++ b/src/libvirt_public.syms
@@ -450,4 +450,9 @@ LIBVIRT_0.9.2 {
virInterfaceChangeRollback;
} LIBVIRT_0.9.0;
+LIBVIRT_0.9.3 {
+ global:
+ virDomainSendKey;
+} LIBVIRT_0.9.2;
+
# .... define new API here using predicted next version number ....
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 :|