From hburch@lumeta.com  Thu Aug 28 13:13:31 2003
Return-Path: <hburch@lumeta.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id AC39716A4BF
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 28 Aug 2003 13:13:31 -0700 (PDT)
Received: from exgw2.lumeta.com (exgw4.lumeta.com [65.246.240.66])
	by mx1.FreeBSD.org (Postfix) with ESMTP id B5EB943FE0
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 28 Aug 2003 13:13:30 -0700 (PDT)
	(envelope-from hburch@lumeta.com)
Received: from lucy.corp.lumeta.com (h65-246-245-10.lumeta.com [65.246.245.10])
	by exgw2.lumeta.com (Postfix) with ESMTP id 5323F373865
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 28 Aug 2003 16:13:30 -0400 (EDT)
Received: from localhost (localhost.corp.lumeta.com [127.0.0.1])
	by lucy.corp.lumeta.com (Postfix) with ESMTP id 33DD4A8938
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 28 Aug 2003 16:13:30 -0400 (EDT)
Received: from lucy.corp.lumeta.com ([127.0.0.1])
 by localhost (lucy.corp.lumeta.com [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id 09212-04 for <FreeBSD-gnats-submit@freebsd.org>;
 Thu, 28 Aug 2003 16:13:29 -0400 (EDT)
Received: from hburch.corp.lumeta.com (hburch.corp.lumeta.com [65.246.246.59])
	by lucy.corp.lumeta.com (Postfix) with ESMTP id AE4C9A8934
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 28 Aug 2003 16:13:29 -0400 (EDT)
Received: by hburch.corp.lumeta.com (Postfix, from userid 2007)
	id 65A42256; Thu, 28 Aug 2003 16:13:28 -0400 (EDT)
Message-Id: <20030828201328.65A42256@hburch.corp.lumeta.com>
Date: Thu, 28 Aug 2003 16:13:28 -0400 (EDT)
From: Hal Burch <hburch@lumeta.com>
Reply-To: Hal Burch <hburch@lumeta.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: Empty vendor string overrides known
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         56097
>Category:       kern
>Synopsis:       Empty vendor string overrides known
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 28 13:20:13 PDT 2003
>Closed-Date:    Sun Jan 18 04:47:10 PST 2004
>Last-Modified:  Sun Jan 18 04:47:10 PST 2004
>Originator:     Hal Burch <hburch@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@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:
State-Changed-From-To: open->closed 
State-Changed-By: sanpei 
State-Changed-When: Sun Jan 18 04:46:33 PST 2004 
State-Changed-Why:  
Commited src/sys/dev/usb/usb_subr.c rev.1.58, Thanks. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=56097 
>Unformatted:
