Signed-off-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx> --- src/qemu/qemu_command.c | 6 ------ src/qemu/qemu_validate.c | 9 +++++++++ tests/qemuhotplugtest.c | 1 + 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index a4f1cbce11..f9387a65e0 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3823,12 +3823,6 @@ qemuBuildUSBInputDevStr(const virDomainDef *def, virBufferAsprintf(&buf, "usb-tablet,id=%s", dev->info.alias); break; case VIR_DOMAIN_INPUT_TYPE_KBD: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_USB_KBD)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("usb keyboard is not supported by this " - "QEMU binary")); - return NULL; - } virBufferAsprintf(&buf, "usb-kbd,id=%s", dev->info.alias); break; } diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index ebc70aaf00..5de468af60 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -3993,6 +3993,15 @@ qemuValidateDomainDeviceDefInput(const virDomainInputDef *input, return -1; } + if (input->bus == VIR_DOMAIN_INPUT_BUS_USB && + input->type == VIR_DOMAIN_INPUT_TYPE_KBD && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_USB_KBD)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("usb keyboard is not supported by this " + "QEMU binary")); + return -1; + } + if (input->bus != VIR_DOMAIN_INPUT_BUS_VIRTIO) return 0; diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index 2d12cacf28..0948c8792d 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -89,6 +89,7 @@ qemuHotplugCreateObjects(virDomainXMLOptionPtr xmlopt, virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_SPICE_FILE_XFER_DISABLE); virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_PR_MANAGER_HELPER); virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_SCSI_BLOCK); + virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_DEVICE_USB_KBD); if (qemuTestCapsCacheInsert(driver.qemuCapsCache, priv->qemuCaps) < 0) return -1; -- 2.26.2