linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrey Konovalov <andreyknvl@google.com>
To: Alan Stern <stern@rowland.harvard.edu>
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: Tue, 18 Jun 2019 15:31:30 +0200	[thread overview]
Message-ID: <CAAeHK+xDZEc_Qxfj8xoht0Tn-4ANVAtd=Xj-oYPU53EQq1J5Og@mail.gmail.com> (raw)
In-Reply-To: <CAAeHK+yoEVJDQJCp0gXjX2t+QT_c-CqR+NnhtTTYOg6aj=MhQA@mail.gmail.com>

On Fri, Jun 7, 2019 at 5:05 PM Andrey Konovalov <andreyknvl@google.com> wrote:
>
> On Fri, Jun 7, 2019 at 5:02 PM Alan Stern <stern@rowland.harvard.edu> wrote:
> >
> > On Fri, 7 Jun 2019, Andrey Konovalov wrote:
> >
> > > > > The problem is that I want to receive that data (from the data stage)
> > > > > from within my gadget driver module. But it's not passed to the
> > > > > setup() callback. And the question is: how do I do that then?
> > > >
> > > > I just caught up on this thread...
> > > >
> > > > The answer is simple: The gadget driver's setup() callback routine
> > > > submits a request for endpoint 0.  The Data Stage data is sent or
> > > > received (depending on the direction encoded in the Setup information)
> > > > by this request.
> > >
> > > Ah, OK, got it, thanks!
> > >
> > > Although while looking at the dummy_hcd implementation, I saw that it
> > > accesses usb->transfer_buffer in case USB_REQ_GET_STATUS in
> > > handle_control_request(), which is called right before the setup()
> > > callback is called. So the data already available there without any
> > > additional requests. Is this an implementation detail that is specific
> > > to dummy_hcd?
> >
> > Yes, it is.  dummy-hcd is unusual in that it combines both a USB host
> > controller and a USB device controller in a single driver.
> >
> > Normal UDC drivers do handle USB_REQ_GET_STATUS on their own without
> > requiring the use of an explicit usb_request, because they handle the
> > entire transfer internally and don't involve the gadget driver.
> > However, they don't have access to any transfer_buffer; all they can do
> > is exchange packets with the host.
>
> OK, I see. Thanks a lot!

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?

>
> >
> > Alan Stern
> >

  reply	other threads:[~2019-06-18 13:31 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 [this message]
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

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='CAAeHK+xDZEc_Qxfj8xoht0Tn-4ANVAtd=Xj-oYPU53EQq1J5Og@mail.gmail.com' \
    --to=andreyknvl@google.com \
    --cc=dvyukov@google.com \
    --cc=felipe.balbi@linux.intel.com \
    --cc=glider@google.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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).