kern/56097: Empty vendor string overrides known

Hal Burch hburch at lumeta.com
Thu Aug 28 13:20:17 PDT 2003


>Number:         56097
>Category:       kern
>Synopsis:       Empty vendor string overrides known
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 28 13:20:13 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Hal Burch <hburch at lumeta.com>
>Release:        FreeBSD 4.9-PRERELEASE i386
>Organization:
Lumeta Corporation
>Environment:
FreeBSD hburch-lap.hburch.com 4.9-PRERELEASE FreeBSD 4.9-PRERELEASE #23: Thu Aug 28 15:03:26 EDT 2003     root at hburch-lap.hburch.com:/usr/src/sys/compile/LOCAL  i386
>Description:
Bought a USB "Pen Drive lite 2.0" (128MB).  Plugged in.  Reported as:
# usbdevs -v
Controller /dev/usb0:
addr 1: self powered, config 1, UHCI root hub(0x0000), Intel(0x0000), rev 1.00
 port 1 addr 2: power 500 mA, config 1, USB DISK 2.0(0x1300), (0x0d7d), rev 0.50
 port 2 powered

Added lines to usbdevs:
vendor APACER           0x0d7d  Apacer
product APACER PENDRIVE         0x1300 USB Pen Drive 2.0

No change to output after rebuilding (including make -f Makefile.usbdevs)

>How-To-Repeat:
See description.
>Fix:
usbd_devinfo_vp() is getting an empty string from its  usbd_get_string()
call on the vendor, instead of NULL.  This means usb_knowndevs in not
consulted.

Add lines between grabbing those char *s and the USBVERBOSE ifdef to
set vendor to NULL if it is the empty string (similarly for product).

This causes vendor to be filled-out, although the product name read
overrules usb_knowndevs (this appears to be a conscience decision made
by the NetBSD folks):
# usbdevs -v
Controller /dev/usb0:
addr 1: self powered, config 1, UHCI root hub(0x0000), Intel(0x0000), rev 1.00
 port 1 addr 2: power 500 mA, config 1, USB DISK 2.0(0x1300), Apacer(0x0d7d), rev 0.50
 port 2 powered

Patch against usb_subr.c 1.23.2.8 (although only minor changes appear
needed for 1.57, I do not have a 5.x box):
*** /tmp/usb_subr.c     Thu Aug 28 16:05:34 2003
--- ./usb_subr.c        Thu Aug 28 16:06:15 2003
***************
*** 229,234 ****
--- 229,238 ----
  
        vendor = usbd_get_string(dev, udd->iManufacturer, v);
        product = usbd_get_string(dev, udd->iProduct, p);
+       if (vendor && !*vendor)
+               vendor = NULL;
+       if (product && !*product)
+               product = NULL;
  #ifdef USBVERBOSE
        if (vendor == NULL || product == NULL) {
                for(kdp = usb_knowndevs;
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list