Enables Spice clipboard sharing (copy/paste). It requires spicevdagent
enabled. The default is false (0).
+=item B<spiceusbredirection=NUMBER>
+
+Enables spice usbredirection. Creates NUMBER usbredirection channels
+for redirection of up to 4 usb devices from spice client to domU's qemu.
+It requires an usb controller and if not defined it will automatically adds
+an usb2 controller. The default is disabled (0).
+
=back
=head3 Miscellaneous Emulated Hardware
*/
#define LIBXL_HAVE_SPICE_VDAGENT 1
+/*
+ * LIBXL_HAVE_SPICE_USBREDIRECTION
+ *
+ * If defined, then the libxl_spice_info structure will contain an integer type
+ * field: usbredirection. This value defines if Spice usbredirection is enabled
+ * and with how much channels.
+ *
+ * If this is not defined, the Spice usbredirection support is ignored.
+ */
+#define LIBXL_HAVE_SPICE_USBREDIREDIRECTION 1
+
/*
* LIBXL_HAVE_DOMAIN_CREATE_RESTORE_PARAMS 1
*
libxl_defbool_setdefault(&b_info->u.hvm.usb, false);
libxl_defbool_setdefault(&b_info->u.hvm.xen_platform_pci, true);
- if (b_info->u.hvm.usbversion &&
+ if (!b_info->u.hvm.usbversion &&
+ (b_info->u.hvm.spice.usbredirection > 0) )
+ b_info->u.hvm.usbversion = 2;
+
+ if ((b_info->u.hvm.usbversion || b_info->u.hvm.spice.usbredirection) &&
( libxl_defbool_val(b_info->u.hvm.usb)
|| b_info->u.hvm.usbdevice_list
|| b_info->u.hvm.usbdevice) ){
- LOG(ERROR,"usbversion cannot be enabled with usb or"
- "usbdevice parameters.");
+ LOG(ERROR,"usbversion and/or usbredirection cannot be "
+ "enabled with usb and/or usbdevice parameters.");
return ERROR_INVAL;
}
"must be between 1 and 3", __func__);
return NULL;
}
+ if (b_info->u.hvm.spice.usbredirection >= 0 &&
+ b_info->u.hvm.spice.usbredirection < 5) {
+ for (i = 1; i <= b_info->u.hvm.spice.usbredirection; i++)
+ flexarray_vappend(dm_args, "-chardev", libxl__sprintf(gc,
+ "spicevmc,name=usbredir,id=usbrc%d", i), "-device",
+ libxl__sprintf(gc, "usb-redir,chardev=usbrc%d,"
+ "id=usbrc%d", i, i), NULL);
+ } else {
+ LOG(ERROR, "%s: usbredirection parameter is invalid, "
+ "it must be between 1 and 4", __func__);
+ return NULL;
+ }
}
if (b_info->u.hvm.soundhw) {
flexarray_vappend(dm_args, "-soundhw", b_info->u.hvm.soundhw, NULL);
("agent_mouse", libxl_defbool),
("vdagent", libxl_defbool),
("clipboard_sharing", libxl_defbool),
+ ("usbredirection", integer),
])
libxl_sdl_info = Struct("sdl_info", [
&b_info->u.hvm.spice.vdagent, 0);
xlu_cfg_get_defbool(config, "spice_clipboard_sharing",
&b_info->u.hvm.spice.clipboard_sharing, 0);
+ if (!xlu_cfg_get_long (config, "spiceusbredirection", &l, 0))
+ b_info->u.hvm.spice.usbredirection = l;
xlu_cfg_get_defbool(config, "nographic", &b_info->u.hvm.nographic, 0);
xlu_cfg_get_defbool(config, "gfx_passthru",
&b_info->u.hvm.gfx_passthru, 0);