Date: Sat, 11 Aug 2007 12:45:56 +0800 From: "Xiaofan Chen" <xiaofanc@gmail.com> To: "Hans Petter Selasky" <hselasky@c2i.net> Cc: freebsd-usb@freebsd.org Subject: Re: libusb usb_interrupt_read hangs under FreeBSD Message-ID: <a276da400708102145v1e4d317bxbc2cfc105790b68a@mail.gmail.com> In-Reply-To: <200707151118.28211.hselasky@c2i.net> References: <a276da400704030427g6fcfdc37u43bdf0fd1cd69ea8@mail.gmail.com> <200707091835.50445.hselasky@c2i.net> <a276da400707131533h4fb77751r2a288007887438a0@mail.gmail.com> <200707151118.28211.hselasky@c2i.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On 7/15/07, Hans Petter Selasky <hselasky@c2i.net> 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. <quote> "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." </quote> Is this the possible reason causing the STALL? Xiaofan
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?a276da400708102145v1e4d317bxbc2cfc105790b68a>