Re: Empty usb vendor and product strings

2017-03-11 Thread Martin Pieuchot
On 11/03/17(Sat) 16:39, Mark Kettenis wrote:
> The GL3521 USB 3 hub on the odroid XU4 returns empty vendor and
> product strings.  That makes us skip the lookup in our own tables and
> print a "vendor 0x05e3 pruduct 0x0616" string.  Not sure if that's
> intentional (can't think of a good reason).  If it isn't, I propose
> the diff below.

If you sure there's no problem in usbd_get_string() then I'd rather
change the function to return NULL if an empty string is found.

> 
> ok?
> 
> 
> Index: usb_subr.c
> ===
> RCS file: /cvs/src/sys/dev/usb/usb_subr.c,v
> retrieving revision 1.131
> diff -u -p -r1.131 usb_subr.c
> --- usb_subr.c19 Sep 2016 16:46:10 -  1.131
> +++ usb_subr.c11 Mar 2017 15:12:08 -
> @@ -254,9 +254,9 @@ usbd_devinfo_vp(struct usbd_device *dev,
>   product = usbd_get_string(dev, udd->iProduct, p, pl);
>   usbd_trim_spaces(product);
>   } else {
> - if (dev->vendor != NULL)
> + if (dev->vendor != NULL && *dev->vendor)
>   vendor = dev->vendor;
> - if (dev->product != NULL)
> + if (dev->product != NULL && *dev->product)
>   product = dev->product;
>   }>  #ifdef USBVERBOSE
> 



Empty usb vendor and product strings

2017-03-11 Thread Mark Kettenis
The GL3521 USB 3 hub on the odroid XU4 returns empty vendor and
product strings.  That makes us skip the lookup in our own tables and
print a "vendor 0x05e3 pruduct 0x0616" string.  Not sure if that's
intentional (can't think of a good reason).  If it isn't, I propose
the diff below.

ok?


Index: usb_subr.c
===
RCS file: /cvs/src/sys/dev/usb/usb_subr.c,v
retrieving revision 1.131
diff -u -p -r1.131 usb_subr.c
--- usb_subr.c  19 Sep 2016 16:46:10 -  1.131
+++ usb_subr.c  11 Mar 2017 15:12:08 -
@@ -254,9 +254,9 @@ usbd_devinfo_vp(struct usbd_device *dev,
product = usbd_get_string(dev, udd->iProduct, p, pl);
usbd_trim_spaces(product);
} else {
-   if (dev->vendor != NULL)
+   if (dev->vendor != NULL && *dev->vendor)
vendor = dev->vendor;
-   if (dev->product != NULL)
+   if (dev->product != NULL && *dev->product)
product = dev->product;
}
 #ifdef USBVERBOSE