From owner-freebsd-usb@FreeBSD.ORG Thu Mar 24 11:30:03 2005 Return-Path: Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A0E9116A4CE for ; Thu, 24 Mar 2005 11:30:03 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 13AB343D55 for ; Thu, 24 Mar 2005 11:30:03 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j2OBU2j9074157 for ; Thu, 24 Mar 2005 11:30:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j2OBU200074156; Thu, 24 Mar 2005 11:30:02 GMT (envelope-from gnats) Resent-Date: Thu, 24 Mar 2005 11:30:02 GMT Resent-Message-Id: <200503241130.j2OBU200074156@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-usb@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, hselasky@c2i.net Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D012616A4CE for ; Thu, 24 Mar 2005 11:20:04 +0000 (GMT) Received: from swip.net (mailfe03.swip.net [212.247.154.65]) by mx1.FreeBSD.org (Postfix) with ESMTP id 02B1243D2F for ; Thu, 24 Mar 2005 11:20:04 +0000 (GMT) (envelope-from hselasky@c2i.net) Received: from mp-217-204-198.daxnet.no ([193.217.204.198] verified) by mailfe03.swip.net (CommuniGate Pro SMTP 4.2.9) with ESMTP id 129943786 for FreeBSD-gnats-submit@freebsd.org; Thu, 24 Mar 2005 12:20:01 +0100 Message-Id: <200503241220.49524.hselasky@c2i.net> Date: Thu, 24 Mar 2005 12:20:48 +0100 From: Hans Petter Selasky To: FreeBSD-gnats-submit@FreeBSD.org Subject: usb/79190: usbd_get_string_desc() is called with the wrong lang ID X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: hselasky@c2i.net List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Mar 2005 11:30:03 -0000 >Number: 79190 >Category: usb >Synopsis: usbd_get_string_desc() is called with the wrong lang ID >Confidential: no >Severity: critical >Priority: medium >Responsible: freebsd-usb >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Mar 24 11:30:02 GMT 2005 >Closed-Date: >Last-Modified: >Originator: HPS >Release: FreeBSD 6.0-CURRENT i386 >Organization: >Environment: System: FreeBSD 6.0-CURRENT FreeBSD 6.0-CURRENT #45: Mon Mar 21 15:40:17 CET 2005 root@:/usr/obj/usr/src/sys/custom i386 >Description: In the file "/sys/dev/usb/uhub.c" in the function "uhub_child_pnpinfo_str" usbd_get_string_desc() is called with the wrong language parameter (0). This [invalid] request causes some devices not to work at all! >How-To-Repeat: >Fix: The solution is to call usbd_get_string() which will setup the correct language parameter, instead of usbd_get_string_desc() --- uhub.c.ref Thu Mar 24 12:07:36 2005 +++ uhub.c Thu Mar 24 12:15:12 2005 @@ -664,13 +664,11 @@ struct uhub_softc *sc = device_get_softc(cbdev); usbd_device_handle devhub = sc->sc_hub; usbd_device_handle dev; - usb_string_descriptor_t us; struct usbd_interface *iface; char serial[128]; int nports; int port; - int i, j, size; - int err; + int i; nports = devhub->hub->hubdesc.bNbrPorts; for (port = 0; port < nports; port++) { @@ -688,18 +686,10 @@ return (0); found_dev: - j = 0; + serial[0] = '\0'; if (dev->ddesc.iSerialNumber != 0) { - err = usbd_get_string_desc(dev, dev->ddesc.iSerialNumber, 0, - &us, &size); - if (err == 0) { - do { - serial[j] = UGETW(us.bString[j]); - j++; - } while (j < ((us.bLength - 2) / 2)); - } + (void) usbd_get_string(dev, dev->ddesc.iSerialNumber, &serial[0]); } - serial[j] = '\0'; if (dev->ifacenums == NULL) { snprintf(buf, buflen, "vendor=0x%04x product=0x%04x " "devclass=0x%02x devsubclass=0x%02x " Here is another bugfix: *** sys/dev/usb/umass.c.ref Wed Nov 17 18:56:27 2004 --- sys/dev/usb/umass.c Thu Dec 2 12:39:51 2004 *************** *** 110,115 **** --- 110,116 ---- #include #include #include + #include #include #include *************** *** 928,934 **** #endif if (sc->quirks & ALT_IFACE_1) { ! err = usbd_set_interface(0, 1); if (err) { DPRINTF(UDMASS_USB, ("%s: could not switch to " "Alt Interface %d\n", --- 929,935 ---- #endif if (sc->quirks & ALT_IFACE_1) { ! err = usbd_set_interface(uaa->iface, 1); if (err) { DPRINTF(UDMASS_USB, ("%s: could not switch to " "Alt Interface %d\n", >Release-Note: >Audit-Trail: >Unformatted: