From owner-freebsd-usb@FreeBSD.ORG Sat Aug 11 04:45:57 2007 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 50F3616A41B for ; Sat, 11 Aug 2007 04:45:57 +0000 (UTC) (envelope-from xiaofanc@gmail.com) Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.179]) by mx1.freebsd.org (Postfix) with ESMTP id 2B37313C480 for ; Sat, 11 Aug 2007 04:45:57 +0000 (UTC) (envelope-from xiaofanc@gmail.com) Received: by wa-out-1112.google.com with SMTP id k17so1167534waf for ; Fri, 10 Aug 2007 21:45:56 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Uj0XfMYgmhtwGwZGuTDk72XrA0hdji6gn0SePzEZrdFk58kt7xFQz4mhNbna2alatBr57dUoi9X/sC4b7kbt/KKBle/WfN5L83f5opBtu+/AxEaBw3VBBDIdontwKKIVz5MuXxanZ+x5b+62ZEpYHb8tvBxyvLiGkOOiAko4uVY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Aan6vpbWSFXNpRTss7ifruWoAvrTpopkDC4OIbTpQA43sdAH6p2QiBupjXPb9S4+cgr+OY5j29q2YSvBWSh1OykaLYQyAL2++ZimDkVT5mJfGe3s6Izk4O8HJg1BJZ9X8LAtCaVcyUV/Vk4x4G3NZtzsV2MpBGmzimIoOLHWjdE= Received: by 10.114.57.1 with SMTP id f1mr3222785waa.1186807556673; Fri, 10 Aug 2007 21:45:56 -0700 (PDT) Received: by 10.114.176.17 with HTTP; Fri, 10 Aug 2007 21:45:56 -0700 (PDT) Message-ID: Date: Sat, 11 Aug 2007 12:45:56 +0800 From: "Xiaofan Chen" To: "Hans Petter Selasky" In-Reply-To: <200707151118.28211.hselasky@c2i.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200707091835.50445.hselasky@c2i.net> <200707151118.28211.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: Sat, 11 Aug 2007 04:45:57 -0000 On 7/15/07, Hans Petter Selasky wrote: > On Saturday 14 July 2007 00:33, Xiaofan Chen wrote: > > Sorry that I have three more questions: > > 1) What is the correct method to correctly respond to clear halt feature > > request in the firmware so that it can still recover from the stall? > > The USB 2.0 specification is not very clear about what the clear-stall command > should do. It almost says that this is device dependant. > > I think that clear-stall should only clear the data-toggle ! It should not > clear any buffers. That should be done by a seperate control transfer. > > > 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! > I guess that the stall might be related to the different behavior of Linux and FreeBSD implementation. http://lists.alioth.debian.org/pipermail/libhid-discuss/2007-April/000121.html Charles Lepple mentioned the following. "The limitations that I have seen are due to different interpretations of interrupt requests. Linux usbfs submits one URB per libusb usb_interrupt_read/write request, and *BSD ugen seems to set up a recurring transfer (and libusb reads the buffer that is filled by those transfers). This is fine as long as the libusb client program reads the buffer fast enough, but it does not allow you to submit interrupt requests at a slower rate than the descriptor specifies in *BSD." Is this the possible reason causing the STALL? Xiaofan