I have found some erroneous behaviour in the usb-uhci driver while
trying to debug a problem with the Keyspan USB serial adaptor driver.
The problem relates to data toggles on transfers to/from bulk
endpoints which get cancelled before they complete. Briefly, what
happens is that if you submit an urb for a transfer to/from a bulk
endpoint, then cancel it before any data is transferred, and submit
another urb for a transfer to/from the same endpoint, the second
transfer will use the opposite data toggle from the first, whereas in
fact it should use the same data toggle. (I am assuming a transfer
that is small enough to fit into a single data packet.)
(The ohci driver doesn't seem to have this problem, I presume because
the hardware maintains the toggle bit in the endpoint descriptor and
only toggles it when data is actually transferred.)
The scenario is this: the serial adaptor has several bulk endpoints,
one of which is used for sending received characters to the host. The
keyspan driver submits an urb for reading from this endpoint when the
corresponding tty device is opened. This transfer doesn't complete
until the serial adaptor has some characters to send - the driver then
processes those characters and submits another urb to receive more
characters. When the tty device is closed, the pending receive urb is
cancelled with usb_unlink_urb.
What this means is that if you close and re-open the serial port, you
miss the first packet of characters from the adaptor, because the uhci
code is expecting the wrong data toggle. I don't know exactly how to
fix it as I am not familiar with the uhci code, but it seems to me to
be wrong to be calling usb_dotoggle in uhci_submit_bulk_urb; surely
usb_dotoggle should only be called when we know that a TD has
completed successfully? (Yes of course the TDs need to be set up with
alternating toggles; we would need to call usb_gettoggle for the first
and then alternate them.)
Paul.
--
Paul Mackerras, Open Source Research Fellow, Linuxcare, Inc.
+61 2 6262 8990 tel, +61 2 6262 8991 fax
[EMAIL PROTECTED], http://www.linuxcare.com.au/
Linuxcare. Putting Open Source to work.
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
http://lists.sourceforge.net/lists/listinfo/linux-usb-devel