[libvirt] [PATCH v2 14/14] libxl: add tablet/mouse input device support

Marek Marczykowski-Górecki marmarek at invisiblethingslab.com
Thu Jun 13 01:54:16 UTC 2013


Signed-off-by: Marek Marczykowski-Górecki <marmarek at invisiblethingslab.com>
---
 src/libxl/libxl_conf.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 278c5e5..61c370f 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -481,6 +481,36 @@ libxlMakeDomBuildInfo(libxlDriverPrivatePtr driver,
             }
         }
 
+        /* Only the first one is used - b_info->u.hvm.usbdevice doesn't have
+         * space for more (until xen 4.3) */
+        if (def->ninputs) {
+            if (def->ninputs > 1) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                        _("This driver supports only one input device"));
+                goto error;
+            }
+            if (def->inputs[0]->bus != VIR_DOMAIN_INPUT_BUS_USB) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                        _("libxenlight support only USB input for now"));
+                goto error;
+            }
+
+            switch (def->inputs[0]->type) {
+                case VIR_DOMAIN_INPUT_TYPE_MOUSE:
+                    free(b_info->u.hvm.usbdevice);
+                    b_info->u.hvm.usbdevice = strdup("mouse");
+                    break;
+                case VIR_DOMAIN_INPUT_TYPE_TABLET:
+                    free(b_info->u.hvm.usbdevice);
+                    b_info->u.hvm.usbdevice = strdup("tablet");
+                    break;
+                default:
+                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                               _("Unknown input device type"));
+                    goto error;
+            }
+        }
+
         /*
          * The following comment and calculation were taken directly from
          * libxenlight's internal function libxl_get_required_shadow_memory():
-- 
1.8.1.4




More information about the libvir-list mailing list