All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrey Konovalov <andreyknvl@google.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: USB list <linux-usb@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jonathan Corbet <corbet@lwn.net>, Felipe Balbi <balbi@kernel.org>,
	Dmitry Vyukov <dvyukov@google.com>,
	Alexander Potapenko <glider@google.com>,
	Marco Elver <elver@google.com>
Subject: Re: [PATCH v2 1/1] usb: gadget: add raw-gadget interface
Date: Fri, 15 Nov 2019 17:04:42 +0100	[thread overview]
Message-ID: <CAAeHK+y6mStjFJ-S0eN5qhBmik87ZMtnteRQVmjVbNRWRjLQUg@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1911151036310.1527-100000@iolanthe.rowland.org>

On Fri, Nov 15, 2019 at 4:38 PM Alan Stern <stern@rowland.harvard.edu> wrote:
>
> On Fri, 15 Nov 2019, Andrey Konovalov wrote:
>
> > USB Raw Gadget is a kernel module that provides a userspace interface for
> > the USB Gadget subsystem. Essentially it allows to emulate USB devices
> > from userspace. Enabled with CONFIG_USB_RAW_GADGET. Raw Gadget is
> > currently a strictly debugging feature and shouldn't be used in
> > production.
> >
> > Raw Gadget is similar to GadgetFS, but provides a more low-level and
> > direct access to the USB Gadget layer for the userspace. The key
> > differences are:
> >
> > 1. Every USB request is passed to the userspace to get a response, while
> >    GadgetFS responds to some USB requests internally based on the provided
> >    descriptors. However note, that the UDC driver might respond to some
> >    requests on its own and never forward them to the Gadget layer.
> >
> > 2. GadgetFS performs some sanity checks on the provided USB descriptors,
> >    while Raw Gadget allows you to provide arbitrary data as responses to
> >    USB requests.
> >
> > 3. Raw Gadget provides a way to select a UDC device/driver to bind to,
> >    while GadgetFS currently binds to the first available UDC.
> >
> > 4. Raw Gadget uses predictable endpoint names (handles) across different
> >    UDCs (as long as UDCs have enough endpoints of each required transfer
> >    type).
> >
> > 5. Raw Gadget has ioctl-based interface instead of a filesystem-based one.
>
> ...
>
> > --- /dev/null
> > +++ b/Documentation/usb/raw-gadget.rst
>
> > +Userspace interface
> > +~~~~~~~~~~~~~~~~~~~
> > +
> > +To create a Raw Gadget instance open /sys/kernel/debug/usb/raw-gadget
> > +(debugfs should be enabled and mounted). Multiple raw-gadget instances
>
> Looks like the documentation hasn't kept up with the more recent
> changes to the driver.

Right, will fix in v3, thanks!

>
> > --- /dev/null
> > +++ b/drivers/usb/gadget/legacy/raw.c
> > @@ -0,0 +1,1057 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * USB Raw Gadget driver.
> > + * See Documentation/usb/raw-gadget.rst for more details.
> > + *
> > + * Andrey Konovalov <andreyknvl@gmail.com>
> > + */
> > +
> > +#define pr_fmt(fmt) "raw: %s: " fmt, __func__
>
> This macro isn't used anywhere now.

It's used internally by pr_debug(). I didn't remove all of the
debugging messages, I've left the ones that are printed in cases or
errors, since ftrace might not always help to distinguish between some
of those.

      reply	other threads:[~2019-11-15 16:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-15 13:37 [PATCH v2 0/1] usb: gadget: add raw-gadget interface Andrey Konovalov
2019-11-15 13:37 ` [PATCH v2 1/1] " Andrey Konovalov
2019-11-15 13:39   ` Andrey Konovalov
2019-11-15 15:38   ` Alan Stern
2019-11-15 16:04     ` Andrey Konovalov [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=CAAeHK+y6mStjFJ-S0eN5qhBmik87ZMtnteRQVmjVbNRWRjLQUg@mail.gmail.com \
    --to=andreyknvl@google.com \
    --cc=balbi@kernel.org \
    --cc=corbet@lwn.net \
    --cc=dvyukov@google.com \
    --cc=elver@google.com \
    --cc=glider@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.