RE: usb_release_interface() + usb_close() -> broke communication
Stephan Meyer <ste_meyer <at> web.de>
2004-11-09 18:51:48 GMT
"Martin Vaillancourt" <mvaillancourt <at> memoryexpertsinc.com> schrieb am 09.11.04 19:24:28:
>
> Hi,
>
> I do not believe that it is the SET_INTERFACE command send from the
> ReleaseInterface() that causes the problem.
>
> I think that it is the fact that the first DATA PID used after an
> usb_open() and ClaimInterface() is the DATA0! So if we send only
> 1xusb_bulk command to a device, Release&Close() without reset the device
> (Hardreset or softreset), next usb_bulk command after the usb_open() and
> ClaimInterface() will use again the DATA0 even if the device expects the
> DATA1. This is what I see with CATC.
>
> My solution, except if you have a better one to suggest, will be to keep
> tracking of the number of usb_bulk command send on each endpoint in my
> application. So before to ReleaseAndClose() the device, I will send a
> dummy usb_bulk command on DATA1 if required? This will set the device to
> expect the next usb_bulk command on DATA0.
>
> What do you think?
I think that the behavior of the host is correct.
From the specs v2.0, section 9.1.1.5:
"Before a USB devices function may be used, the device must be configured.
From the devices perspective, configuration involves correctly processing a
SetConfiguration() request with a non-zero configuration value. Configuring
a device or changing an alternate setting causes all of the status and configuration
values associated with endpoints in the affected interfaces to be set to their default values.
This includes setting the data toggle of any endpoint using data toggles to the value DATA0."
That means that the device has to reset the data toggle bit(s) whenever it
receives a valid SET_INTERFACE or SET_CONFIGURATION request. So it seems
as if your device firmware has a problem.
Stephan
> Do you know a Linux Kernel 2.6.x without this problem?
>
> Thank you again!
> Martin
>
> -----Original Message-----
> From: Johannes Erdfelt [mailto:johannes <at> erdfelt.com]
> Sent: Tuesday, November 09, 2004 13:07
> To: Martin Vaillancourt
> Cc: libusb-devel <at> lists.sourceforge.net
> Subject: Re: [Libusb-devel] usb_release_interface() + usb_close() ->
> broke communication
>
> On Tue, Nov 09, 2004, Martin Vaillancourt
> <mvaillancourt <at> memoryexpertsinc.com> wrote:
> > My 2 previous email seems too large!
> > Now, I know exactly the cause of the problem, so I do a resume...
> >
> > The Bulk Transaction with some data must toggle between the DATA PID
> > DATA0 and DATA1. (Ref USB Specification 1.1 or 2.0)
> >
> > So, when I Release the interface, do a usb_close, do a usb_open and
> > re-claim the interface, the software resend by default the usb bulk
> > command with the DATA0 even if the device is expecting it on the
> DATA1?
> >
> > Question: Is there a flag somewhere in LibUSB that keep tracking of
> the
> > DATA PID to used?
>
> libusb doesn't track anything to do with the data toggle. That is
> handled by the kernel in all cases.
>
> However, the SET_INTERFACE command is a control transaction that occurs
> on the default control pipe. Data toggles rules are fixed for control
> transfers, not to mention that the data toggle is per pipe.
>
> I don't see how the SET_INTERFACE could interfere, unless the device
> reset the data toggle when that occurs. I'll have to check the USB spec
> to see what behavior the spec defines in this case.
>
> JE
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Sybase ASE Linux Express Edition - download now for FREE
> LinuxWorld Reader's Choice Award Winner for best database on Linux.
> http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
> _______________________________________________
> Libusb-devel mailing list
> Libusb-devel <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/libusb-devel
________________________________________________________________
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt neu bei WEB.DE FreeMail: http://freemail.web.de/?mc=021193
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_idU88&alloc_id065&op=click