[libvirt] [PATCH 3/3] smartcard: check for qemu capability

Eric Blake eblake at redhat.com
Thu Jan 13 19:10:12 UTC 2011


Qemu smartcard support exists on branches (such as
http://cgit.freedesktop.org/~alon/qemu/commit/?h=usb_ccid.v15&id=024a37b)
but is not yet upstream.  Once an upstream version exists, then we
can add new -help and -device ? output files  to tests/qemuhelptest
to prove that the new flag works.

* src/qemu/qemu_capabilities.h (QEMUD_CMD_FLAG_USB_CCID): New
flag.
* src/qemu/qemu_capabilities.c (qemuCapsExtractDeviceStr)
(qemuCapsParseDeviceStr): Check for smartcard device support.
---
 src/qemu/qemu_capabilities.c |    6 ++++++
 src/qemu/qemu_capabilities.h |    3 ++-
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index f967255..c131124 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1046,6 +1046,7 @@ qemuCapsExtractDeviceStr(const char *qemu,
      * isolation, but are silently ignored in combination with
      * '-device ?'.  */
     cmd = virCommandNewArgList(qemu,
+                               "-device", "?",
                                "-device", "pci-assign,?",
                                NULL);
     virCommandAddEnvPassCommon(cmd);
@@ -1068,6 +1069,11 @@ cleanup:
 int
 qemuCapsParseDeviceStr(const char *str, unsigned long long *flags)
 {
+    /* Which devices exist. */
+    if (strstr(str, "name \"usb-ccid\""))
+        *flags |= QEMUD_CMD_FLAG_USB_CCID;
+
+    /* Features of given devices. */
     if (strstr(str, "pci-assign.configfd"))
         *flags |= QEMUD_CMD_FLAG_PCI_CONFIGFD;

diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 8057479..484c112 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -1,7 +1,7 @@
 /*
  * qemu_capabilities.h: QEMU capabilities generation
  *
- * Copyright (C) 2006-2007, 2009-2010 Red Hat, Inc.
+ * Copyright (C) 2006-2007, 2009-2011 Red Hat, Inc.
  * Copyright (C) 2006 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -83,6 +83,7 @@ enum qemuCapsFlags {
     QEMUD_CMD_FLAG_SPICE         = (1LL << 46), /* Is -spice avail */
     QEMUD_CMD_FLAG_VGA_NONE      = (1LL << 47), /* The 'none' arg for '-vga' */
     QEMUD_CMD_FLAG_MIGRATE_QEMU_FD = (1LL << 48), /* -incoming fd:n */
+    QEMUD_CMD_FLAG_USB_CCID      = (1LL << 49), /* -device usb-ccid */
 };

 virCapsPtr qemuCapsInit(virCapsPtr old_caps);
-- 
1.7.3.4




More information about the libvir-list mailing list