Re: URB completion order, normal behavior or bug?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06/25/2013 05:42 PM, Daniel Santos wrote:
On 06/25/2013 09:45 AM, Alan Stern wrote:
static __always_inline int init_endpoint(struct mcp2210_device *dev,
                       const struct usb_host_endpoint *ep)
{
      int is_dir_in = !!usb_endpoint_dir_in(&ep->desc);
      struct mcp2210_endpoint_proxy *dest;
      unsigned int pipe;
      usb_complete_t complete_fn;
      struct urb *urb;

      if (is_dir_in) {
          dest = &dev->in;
          pipe = usb_sndintpipe(dev->udev, ep->desc.bEndpointAddress);
          complete_fn = urb_complete_in;
      } else {
          dest = &dev->out;
          pipe = usb_rcvintpipe(dev->udev, ep->desc.bEndpointAddress);
          complete_fn = urb_complete_out;
      }
      dest->is_dir_in = is_dir_in;
So you're assigning an OUT pipe value to the "in" proxy and vice versa.
But the OUT pipe uses the endpoint number of the IN endpoint, and vice
versa.

This might work if the two endpoints have the same number (for example,
if the OUT endpoint's address is 0x02 and the IN endpoint's address is
0x82).  However, it certainly isn't what you should be doing!

I guess we should add a check to the debugging code, to make sure the
pipe's direction matches the endpoint's direction.

Very interesting, since the inverse doesn't work -- well at least on the Pi. That's making me suspect that it wasn't working because I simply encountered another bug in the USB host controller driver -- that's very, very, very, weird. I'll re-test this on my workstation.

Ahh well, it works both ways on the pi & my workstation, so I must have screwed something else up on those early tests. Thanks for the help on this!!

Daniel
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux