From owner-freebsd-usb@FreeBSD.ORG Sat Feb 7 14:02:42 2009 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D697106564A for ; Sat, 7 Feb 2009 14:02:42 +0000 (UTC) (envelope-from bruce@cran.org.uk) Received: from muon.cran.org.uk (brucec-1-pt.tunnel.tserv4.nyc4.ipv6.he.net [IPv6:2001:470:1f06:c09::2]) by mx1.freebsd.org (Postfix) with ESMTP id D22398FC17 for ; Sat, 7 Feb 2009 14:02:41 +0000 (UTC) (envelope-from bruce@cran.org.uk) Received: from muon.cran.org.uk (localhost [127.0.0.1]) by muon.cran.org.uk (Postfix) with ESMTP id A972719014 for ; Sat, 7 Feb 2009 09:02:40 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on muon X-Spam-Level: X-Spam-Status: No, score=-2.5 required=8.0 tests=AWL,BAYES_00,NO_RELAYS autolearn=ham version=3.2.5 Received: from gluon (unknown [IPv6:2a01:348:10f:0:240:f4ff:fe57:9871]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by muon.cran.org.uk (Postfix) with ESMTPSA for ; Sat, 7 Feb 2009 09:02:40 -0500 (EST) Date: Sat, 7 Feb 2009 14:02:28 +0000 From: Bruce Cran To: freebsd-usb@freebsd.org Message-ID: <20090207140228.7d549c53@gluon> X-Mailer: Claws Mail 3.5.0 (GTK+ 2.14.4; i486-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: usb_reset, libusb20_compat01 and USB2 X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Feb 2009 14:02:42 -0000 I've been working to port dfu-util, OpenMoko's USB DFU application, to FreeBSD to work under USB2. One problem I've found is that the device starts out in Runtime Mode so dfu-util calls usb_reset to put it into DFU mode; it seems to expect usb_reset to cause the system to detach and reattach the device, but this doesn't happen. As a result usb_find_devices always returns 0 which triggers a warning; also, since usb_reset causes the device to disappear on Linux dfu-util doesn't call usb_close after resetting since the handle has become invalid. A side-effect of this is that on FreeBSD a duplicate device appears when doing a second enumeration pass. Since dfu-util only expects to see a single DFU-capable device it bails out, and it becomes necessary to run it again for it to download the firmware (since the phone is now already in DFU mode). Is this a problem with the expectations of dfu-util, or should calling usb_reset invalidate the device handle and cause the device to re-attach? -- Bruce Cran