Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp4634369ybc; Fri, 15 Nov 2019 07:42:17 -0800 (PST) X-Google-Smtp-Source: APXvYqw6aFxHPegP5oSz0opwbFc81t2bmNIib9jVq4eLeh/01LXZ5RK27HCgKpkyTp2K/gTTFyms X-Received: by 2002:a17:907:2070:: with SMTP id qp16mr1725625ejb.115.1573832537871; Fri, 15 Nov 2019 07:42:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573832537; cv=none; d=google.com; s=arc-20160816; b=PsEbUNVQPlFFlq5o9kclWoAEU1wSRlYSA6d00HVvFn8paPmYywjCyHk+FfUmP9xp5B acMY6NhojxQYikmKhVzlvOY/hoykMQU5krteq6h2l70OxesXnUb7oEZoJZpYtZhh6sI+ ZIiicpwHHmmFDN1fvwSnKT5JvzLXDMwXV/ju+a+F0xoUiSq8jrw896a0jFNKiQuJoWqc AjIUlnj5VLmg1+lK7Ycm8zLkLTW62sYmJoMFOPv40EUvAeFUPgaltbgPmzyAulSk4mVU lt9mkldbFVWNvQAkRJN6jCtdVNLxef2Km/wf4QpGzTWK+IzQjVYlHqoUAiZBzjF65Yqw YObQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to :subject:cc:to:from:date; bh=6zHQ0RlsDskrW2ysYL0/aUHykoWnVAoOaeypH2zJLfw=; b=wQYol6v8oCI1v0dDoNx7Gq7Nbr9qFrMsG65PxqPSQadnnGj0wc+yzgGc94M9xrQQAc ZImkBrLNsQM/9JRg1cRR3rGbqQXwN/DhElvQKrP/TH8O+WkTrrn5fZsSyw7dRtqK7wO/ Rmdve++Mn3kecoQ3AYD4SC0qSxJ54EqigFRdL30igQDUqIw/VN7zAECxCkLxGtywDh5h 4MOEakiqTxoZfGJ+3jKc0XMnzjlsEwUJNAGYwlGZNaGM5TQxpT51EDBjaTCDEC/Ty4Jv nLWyodI+ktpvuqi1Xt4eRJ0IkOYAgmRRm9FMeQX761+STEd3IXZq9CstXs0ptIuKh5Jk 15RA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f22si6273834eds.54.2019.11.15.07.41.52; Fri, 15 Nov 2019 07:42:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727576AbfKOPim (ORCPT + 99 others); Fri, 15 Nov 2019 10:38:42 -0500 Received: from iolanthe.rowland.org ([192.131.102.54]:54192 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1727540AbfKOPil (ORCPT ); Fri, 15 Nov 2019 10:38:41 -0500 Received: (qmail 1740 invoked by uid 2102); 15 Nov 2019 10:38:40 -0500 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 15 Nov 2019 10:38:40 -0500 Date: Fri, 15 Nov 2019 10:38:40 -0500 (EST) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Andrey Konovalov cc: linux-usb@vger.kernel.org, , Greg Kroah-Hartman , Jonathan Corbet , Felipe Balbi , Dmitry Vyukov , Alexander Potapenko , Marco Elver Subject: Re: [PATCH v2 1/1] usb: gadget: add raw-gadget interface In-Reply-To: <92f5a2a1ba986f149aecec02d6ffe110d11dcdfd.1573824989.git.andreyknvl@google.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > --- /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 > + */ > + > +#define pr_fmt(fmt) "raw: %s: " fmt, __func__ This macro isn't used anywhere now. Alan Stern