Skip to contentSkip to conversation

libxl: create standalone vkb device

PATCH In review Oleksandr Grytsov 2 participants 10 messages Jul 17, 2018 – Jul 25, 2018

lore
Share & tools
lore
#0 lore raw

v3 cover libxl: create standalone vkb device

From: Oleksandr Grytsov <[email protected]>

Changes since v2:

* fix indentation in libxl__device_vkb_dm_needed
* add LIBXL_HAVE_EXTENDED_VKB define to indicates that libxl__device_vkb has extended fields

Oleksandr Grytsov (7):
libxl: move vkb device to libxl_vkb.c
libxl: add backend type and id to vkb
libxl: vkb add list and info functions
xl: add vkb config parser and CLI
docs: add vkb device to xl.cfg and xl
libxl: vkb add extended parameters
libxl: add LIBXL_HAVE_EXTENDED_VKB define

 docs/man/xl.cfg.pod.5.in    |  64 +++++++
 docs/man/xl.pod.1.in        |  22 +++
 tools/libxl/Makefile        |   2 +-
 tools/libxl/libxl.h         |  26 +++
 tools/libxl/libxl_console.c |  53 ------
 tools/libxl/libxl_create.c  |   3 +
 tools/libxl/libxl_dm.c      |   1 +
 tools/libxl/libxl_types.idl |  29 +++
 tools/libxl/libxl_utils.h   |   3 +
 tools/libxl/libxl_vkb.c     | 342 ++++++++++++++++++++++++++++++++++++
 tools/xl/Makefile           |   2 +-
 tools/xl/xl.h               |   3 +
 tools/xl/xl_cmdtable.c      |  16 ++
 tools/xl/xl_parse.c         | 109 +++++++++++-
 tools/xl/xl_parse.h         |   1 +
 tools/xl/xl_vkb.c           | 161 +++++++++++++++++
 16 files changed, 781 insertions(+), 56 deletions(-)
 create mode 100644 tools/libxl/libxl_vkb.c
 create mode 100644 tools/xl/xl_vkb.c
Signature · 7 lines
2.17.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw

PATCH v3 1/7 libxl: move vkb device to libxl_vkb.c

From: Oleksandr Grytsov <[email protected]>

Logically it is better to move vkb to separate file as vkb device used not only by vfb and console.

---
 tools/libxl/Makefile        |  2 +-
 tools/libxl/libxl_console.c | 53 ---------------------------------
 tools/libxl/libxl_vkb.c     | 59 +++++++++++++++++++++++++++++++++++++
 3 files changed, 60 insertions(+), 54 deletions(-)
 create mode 100644 tools/libxl/libxl_vkb.c
tools/libxl/Makefile +1 -1
index 684db995ca..6da342ed61 100644
@@ -140,7 +140,7 @@ LIBXL_OBJS = flexarray.o libxl.o libxl_create.o libxl_dm.o libxl_pci.o \
 			libxl_vtpm.o libxl_nic.o libxl_disk.o libxl_console.o \
 			libxl_cpupool.o libxl_mem.o libxl_sched.o libxl_tmem.o \
 			libxl_9pfs.o libxl_domain.o libxl_vdispl.o \
-			libxl_pvcalls.o libxl_vsnd.o $(LIBXL_OBJS-y)
+			libxl_pvcalls.o libxl_vsnd.o libxl_vkb.o $(LIBXL_OBJS-y)
 LIBXL_OBJS += libxl_genid.o
 LIBXL_OBJS += _libxl_types.o libxl_flask.o _libxl_types_internal.o
 
tools/libxl/libxl_console.c +0 -53

71 lines not on this page · raw message

tools/libxl/libxl_vkb.c new file +59 -0

59 lines not on this page · raw message

Signature · 7 lines
2.17.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#2 lore raw

PATCH v3 2/7 libxl: add backend type and id to vkb

In reply to Oleksandr Grytsov

From: Oleksandr Grytsov <[email protected]>

New field backend_type is added to vkb device in order to have QEMU and user space backend simultaneously. Each vkb backend shall read appropriate XS entry and service only own frontends. Id is a string field which used by the backend to indentify the frontend.

---
 tools/libxl/libxl_create.c  |  3 +++
 tools/libxl/libxl_dm.c      |  1 +
 tools/libxl/libxl_types.idl |  8 ++++++++
 tools/libxl/libxl_vkb.c     | 31 ++++++++++++++++++++++++++++++-
 4 files changed, 42 insertions(+), 1 deletion(-)
tools/libxl/libxl_create.c +3 -0
index 7d46824eac..1ccb3e35d3 100644
@@ -1421,6 +1421,9 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev,
         for (i = 0; i < d_config->num_vfbs; i++) {
             libxl__device_add(gc, domid, &libxl__vfb_devtype,
                               &d_config->vfbs[i]);
+        }
+
+        for (i = 0; i < d_config->num_vkbs; i++) {
             libxl__device_add(gc, domid, &libxl__vkb_devtype,
                               &d_config->vkbs[i]);
         }
tools/libxl/libxl_dm.c +1 -0
index bd187463ec..fdd7fa3ba4 100644
@@ -1790,6 +1790,7 @@ static int libxl__vfb_and_vkb_from_hvm_guest_config(libxl__gc *gc,
 
     vkb->backend_domid = 0;
     vkb->devid = 0;
+
     return 0;
 }
 
tools/libxl/libxl_types.idl +8 -0
index f1e50a0c0c..c01cf06035 100644
@@ -247,6 +247,12 @@ libxl_vuart_type = Enumeration("vuart_type", [
     (1, "sbsa_uart"),
     ])
 
+libxl_vkb_backend = Enumeration("vkb_backend", [
+    (0, "UNKNOWN"),
+    (1, "QEMU"),
+    (2, "LINUX")
+    ])
+
 #
 # Complex libxl types
 #
@@ -626,6 +632,8 @@ libxl_device_vkb = Struct("device_vkb", [
     ("backend_domid", libxl_domid),
     ("backend_domname", string),
     ("devid", libxl_devid),
+    ("backend_type", libxl_vkb_backend),
+    ("unique_id", string)
     ])
 
 libxl_device_disk = Struct("device_disk", [
tools/libxl/libxl_vkb.c +30 -1
index 7652ad23ce..e271edc23f 100644
@@ -14,12 +14,38 @@
 
 #include "libxl_internal.h"
 
+#include <xen/io/kbdif.h>
+
 static int libxl__device_vkb_setdefault(libxl__gc *gc, uint32_t domid,
                                         libxl_device_vkb *vkb, bool hotplug)
 {
+    if (vkb->backend_type == LIBXL_VKB_BACKEND_UNKNOWN) {
+        vkb->backend_type = LIBXL_VKB_BACKEND_QEMU;
+    }
+
     return libxl__resolve_domid(gc, vkb->backend_domname, &vkb->backend_domid);
 }
 
+static int libxl__device_vkb_dm_needed(libxl_device_vkb *vkb, uint32_t domid)
+{
+    return vkb->backend_type == LIBXL_VKB_BACKEND_QEMU;
+}
+
+static int libxl__set_xenstore_vkb(libxl__gc *gc, uint32_t domid,
+                                   libxl_device_vkb *vkb,
+                                   flexarray_t *back, flexarray_t *front,
+                                   flexarray_t *ro_front)
+{
+    flexarray_append_pair(back, "backend-type",
+                          (char *)libxl_vkb_backend_to_string(vkb->backend_type));
+
+    if (vkb->unique_id) {
+        flexarray_append_pair(back, XENKBD_FIELD_UNIQUE_ID, vkb->unique_id);
+    }
+
+    return 0;
+}
+
 int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb,
                          const libxl_asyncop_how *ao_how)
 {
@@ -47,7 +73,10 @@ static LIBXL_DEFINE_UPDATE_DEVID(vkb)
 LIBXL_DEFINE_DEVICE_REMOVE(vkb)
 
 DEFINE_DEVICE_TYPE_STRUCT(vkb, VKBD,
-    .skip_attach = 1
+    .skip_attach = 1,
+    .dm_needed = (device_dm_needed_fn_t)libxl__device_vkb_dm_needed,
+    .set_xenstore_config = (device_set_xenstore_config_fn_t)
+                           libxl__set_xenstore_vkb
 );
 
 /*
Signature · 7 lines
2.17.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#4 lore raw

PATCH v3 3/7 libxl: vkb add list and info functions

In reply to Oleksandr Grytsov

From: Oleksandr Grytsov <[email protected]>

---
 tools/libxl/libxl.h         |  10 +++
 tools/libxl/libxl_types.idl |  11 ++++
 tools/libxl/libxl_utils.h   |   3 +
 tools/libxl/libxl_vkb.c     | 127 +++++++++++++++++++++++++++++++++++-
 4 files changed, 149 insertions(+), 2 deletions(-)
tools/libxl/libxl.h +10 -0
index bfc788594c..919f660c51 100644
@@ -2037,6 +2037,16 @@ int libxl_device_vkb_destroy(libxl_ctx *ctx, uint32_t domid,
                              const libxl_asyncop_how *ao_how)
                             LIBXL_EXTERNAL_CALLERS_ONLY;
 
+libxl_device_vkb *libxl_device_vkb_list(libxl_ctx *ctx,
+                                        uint32_t domid, int *num)
+                                        LIBXL_EXTERNAL_CALLERS_ONLY;
+void libxl_device_vkb_list_free(libxl_device_vkb* list, int num)
+                                LIBXL_EXTERNAL_CALLERS_ONLY;
+int libxl_device_vkb_getinfo(libxl_ctx *ctx, uint32_t domid,
+                             libxl_device_vkb *vkb,
+                             libxl_vkbinfo *vkbinfo)
+                             LIBXL_EXTERNAL_CALLERS_ONLY;
+
 /* Framebuffer */
 int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb,
                          const libxl_asyncop_how *ao_how)
tools/libxl/libxl_types.idl +11 -0
index c01cf06035..4b4dc9eb5d 100644
@@ -1046,6 +1046,17 @@ libxl_vsndinfo = Struct("vsndinfo", [
     ("pcms", Array(libxl_pcminfo, "num_vsnd_pcms"))
     ])
 
+libxl_vkbinfo = Struct("vkbinfo", [
+    ("backend", string),
+    ("backend_id", uint32),
+    ("frontend", string),
+    ("frontend_id", uint32),
+    ("devid", libxl_devid),
+    ("state", integer),
+    ("evtch", integer),
+    ("rref", integer)
+    ], dir=DIR_OUT)
+
 # NUMA node characteristics: size and free are how much memory it has, and how
 # much of it is free, respectively. dists is an array of distances from this
 # node to each other node.
tools/libxl/libxl_utils.h +3 -0
index 5455752c6e..44409afdc4 100644
@@ -79,6 +79,9 @@ int libxl_devid_to_device_vtpm(libxl_ctx *ctx, uint32_t domid,
 int libxl_devid_to_device_usbctrl(libxl_ctx *ctx, uint32_t domid,
                                   int devid, libxl_device_usbctrl *usbctrl);
 
+int libxl_devid_to_device_vkb(libxl_ctx *ctx, uint32_t domid,
+                              int devid, libxl_device_vkb *vkb);
+
 int libxl_devid_to_device_vdispl(libxl_ctx *ctx, uint32_t domid,
                                  int devid, libxl_device_vdispl *vdispl);
 
tools/libxl/libxl_vkb.c +125 -2

151 lines not on this page · raw message

Signature · 7 lines
2.17.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#5 lore raw

PATCH v3 4/7 xl: add vkb config parser and CLI

In reply to Oleksandr Grytsov

From: Oleksandr Grytsov <[email protected]>

---
 tools/xl/Makefile      |   2 +-
 tools/xl/xl.h          |   3 +
 tools/xl/xl_cmdtable.c |  16 +++++
 tools/xl/xl_parse.c    |  76 ++++++++++++++++++++-
 tools/xl/xl_parse.h    |   1 +
 tools/xl/xl_vkb.c      | 147 +++++++++++++++++++++++++++++++++++++++++
 6 files changed, 243 insertions(+), 2 deletions(-)
 create mode 100644 tools/xl/xl_vkb.c
tools/xl/Makefile +1 -1
index 66bdbdef13..2769295515 100644
@@ -22,7 +22,7 @@ XL_OBJS += xl_vtpm.o xl_block.o xl_nic.o xl_usb.o
 XL_OBJS += xl_sched.o xl_pci.o xl_vcpu.o xl_cdrom.o xl_mem.o
 XL_OBJS += xl_info.o xl_console.o xl_misc.o
 XL_OBJS += xl_vmcontrol.o xl_saverestore.o xl_migrate.o
-XL_OBJS += xl_vdispl.o xl_vsnd.o
+XL_OBJS += xl_vdispl.o xl_vsnd.o xl_vkb.o
 
 $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
 $(XL_OBJS): CFLAGS += $(CFLAGS_XL)
tools/xl/xl.h +3 -0
index a6b85f6db2..15943f95dd 100644
@@ -173,6 +173,9 @@ int main_vdispldetach(int argc, char **argv);
 int main_vsndattach(int argc, char **argv);
 int main_vsndlist(int argc, char **argv);
 int main_vsnddetach(int argc, char **argv);
+int main_vkbattach(int argc, char **argv);
+int main_vkblist(int argc, char **argv);
+int main_vkbdetach(int argc, char **argv);
 int main_usbctrl_attach(int argc, char **argv);
 int main_usbctrl_detach(int argc, char **argv);
 int main_usbdev_attach(int argc, char **argv);
tools/xl/xl_cmdtable.c +16 -0
index 10426a2ffd..50d3e2e4a3 100644
@@ -15,6 +15,7 @@
 #include <string.h>
 
 #include <libxl.h>
+
 #include "xl.h"
 
 struct cmd_spec cmd_table[] = {
@@ -380,6 +381,21 @@ struct cmd_spec cmd_table[] = {
       "Destroy a domain's virtual TPM device",
       "<Domain> <DevId|uuid>",
     },
+    { "vkb-attach",
+      &main_vkbattach, 1, 1,
+      "Create a new virtual keyboard device",
+      "<Domain> <vkb-spec-component(s)>...",
+    },
+    { "vkb-list",
+      &main_vkblist, 0, 0,
+      "List virtual keyboard devices for a domain",
+      "<Domain(s)>",
+    },
+    { "vkb-detach",
+      &main_vkbdetach, 0, 1,
+      "Destroy a domain's virtual keyboard device",
+      "<Domain> <DevId>",
+    },
     { "vdispl-attach",
       &main_vdisplattach, 1, 1,
       "Create a new virtual display device",
tools/xl/xl_parse.c +75 -1

94 lines not on this page · raw message

tools/xl/xl_parse.h +1 -0
index 9a948ea4f7..bab2861f8c 100644
@@ -35,6 +35,7 @@ int parse_cpurange(const char *cpu, libxl_bitmap *cpumap);
 int parse_nic_config(libxl_device_nic *nic, XLU_Config **config, char *token);
 int parse_vdispl_config(libxl_device_vdispl *vdispl, char *token);
 int parse_vsnd_item(libxl_device_vsnd *vsnd, const char *spec);
+int parse_vkb_config(libxl_device_vkb *vkb, char *token);
 
 int match_option_size(const char *prefix, size_t len,
                       char *arg, char **argopt);
tools/xl/xl_vkb.c new file +147 -0

147 lines not on this page · raw message

Signature · 7 lines
2.17.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#6 lore raw

PATCH v3 5/7 docs: add vkb device to xl.cfg and xl

In reply to Oleksandr Grytsov

From: Oleksandr Grytsov <[email protected]>

---
 docs/man/xl.cfg.pod.5.in | 24 ++++++++++++++++++++++++
 docs/man/xl.pod.1.in     | 22 ++++++++++++++++++++++
 2 files changed, 46 insertions(+)
docs/man/xl.cfg.pod.5.in +24 -0
index 099a28dc7a..cc98b6003f 100644
@@ -1563,6 +1563,30 @@ I<EXAMPLE:>
         ]
     ]
 
+=item B<vkb=[ "VKB_SPEC_STRING", "VKB_SPEC_STRING", ...]>
+
+Specifies the virtual keyboard device to be provided to the guest.
+
+Each B<VKB_SPEC_STRING> is a comma-separated list of C<KEY=VALUE>
+settings from the following list:
+
+=over 4
+
+=item B<unique-id=STRING>
+
+Specifies the unique input device id.
+
+=item B<backend=domain-id>
+
+Specifies the backend domain name or id.
+
+=item B<backend-type=type>
+
+Specifies the backend type: qemu - for QEMU backend or linux - for Linux PV
+domain.
+
+=back
+
 =back
 
 =head2 Paravirtualised (PV) Guest Specific Options
docs/man/xl.pod.1.in +22 -0
index 90423bf3df..b74764dcd3 100644
@@ -1522,6 +1522,28 @@ List vsnd devices for a domain.
 
 =back
 
+=head2 KEYBOARD DEVICES
+
+=over 4
+
+=item B<vkb-attach> I<domain-id> I<vkb-device>
+
+Creates a new keyboard device in the domain specified by I<domain-id>.
+I<vkb-device> describes the device to attach, using the same format as the
+B<VKB_SPEC_STRING> string in the domain config file. See L<xl.cfg(5)>
+for more informations.
+
+=item B<vkb-detach> I<domain-id> I<devid>
+
+Removes the keyboard device from the domain specified by I<domain-id>.
+I<devid> is the virtual interface device number within the domain
+
+=item B<vkb-list> I<domain-id>
+
+List virtual network interfaces for a domain.
+
+=back
+
 =head1 PCI PASS-THROUGH
 
 =over 4
Signature · 7 lines
2.17.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#7 lore raw

PATCH v3 6/7 libxl: vkb add extended parameters

In reply to Oleksandr Grytsov

From: Oleksandr Grytsov <[email protected]>

Add parsing and adding to xen store following extended parameters:
* feature-disable-keyboard
* feature-disable-pointer
* feature-abs-pointer
* feature-multi-touch
* feature-raw-pointer
* width
* height
* multi-touch-width
* multi-touch-height
* multi-touch-num-contacts

---
 docs/man/xl.cfg.pod.5.in    |  40 +++++++++++
 tools/libxl/libxl_types.idl |  12 +++-
 tools/libxl/libxl_vkb.c     | 133 +++++++++++++++++++++++++++++++++++-
 tools/xl/xl_parse.c         |  35 +++++++++-
 tools/xl/xl_vkb.c           |  14 ++++
 5 files changed, 231 insertions(+), 3 deletions(-)
docs/man/xl.cfg.pod.5.in +40 -0
index cc98b6003f..b72718151b 100644
@@ -1585,6 +1585,46 @@ Specifies the backend domain name or id.
 Specifies the backend type: qemu - for QEMU backend or linux - for Linux PV
 domain.
 
+=item B<feature-disable-keyboard=BOOLEAN>
+
+Indicates if keyboard device is disabled.
+
+=item B<feature-disable-pointer=BOOLEAN>
+
+Indicates if pointer device is disabled.
+
+=item B<feature-abs-pointer=BOOLEAN>
+
+Indicates if pointer device can return absolute coordinates.
+
+=item B<feature-raw-pointer=BOOLEAN>
+
+Indicates if pointer device can return raw (unscaled) absolute coordinates.
+
+=item B<feature-multi-touch=BOOLEAN>
+
+Indicates if input device supports multi touch.
+
+=item B<multi-touch-width=MULTI_TOUCH_WIDTH>
+
+Set maximum width for multi touch device.
+
+=item B<multi-touch-height=MULTI_TOUCH_HEIGHT>
+
+Set maximum height for multi touch device.
+
+=item B<multi-touch-num-contacts=MULTI_TOUCH_NUM_CONTACTS>
+
+Set maximum contacts number for multi touch device.
+
+=item B<width=WIDTH>
+
+Set maximum width for pointer device.
+
+=item B<height=HEIGHT>
+
+Set maximum height for pointer device.
+
 =back
 
 =back
tools/libxl/libxl_types.idl +11 -1
index 4b4dc9eb5d..4a385801ba 100644
@@ -633,7 +633,17 @@ libxl_device_vkb = Struct("device_vkb", [
     ("backend_domname", string),
     ("devid", libxl_devid),
     ("backend_type", libxl_vkb_backend),
-    ("unique_id", string)
+    ("unique_id", string),
+    ("feature_disable_keyboard", bool),
+    ("feature_disable_pointer", bool),
+    ("feature_abs_pointer", bool),
+    ("feature_raw_pointer", bool),
+    ("feature_multi_touch", bool),
+    ("width", uint32),
+    ("height", uint32),
+    ("multi_touch_width", uint32),
+    ("multi_touch_height", uint32),
+    ("multi_touch_num_contacts", uint32)
     ])
 
 libxl_device_disk = Struct("device_disk", [
tools/libxl/libxl_vkb.c +132 -1

151 lines not on this page · raw message

tools/xl/xl_parse.c +34 -1
index 9b7b78c2a1..971ec1bc56 100644
@@ -1112,6 +1112,26 @@ int parse_vkb_config(libxl_device_vkb *vkb, char *token)
         vkb->backend_type = backend_type;
     } else if (MATCH_OPTION(XENKBD_FIELD_UNIQUE_ID, token, oparg)) {
         vkb->unique_id = strdup(oparg);
+    } else if (MATCH_OPTION(XENKBD_FIELD_FEAT_DSBL_KEYBRD, token, oparg)) {
+        vkb->feature_disable_keyboard = strtoul(oparg, NULL, 0);
+    } else if (MATCH_OPTION(XENKBD_FIELD_FEAT_DSBL_POINTER, token, oparg)) {
+        vkb->feature_disable_pointer = strtoul(oparg, NULL, 0);
+    } else if (MATCH_OPTION(XENKBD_FIELD_FEAT_ABS_POINTER, token, oparg)) {
+        vkb->feature_abs_pointer = strtoul(oparg, NULL, 0);
+    } else if (MATCH_OPTION(XENKBD_FIELD_FEAT_RAW_POINTER, token, oparg)) {
+        vkb->feature_raw_pointer = strtoul(oparg, NULL, 0);
+    } else if (MATCH_OPTION(XENKBD_FIELD_FEAT_MTOUCH, token, oparg)) {
+        vkb->feature_multi_touch = strtoul(oparg, NULL, 0);
+    } else if (MATCH_OPTION(XENKBD_FIELD_MT_WIDTH, token, oparg)) {
+        vkb->multi_touch_width = strtoul(oparg, NULL, 0);
+    } else if (MATCH_OPTION(XENKBD_FIELD_MT_HEIGHT, token, oparg)) {
+        vkb->multi_touch_height = strtoul(oparg, NULL, 0);
+    } else if (MATCH_OPTION(XENKBD_FIELD_MT_NUM_CONTACTS, token, oparg)) {
+        vkb->multi_touch_num_contacts = strtoul(oparg, NULL, 0);
+    } else if (MATCH_OPTION(XENKBD_FIELD_WIDTH, token, oparg)) {
+        vkb->width = strtoul(oparg, NULL, 0);
+    } else if (MATCH_OPTION(XENKBD_FIELD_HEIGHT, token, oparg)) {
+        vkb->height = strtoul(oparg, NULL, 0);
     } else {
         fprintf(stderr, "Unknown string \"%s\" in vkb spec\n", token);
         return -1;
@@ -1153,7 +1173,20 @@ static void parse_vkb_list(const XLU_Config *config,
 
             if (vkb->backend_type == LIBXL_VKB_BACKEND_UNKNOWN) {
                 fprintf(stderr, "backend-type should be set in vkb spec\n");
-                rc = -1; goto out;
+                rc = ERROR_FAIL; goto out;
+            }
+
+            if (vkb->multi_touch_height || vkb->multi_touch_width ||
+                vkb->multi_touch_num_contacts) {
+                vkb->feature_multi_touch = true;
+            }
+
+            if (vkb->feature_multi_touch && !(vkb->multi_touch_height ||
+                vkb->multi_touch_width || vkb->multi_touch_num_contacts)) {
+                fprintf(stderr, XENKBD_FIELD_MT_WIDTH", "XENKBD_FIELD_MT_HEIGHT", "
+                                XENKBD_FIELD_MT_NUM_CONTACTS" should be set for "
+                                "multi touch in vkb spec\n");
+                rc = ERROR_FAIL; goto out;
             }
 
             entry++;
tools/xl/xl_vkb.c +14 -0
index dcf828e156..f6ed9e05ee 100644
@@ -18,6 +18,8 @@
 #include <libxl_utils.h>
 #include <libxlutil.h>
 
+#include <xen/io/kbdif.h>
+
 #include "xl.h"
 #include "xl_utils.h"
 #include "xl_parse.h"
@@ -46,6 +48,18 @@ int main_vkbattach(int argc, char **argv)
         rc = ERROR_FAIL; goto out;
     }
 
+    if (vkb.multi_touch_height || vkb.multi_touch_width ||
+        vkb.multi_touch_num_contacts) {
+        vkb.feature_multi_touch = true;
+    }
+
+    if (vkb.feature_multi_touch && !(vkb.multi_touch_height ||
+        vkb.multi_touch_width || vkb.multi_touch_num_contacts)) {
+        fprintf(stderr, XENKBD_FIELD_MT_WIDTH", "XENKBD_FIELD_MT_HEIGHT", "
+                        XENKBD_FIELD_MT_NUM_CONTACTS" should be set\n");
+        rc = ERROR_FAIL; goto out;
+    }
+
     if (dryrun_only) {
         char *json = libxl_device_vkb_to_json(ctx, &vkb);
         printf("vkb: %s\n", json);
Signature · 7 lines
2.17.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#8 lore raw

PATCH v3 7/7 libxl: add LIBXL_HAVE_EXTENDED_VKB define

In reply to Oleksandr Grytsov

From: Oleksandr Grytsov <[email protected]>

LIBXL_HAVE_EXTENDED_VKB define indicates that libxl_device_vkb structure has extended fields.

---
 tools/libxl/libxl.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
tools/libxl/libxl.h +16 -0
index 919f660c51..ae2d63df0c 100644
@@ -354,6 +354,22 @@
 #define LIBXL_HAVE_BUILDINFO_BOOTLOADER 1
 #define LIBXL_HAVE_BUILDINFO_BOOTLOADER_ARGS 1
 
+/*
+ * LIBXL_HAVE_EXTENDED_VKB indicates that libxl_device_vkb has extended fields:
+ *  - unique_id;
+ *  - feature_disable_keyboard;
+ *  - feature_disable_pointer;
+ *  - feature_abs_pointer;
+ *  - feature_raw_pointer;
+ *  - feature_multi_touch;
+ *  - width;
+ *  - height;
+ *  - multi_touch_width;
+ *  - multi_touch_height;
+ *  - multi_touch_num_contacts.
+ */
+#define LIBXL_HAVE_EXTENDED_VKB 1
+
 /*
  * libxl ABI compatibility
  *
Signature · 7 lines
2.17.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v3 2/7
#3 lore raw

Re: [PATCH v3 2/7] libxl: add backend type and id to vkb

In reply to Oleksandr Grytsov
Quoted 8 lines · Oleksandr Grytsov

From: Oleksandr Grytsov <[email protected]>

New field backend_type is added to vkb device in order to have QEMU and user space backend simultaneously. Each vkb backend shall read appropriate XS entry and service only own frontends. Id is a string field which used by the backend to indentify the frontend.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Acked-by on v3 7/7
#9 lore raw

Re: [PATCH v3 7/7] libxl: add LIBXL_HAVE_EXTENDED_VKB define

In reply to Oleksandr Grytsov
Quoted 6 lines · Oleksandr Grytsov

From: Oleksandr Grytsov <[email protected]>

LIBXL_HAVE_EXTENDED_VKB define indicates that libxl_device_vkb structure has extended fields.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel