From owner-freebsd-usb@FreeBSD.ORG Tue Jul 17 05:56:10 2007 Return-Path: X-Original-To: freebsd-usb@freebsd.org Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C4F3A16A400 for ; Tue, 17 Jul 2007 05:56:10 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe06.swip.net [212.247.154.161]) by mx1.freebsd.org (Postfix) with ESMTP id 5F98E13C481 for ; Tue, 17 Jul 2007 05:56:10 +0000 (UTC) (envelope-from hselasky@c2i.net) X-Cloudmark-Score: 0.000000 [] Received: from [194.248.135.20] (account mc467741@c2i.net HELO laptop.lan) by mailfe06.swip.net (CommuniGate Pro SMTP 5.1.10) with ESMTPA id 548556394; Tue, 17 Jul 2007 07:56:09 +0200 From: Hans Petter Selasky To: "Xiaofan Chen" Date: Tue, 17 Jul 2007 07:56:12 +0200 User-Agent: KMail/1.9.5 References: <200707151118.28211.hselasky@c2i.net> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200707170756.12950.hselasky@c2i.net> Cc: freebsd-usb@freebsd.org Subject: Re: libusb usb_interrupt_read hangs under FreeBSD 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: Tue, 17 Jul 2007 05:56:10 -0000 On Monday 16 July 2007 17:44, Xiaofan Chen wrote: > On 7/15/07, Hans Petter Selasky wrote: > > > 2) For the host, how does it know that the buffer data is still correct > > > if the buffer is not cleared? > > > > Clear stall should only clear the data toggle! > > > > You need a second control command to reset the buffers and/or the > > protocol! > > > > > 2) What cause the stall to happen in the first place? > > > > It is either a wrong data-toggle bit or a protocol error. The device can > > send stall at any time! > > Thanks a lot for the detailed explanation. > > If it is a protocol error for the control endpoint 0 (EP0), the host will > not need to send a clear stall feature request to EP0. Yes, that is correct, because the data toggle is reset to 0 starting at the SETUP packet which uses a separate PID. > Even if it is sent > (shall we consider it a bug of the USB stack if that is the case?), the > current PICkit 2 firmware will filter out it and ignore it. No, that is not a bug. > > So I think we can narrow it down to the wrong data-toggle bit. I will > dig further. I'd like to convince the PICKit 2 firmware developer > that something is wrong even though it is now working under > FreeBSD. Could we see the reason for the stall from the following > USB log? Imagine you abort your program and start it again. Then outstanding data in the device FIFOs should be removed first! Then you clear the stall. Clearing of stall, should not clear the data in the buffers! These two events are independent! > > I am using the alternative stack from Hans and 6.2 Stable version. So > maybe there is a difference here. > With some modifications. --HPS