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

[Xen-changelog] [xen staging] libxl: vkb add extended parameters



commit da37ed268cdd7102bcdb5967fd351e8c7760a58f
Author:     Oleksandr Grytsov <oleksandr_grytsov@xxxxxxxx>
AuthorDate: Tue Jul 17 19:07:39 2018 +0300
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Wed Jul 25 11:08:22 2018 +0100

    libxl: vkb add extended parameters
    
    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
    
    Signed-off-by: Oleksandr Grytsov <oleksandr_grytsov@xxxxxxxx>
    Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 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(-)

diff --git a/docs/man/xl.cfg.pod.5.in b/docs/man/xl.cfg.pod.5.in
index cc98b6003f..b72718151b 100644
--- a/docs/man/xl.cfg.pod.5.in
+++ b/docs/man/xl.cfg.pod.5.in
@@ -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
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
index 4b4dc9eb5d..4a385801ba 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -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", [
diff --git a/tools/libxl/libxl_vkb.c b/tools/libxl/libxl_vkb.c
index 1262dbc7bd..e928839cfb 100644
--- a/tools/libxl/libxl_vkb.c
+++ b/tools/libxl/libxl_vkb.c
@@ -43,6 +43,47 @@ static int libxl__set_xenstore_vkb(libxl__gc *gc, uint32_t 
domid,
         flexarray_append_pair(back, XENKBD_FIELD_UNIQUE_ID, vkb->unique_id);
     }
 
+    if (vkb->feature_disable_keyboard) {
+        flexarray_append_pair(back, XENKBD_FIELD_FEAT_DSBL_KEYBRD,
+                              GCSPRINTF("%u", vkb->feature_disable_keyboard));
+    }
+
+    if (vkb->feature_disable_pointer) {
+        flexarray_append_pair(back, XENKBD_FIELD_FEAT_DSBL_POINTER,
+                              GCSPRINTF("%u", vkb->feature_disable_pointer));
+    }
+
+    if (vkb->feature_abs_pointer) {
+        flexarray_append_pair(back, XENKBD_FIELD_FEAT_ABS_POINTER,
+                              GCSPRINTF("%u", vkb->feature_abs_pointer));
+    }
+
+    if (vkb->feature_raw_pointer) {
+        flexarray_append_pair(back, XENKBD_FIELD_FEAT_RAW_POINTER,
+                              GCSPRINTF("%u", vkb->feature_raw_pointer));
+    }
+
+    if (vkb->feature_multi_touch) {
+        flexarray_append_pair(back, XENKBD_FIELD_FEAT_MTOUCH,
+                              GCSPRINTF("%u", vkb->feature_multi_touch));
+        flexarray_append_pair(back, XENKBD_FIELD_MT_WIDTH,
+                              GCSPRINTF("%u", vkb->multi_touch_width));
+        flexarray_append_pair(back, XENKBD_FIELD_MT_HEIGHT,
+                              GCSPRINTF("%u", vkb->multi_touch_height));
+        flexarray_append_pair(back, XENKBD_FIELD_MT_NUM_CONTACTS,
+                              GCSPRINTF("%u", vkb->multi_touch_num_contacts));
+    }
+
+    if (vkb->width) {
+        flexarray_append_pair(back, XENKBD_FIELD_WIDTH,
+                              GCSPRINTF("%u", vkb->width));
+    }
+
+    if (vkb->height) {
+        flexarray_append_pair(back, XENKBD_FIELD_HEIGHT,
+                              GCSPRINTF("%u", vkb->height));
+    }
+
     return 0;
 }
 
@@ -50,7 +91,7 @@ static int libxl__vkb_from_xenstore(libxl__gc *gc, const char 
*libxl_path,
                                     libxl_devid devid,
                                     libxl_device_vkb *vkb)
 {
-    const char *be_path, *be_type, *fe_path;
+    const char *be_path, *be_type, *fe_path, *tmp;
     int rc;
 
     vkb->devid = devid;
@@ -78,6 +119,96 @@ static int libxl__vkb_from_xenstore(libxl__gc *gc, const 
char *libxl_path,
 
     vkb->unique_id = xs_read(CTX->xsh, XBT_NULL, 
GCSPRINTF("%s/"XENKBD_FIELD_UNIQUE_ID, be_path), NULL);
 
+    rc = libxl__xs_read_checked(gc, XBT_NULL,
+                                GCSPRINTF("%s/"XENKBD_FIELD_FEAT_DSBL_KEYBRD,
+                                be_path), &tmp);
+    if (rc) goto out;
+
+    if (tmp) {
+        vkb->feature_disable_keyboard = strtoul(tmp, NULL, 0);
+    }
+
+    rc = libxl__xs_read_checked(gc, XBT_NULL,
+                                GCSPRINTF("%s/"XENKBD_FIELD_FEAT_DSBL_POINTER,
+                                be_path), &tmp);
+    if (rc) goto out;
+
+    if (tmp) {
+        vkb->feature_disable_pointer = strtoul(tmp, NULL, 0);
+    }
+
+    rc = libxl__xs_read_checked(gc, XBT_NULL,
+                                GCSPRINTF("%s/"XENKBD_FIELD_FEAT_ABS_POINTER,
+                                be_path), &tmp);
+    if (rc) goto out;
+
+    if (tmp) {
+        vkb->feature_abs_pointer = strtoul(tmp, NULL, 0);
+    }
+
+    rc = libxl__xs_read_checked(gc, XBT_NULL,
+                                GCSPRINTF("%s/"XENKBD_FIELD_FEAT_RAW_POINTER,
+                                be_path), &tmp);
+    if (rc) goto out;
+
+    if (tmp) {
+        vkb->feature_raw_pointer = strtoul(tmp, NULL, 0);
+    }
+
+    rc = libxl__xs_read_checked(gc, XBT_NULL,
+                                GCSPRINTF("%s/"XENKBD_FIELD_FEAT_MTOUCH,
+                                be_path), &tmp);
+    if (rc) goto out;
+
+    if (tmp) {
+        vkb->feature_multi_touch = strtoul(tmp, NULL, 0);
+    }
+
+    rc = libxl__xs_read_checked(gc, XBT_NULL,
+                                GCSPRINTF("%s/"XENKBD_FIELD_MT_WIDTH,
+                                be_path), &tmp);
+    if (rc) goto out;
+
+    if (tmp) {
+        vkb->multi_touch_width = strtoul(tmp, NULL, 0);
+    }
+
+    rc = libxl__xs_read_checked(gc, XBT_NULL,
+                                GCSPRINTF("%s/"XENKBD_FIELD_MT_HEIGHT,
+                                be_path), &tmp);
+    if (rc) goto out;
+
+    if (tmp) {
+        vkb->multi_touch_height = strtoul(tmp, NULL, 0);
+    }
+
+    rc = libxl__xs_read_checked(gc, XBT_NULL,
+                                GCSPRINTF("%s/"XENKBD_FIELD_MT_NUM_CONTACTS,
+                                be_path), &tmp);
+    if (rc) goto out;
+
+    if (tmp) {
+        vkb->multi_touch_num_contacts = strtoul(tmp, NULL, 0);
+    }
+
+    rc = libxl__xs_read_checked(gc, XBT_NULL,
+                                GCSPRINTF("%s/"XENKBD_FIELD_WIDTH,
+                                be_path), &tmp);
+    if (rc) goto out;
+
+    if (tmp) {
+        vkb->width = strtoul(tmp, NULL, 0);
+    }
+
+    rc = libxl__xs_read_checked(gc, XBT_NULL,
+                                GCSPRINTF("%s/"XENKBD_FIELD_HEIGHT,
+                                be_path), &tmp);
+    if (rc) goto out;
+
+    if (tmp) {
+        vkb->height = strtoul(tmp, NULL, 0);
+    }
+
     rc = 0;
 
 out:
diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index 9b7b78c2a1..971ec1bc56 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -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++;
diff --git a/tools/xl/xl_vkb.c b/tools/xl/xl_vkb.c
index dcf828e156..f6ed9e05ee 100644
--- a/tools/xl/xl_vkb.c
+++ b/tools/xl/xl_vkb.c
@@ -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);
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.