From: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx> The USB device redirection works in a similar way as Spice. The underlying 'dbus' channel is set to "org.qemu.usbredir" by default for the client to identify the channel purpose (as specified in -display dbus documentation). Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx> --- src/conf/domain_conf.c | 2 ++ .../graphics-dbus-usbredir.args | 34 +++++++++++++++++++ .../graphics-dbus-usbredir.xml | 30 ++++++++++++++++ tests/qemuxml2argvtest.c | 4 +++ 4 files changed, 70 insertions(+) create mode 100644 tests/qemuxml2argvdata/graphics-dbus-usbredir.args create mode 100644 tests/qemuxml2argvdata/graphics-dbus-usbredir.xml diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 49b5cdb7c0f3..713df74e03df 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -14530,6 +14530,8 @@ virDomainRedirdevDefParseXML(virDomainXMLOption *xmlopt, if (def->source->type == VIR_DOMAIN_CHR_TYPE_SPICEVMC) def->source->data.spicevmc = VIR_DOMAIN_CHR_SPICEVMC_USBREDIR; + if (def->source->type == VIR_DOMAIN_CHR_TYPE_DBUS && !def->source->data.dbus.channel) + def->source->data.dbus.channel = g_strdup("org.qemu.usbredir"); if (virDomainDeviceInfoParseXML(xmlopt, node, ctxt, &def->info, flags | VIR_DOMAIN_DEF_PARSE_ALLOW_BOOT) < 0) diff --git a/tests/qemuxml2argvdata/graphics-dbus-usbredir.args b/tests/qemuxml2argvdata/graphics-dbus-usbredir.args new file mode 100644 index 000000000000..f76693ac1e83 --- /dev/null +++ b/tests/qemuxml2argvdata/graphics-dbus-usbredir.args @@ -0,0 +1,34 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/tmp/lib/domain--1-QEMUGuest1 \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ +/usr/bin/qemu-system-i386 \ +-name guest=QEMUGuest1,debug-threads=on \ +-S \ +-object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ +-machine pc,usb=off,dump-guest-core=off \ +-accel tcg \ +-m 214 \ +-realtime mlock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server=on,wait=off \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-boot strict=on \ +-usb \ +-display dbus,p2p=on \ +-device cirrus-vga,id=video0,bus=pci.0,addr=0x2 \ +-chardev dbus,id=charredir0,name=org.qemu.usbredir \ +-device usb-redir,chardev=charredir0,id=redir0,bus=usb.0,port=1 \ +-chardev dbus,id=charredir1,name=org.qemu.usbredir \ +-device usb-redir,chardev=charredir1,id=redir1,bus=usb.0,port=2 \ +-msg timestamp=on diff --git a/tests/qemuxml2argvdata/graphics-dbus-usbredir.xml b/tests/qemuxml2argvdata/graphics-dbus-usbredir.xml new file mode 100644 index 000000000000..fad6cd8b5f98 --- /dev/null +++ b/tests/qemuxml2argvdata/graphics-dbus-usbredir.xml @@ -0,0 +1,30 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-i386</emulator> + <controller type='usb' index='0'/> + <controller type='ide' index='0'/> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <graphics type='dbus' p2p='yes'/> + <redirdev bus='usb' type='dbus'/> + <redirdev bus='usb' type='dbus'/> + <video> + <model type='cirrus' vram='16384' heads='1'/> + </video> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index aed30080b7a5..ec07a1aa5779 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1529,6 +1529,10 @@ mymain(void) QEMU_CAPS_DEVICE_ISA_SERIAL, QEMU_CAPS_DEVICE_CIRRUS_VGA, QEMU_CAPS_DISPLAY_DBUS); + DO_TEST("graphics-dbus-usbredir", + QEMU_CAPS_DEVICE_CIRRUS_VGA, + QEMU_CAPS_DISPLAY_DBUS, + QEMU_CAPS_USB_REDIR); DO_TEST_NOCAPS("input-usbmouse"); DO_TEST_NOCAPS("input-usbtablet"); -- 2.34.1.8.g35151cf07204