linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: Andrey Konovalov <andreyknvl@google.com>
Cc: Felipe Balbi <felipe.balbi@linux.intel.com>,
	USB list <linux-usb@vger.kernel.org>,
	Alexander Potapenko <glider@google.com>,
	Dmitry Vyukov <dvyukov@google.com>
Subject: Re: Pass transfer_buffer to gadget drivers
Date: Fri, 28 Jun 2019 14:07:15 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.44L0.1906281403020.1335-100000@iolanthe.rowland.org> (raw)
In-Reply-To: <CAAeHK+wVdjCein2rtWVYTq5Cp9jf0pcVSEvyWHYKDEh78-1xrg@mail.gmail.com>

On Fri, 28 Jun 2019, Andrey Konovalov wrote:

> On Fri, Jun 28, 2019 at 6:44 PM Andrey Konovalov <andreyknvl@google.com> wrote:
> >
> > On Tue, Jun 18, 2019 at 3:53 PM Alan Stern <stern@rowland.harvard.edu> wrote:

...

> > > > > Another question: do I understand correctly, that we only proceed with
> > > > > submitting an URB to get the data for the control OUT request
> > > > > (ctrl->bRequestType doesn't have the USB_DIR_IN bit set) if
> > > > > ctrl->wLength != 0?
> > >
> > > That's right.  If a control-OUT transfer has wLength == 0, it means
> > > there is no data stage.  (And control-IN transfers are not allowed to
> > > have wLength == 0.)
> >
> > And another one to clarify :)
> >
> > So if we got a setup() callback, which denotes:
> > 1. an IN transfer, we need to submit an URB with response (even if
> > wLength == 0). When it completes, the transaction is over, and we will
> > get the next setup() callback (if there's going to be any).

Yes, except that wLength should never be 0 for an IN transfer.  If it 
is, it's a bug in the host.

> > 2. an OUT transfer, we need to submit an URB to fetch the data (even
> > if wLength == 0).
> 
> Or more like: to fetch the data when wLength != 0 and to acknowledge
> the request when wLength == 0.
> 
> > When it completes, the transaction is over, and we
> > will get the next setup() callback (if there's going to be any).
> >
> > Is the above correct?

Correct.

There has been some discussion (and a few patches posted) about
modifying this approach.  But for now, this is the way to do it.

Alan Stern


      reply	other threads:[~2019-06-28 18:07 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-07 11:44 Pass transfer_buffer to gadget drivers Andrey Konovalov
2019-06-07 12:02 ` Felipe Balbi
2019-06-07 12:14   ` Andrey Konovalov
2019-06-07 12:25     ` Felipe Balbi
2019-06-07 12:32       ` Andrey Konovalov
2019-06-07 12:43         ` Felipe Balbi
2019-06-07 12:45           ` Andrey Konovalov
2019-06-07 14:04             ` Alan Stern
2019-06-07 14:38               ` Andrey Konovalov
2019-06-07 15:02                 ` Alan Stern
2019-06-07 15:05                   ` Andrey Konovalov
2019-06-18 13:31                     ` Andrey Konovalov
2019-06-18 13:34                       ` Andrey Konovalov
2019-06-18 13:53                         ` Alan Stern
2019-06-19  6:36                           ` Felipe Balbi
2019-06-28 16:44                           ` Andrey Konovalov
2019-06-28 17:29                             ` Andrey Konovalov
2019-06-28 18:07                               ` Alan Stern [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.44L0.1906281403020.1335-100000@iolanthe.rowland.org \
    --to=stern@rowland.harvard.edu \
    --cc=andreyknvl@google.com \
    --cc=dvyukov@google.com \
    --cc=felipe.balbi@linux.intel.com \
    --cc=glider@google.com \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).