From owner-cvs-src@FreeBSD.ORG Fri Mar 26 01:47:14 2004 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CB75B16A4CE; Fri, 26 Mar 2004 01:47:13 -0800 (PST) Received: from srv1.cosmo-project.de (srv1.cosmo-project.de [213.83.6.106]) by mx1.FreeBSD.org (Postfix) with ESMTP id 217A943D31; Fri, 26 Mar 2004 01:47:13 -0800 (PST) (envelope-from ticso@cicely12.cicely.de) Received: from cicely5.cicely.de (cicely5.cicely.de [IPv6:3ffe:400:8d0:301:200:92ff:fe9b:20e7]) (authenticated bits=0) i2Q9kFUS067704 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK); Fri, 26 Mar 2004 10:46:17 +0100 (CET) (envelope-from ticso@cicely12.cicely.de) Received: from cicely12.cicely.de (cicely12.cicely.de [IPv6:3ffe:400:8d0:301::12]) by cicely5.cicely.de (8.12.10/8.12.10) with ESMTP id i2Q9jahn086537 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 26 Mar 2004 10:45:36 +0100 (CET) (envelope-from ticso@cicely12.cicely.de) Received: from cicely12.cicely.de (localhost [127.0.0.1]) by cicely12.cicely.de (8.12.11/8.12.11) with ESMTP id i2Q9ja83000878; Fri, 26 Mar 2004 10:45:36 +0100 (CET) (envelope-from ticso@cicely12.cicely.de) Received: (from ticso@localhost) by cicely12.cicely.de (8.12.11/8.12.11/Submit) id i2Q9jZBx000877; Fri, 26 Mar 2004 10:45:35 +0100 (CET) (envelope-from ticso) Date: Fri, 26 Mar 2004 10:45:35 +0100 From: Bernd Walter To: Julian Elischer Message-ID: <20040326094534.GA752@cicely12.cicely.de> References: <200403260839.i2Q8dbDj003900@repoman.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200403260839.i2Q8dbDj003900@repoman.freebsd.org> X-Operating-System: FreeBSD cicely12.cicely.de 5.2-CURRENT alpha User-Agent: Mutt/1.5.6i X-Spam-Status: No, hits=-4.9 required=3.0 tests=BAYES_00 autolearn=ham version=2.61 X-Spam-Report: * -4.9 BAYES_00 BODY: Bayesian spam probability is 0 to 1% * [score: 0.0000] X-Spam-Checker-Version: SpamAssassin 2.61 (1.212.2.1-2003-12-09-exp) on cicely5.cicely.de cc: cvs-src@freebsd.org cc: src-committers@freebsd.org cc: cvs-all@freebsd.org Subject: Re: cvs commit: src/sys/dev/usb usb_subr.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: ticso@cicely.de List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Mar 2004 09:47:14 -0000 On Fri, Mar 26, 2004 at 12:39:37AM -0800, Julian Elischer wrote: > julian 2004/03/26 00:39:37 PST > > FreeBSD src repository > > Modified files: (Branch: RELENG_4) > sys/dev/usb usb_subr.c > Log: > MFC 1.60->1.62 > MFC some diffs from NetBSD to improve probing of some troublesom > devices. Rev 1.61 broke the retry loop for first contact in that it added a new first transaction. The retry loop was required to improve probing of some USB devices and the included port reset was at least required for some bluetooth devices. Since the port reset also resets the device address to zero it can't help without setting the device address again. I asume the following should fix the current breakage, but I have none of such problematic device so I can't test if it still helps. Index: usb_subr.c =================================================================== RCS file: /home/ncvs/src/sys/dev/usb/usb_subr.c,v retrieving revision 1.62 diff -u -r1.62 usb_subr.c --- usb_subr.c 20 Mar 2004 07:31:11 -0000 1.62 +++ usb_subr.c 23 Mar 2004 08:46:28 -0000 @@ -1045,8 +1072,19 @@ up->device = dev; /* Set the address. Do this early; some devices need that. */ - err = usbd_set_address(dev, addr); + /* Try a few times in case the device is slow (i.e. outside specs.) */ DPRINTFN(5,("usbd_new_device: setting device address=%d\n", addr)); + for (i = 0; i < 15; i++) { + err = usbd_set_address(dev, addr); + if (!err) + break; + usbd_delay_ms(dev, 200); + if ((i & 3) == 3) { + DPRINTFN(-1,("usb_new_device: set address %d " + "failed - trying a port reset\n", addr)); + usbd_reset_port(up->parent, port, &ps); + } + } if (err) { DPRINTFN(-1,("usb_new_device: set address %d failed\n", addr)); err = USBD_SET_ADDR_FAILED; @@ -1059,16 +1097,8 @@ bus->devices[addr] = dev; dd = &dev->ddesc; - /* Try a few times in case the device is slow (i.e. outside specs.) */ - for (i = 0; i < 15; i++) { - /* Get the first 8 bytes of the device descriptor. */ - err = usbd_get_desc(dev, UDESC_DEVICE, 0, USB_MAX_IPACKET, dd); - if (!err) - break; - usbd_delay_ms(dev, 200); - if ((i & 3) == 3) - usbd_reset_port(up->parent, port, &ps); - } + /* Get the first 8 bytes of the device descriptor. */ + err = usbd_get_desc(dev, UDESC_DEVICE, 0, USB_MAX_IPACKET, dd); if (err) { DPRINTFN(-1, ("usbd_new_device: addr=%d, getting first desc " "failed\n", addr)); -- B.Walter BWCT http://www.bwct.de ticso@bwct.de info@bwct.de