[libvirt] [PATCH] usb: keep leading zeros of vendor/product id in USB device

Chen Hanxiao posted 1 patch 6 years, 11 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/1495178252-10980-1-git-send-email-chen_han_xiao@126.com
src/util/virusb.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
[libvirt] [PATCH] usb: keep leading zeros of vendor/product id in USB device
Posted by Chen Hanxiao 6 years, 11 months ago
From: Chen Hanxiao <chenhanxiao@gmail.com>

Some vendor id or product id may have leading zeros.
We should show them.

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

diff --git a/src/util/virusb.c b/src/util/virusb.c
index 8cd2f57..6359235 100644
--- a/src/util/virusb.c
+++ b/src/util/virusb.c
@@ -221,7 +221,7 @@ virUSBDeviceFindByVendor(unsigned int vendor,
     if (list->count == 0) {
         virObjectUnref(list);
         if (!mandatory) {
-            VIR_DEBUG("Did not find USB device %x:%x",
+            VIR_DEBUG("Did not find USB device %04x:%04x",
                       vendor, product);
             if (devices)
                 *devices = NULL;
@@ -229,7 +229,7 @@ virUSBDeviceFindByVendor(unsigned int vendor,
         }
 
         virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Did not find USB device %x:%x"), vendor, product);
+                       _("Did not find USB device %04x:%04x"), vendor, product);
         return -1;
     }
 
@@ -300,7 +300,7 @@ virUSBDeviceFind(unsigned int vendor,
     if (list->count == 0) {
         virObjectUnref(list);
         if (!mandatory) {
-            VIR_DEBUG("Did not find USB device %x:%x bus:%u device:%u",
+            VIR_DEBUG("Did not find USB device %04x:%04x bus:%u device:%u",
                       vendor, product, bus, devno);
             if (usb)
                 *usb = NULL;
@@ -308,7 +308,7 @@ virUSBDeviceFind(unsigned int vendor,
         }
 
         virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Did not find USB device %x:%x bus:%u device:%u"),
+                       _("Did not find USB device %04x:%04x bus:%u device:%u"),
                        vendor, product, bus, devno);
         return -1;
     }
-- 
2.7.4


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] usb: keep leading zeros of vendor/product id in USB device
Posted by Chen Hanxiao 6 years, 11 months ago
At 2017-05-19 15:17:32, "Chen Hanxiao" <chen_han_xiao@126.com> wrote:
>From: Chen Hanxiao <chenhanxiao@gmail.com>
>
>Some vendor id or product id may have leading zeros.
>We should show them.
>
>Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>

ping

Regards,
- Chen

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] usb: keep leading zeros of vendor/product id in USB device
Posted by Laine Stump 6 years, 11 months ago
On 05/19/2017 03:17 AM, Chen Hanxiao wrote:
> From: Chen Hanxiao <chenhanxiao@gmail.com>
> 
> Some vendor id or product id may have leading zeros.
> We should show them.
> 
> Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>

Reviewed-by: Laine Stump <laine@laine.org>

ACK and pushed (I modified the log message slightly).

(When we format USB vendor/product id's for XML, we use "%.4x" rather
than "%04x", but the effect is the same)


> ---
>  src/util/virusb.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/src/util/virusb.c b/src/util/virusb.c
> index 8cd2f57..6359235 100644
> --- a/src/util/virusb.c
> +++ b/src/util/virusb.c
> @@ -221,7 +221,7 @@ virUSBDeviceFindByVendor(unsigned int vendor,
>      if (list->count == 0) {
>          virObjectUnref(list);
>          if (!mandatory) {
> -            VIR_DEBUG("Did not find USB device %x:%x",
> +            VIR_DEBUG("Did not find USB device %04x:%04x",
>                        vendor, product);
>              if (devices)
>                  *devices = NULL;
> @@ -229,7 +229,7 @@ virUSBDeviceFindByVendor(unsigned int vendor,
>          }
>  
>          virReportError(VIR_ERR_INTERNAL_ERROR,
> -                       _("Did not find USB device %x:%x"), vendor, product);
> +                       _("Did not find USB device %04x:%04x"), vendor, product);
>          return -1;
>      }
>  
> @@ -300,7 +300,7 @@ virUSBDeviceFind(unsigned int vendor,
>      if (list->count == 0) {
>          virObjectUnref(list);
>          if (!mandatory) {
> -            VIR_DEBUG("Did not find USB device %x:%x bus:%u device:%u",
> +            VIR_DEBUG("Did not find USB device %04x:%04x bus:%u device:%u",
>                        vendor, product, bus, devno);
>              if (usb)
>                  *usb = NULL;
> @@ -308,7 +308,7 @@ virUSBDeviceFind(unsigned int vendor,
>          }
>  
>          virReportError(VIR_ERR_INTERNAL_ERROR,
> -                       _("Did not find USB device %x:%x bus:%u device:%u"),
> +                       _("Did not find USB device %04x:%04x bus:%u device:%u"),
>                         vendor, product, bus, devno);
>          return -1;
>      }
> 

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list