[libvirt] [PATCH] hostdev: display leading zeros of USB vendor/product id's in error messages

Chen Hanxiao chen_han_xiao at 126.com
Fri Jul 28 08:33:17 UTC 2017


From: Chen Hanxiao <chenhanxiao at gmail.com>

    Many vendor id's and product id's have leading zeros.
    Show them in error messages.

Signed-off-by: Chen Hanxiao <chenhanxiao at gmail.com>
---
 src/util/virhostdev.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
index 579563c..0e6b5a3 100644
--- a/src/util/virhostdev.c
+++ b/src/util/virhostdev.c
@@ -1390,7 +1390,7 @@ virHostdevFindUSBDevice(virDomainHostdevDefPtr hostdev,
         } else if (!autoAddress) {
             goto out;
         } else {
-            VIR_INFO("USB device %x:%x could not be found at previous"
+            VIR_INFO("USB device %04x:%04x could not be found at previous"
                      " address (bus:%u device:%u)",
                      vendor, product, bus, device);
         }
@@ -1418,12 +1418,12 @@ virHostdevFindUSBDevice(virDomainHostdevDefPtr hostdev,
         } else if (rc > 1) {
             if (autoAddress) {
                 virReportError(VIR_ERR_OPERATION_FAILED,
-                               _("Multiple USB devices for %x:%x were found,"
+                               _("Multiple USB devices for %04x:%04x were found,"
                                  " but none of them is at bus:%u device:%u"),
                                vendor, product, bus, device);
             } else {
                 virReportError(VIR_ERR_OPERATION_FAILED,
-                               _("Multiple USB devices for %x:%x, "
+                               _("Multiple USB devices for %04x:%04x, "
                                  "use <address> to specify one"),
                                vendor, product);
             }
@@ -1435,7 +1435,7 @@ virHostdevFindUSBDevice(virDomainHostdevDefPtr hostdev,
         usbsrc->autoAddress = true;
 
         if (autoAddress) {
-            VIR_INFO("USB device %x:%x found at bus:%u device:%u (moved"
+            VIR_INFO("USB device %04x:%04x found at bus:%u device:%u (moved"
                      " from bus:%u device:%u)",
                      vendor, product,
                      usbsrc->bus, usbsrc->device,
-- 
2.7.4





More information about the libvir-list mailing list