From patchwork Mon Jul 2 22:01:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry Zhang X-Patchwork-Id: 10502515 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5777760284 for ; Mon, 2 Jul 2018 22:01:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 474BF28C50 for ; Mon, 2 Jul 2018 22:01:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B5F328C52; Mon, 2 Jul 2018 22:01:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5B3F28C50 for ; Mon, 2 Jul 2018 22:01:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932300AbeGBWBf (ORCPT ); Mon, 2 Jul 2018 18:01:35 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:38947 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932276AbeGBWBe (ORCPT ); Mon, 2 Jul 2018 18:01:34 -0400 Received: by mail-pg0-f68.google.com with SMTP id n2-v6so7709360pgq.6 for ; Mon, 02 Jul 2018 15:01:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=REmX/po4PX8x0153RIaidtOnUkazU45mooW2toZakTc=; b=VuVaTpRCbGoXVKpJSOsoOZVA+XmKJ2ZiSCL6ySCmplemSqychoXfOFVPUarTC/46Zm R417Q8OZcSE5F6im2fScJ8mnNBUaAr1oHcGnnkd3MK7oI3eYhhVR1/syfmFtJD9e7K/Y XjBrY80RsITJ9/VOLadUmxO9dij7tUxiYEB720joKxsFAew+1SL+srGOc5UYtaLKmwed 160a/GA6thznUup0qqIOwo/nu4qKVkRXcUg97WBUHMi2K7DKQPnl8x2I1rJ4ISUAkwXA h4uGcYDvuFftkM1nS5AC+wAk2NmtO3QFAocnBUXEtlo3Bi70/8HDztKDCdKzs3yF4FmC Ml3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=REmX/po4PX8x0153RIaidtOnUkazU45mooW2toZakTc=; b=XcvKdZXApzsnQfwVKimGdc9OpIipqiXegJFWODNGoNpdTC/N8ZpK/ftWE6CbPZRYmw 7Vnv5002xHbBO66Nlfr25wvDhaXcR56PTt96WhG5gf4k2rdOrER4BJrtYFoWNL/XPs92 SX5iM6lvuKsLhCWnQ/zWdTgLAN2gEBOz4BEx5yXAAMdp4wuQNlSlqEk5ki2rbOi5oy6T 7bdjBl7RA6SpD6RQUJysHO8ogW28EjwyZYbF6snBq/4pgWbrLhrEJY2XsWSCT7vwnHOH bBi769FQyCb5LTJTRDOGokX+BBm0azbxBLeoqjnPBAduBoCKa/cP5NPpTC3Wlbi8WweS o7PA== X-Gm-Message-State: APt69E17Fi92pwXlt3KBpH6GsgHb7cmxTLJ6BohzjH1nCATvpm9DmRjb YZOJH9itcrBNMLnWLA18EV1jQA== X-Google-Smtp-Source: AAOMgpfBoHfuFIyUn/OihgoK/BseQr1SIgnPbIyEIDfFOj4SL4hS7IAm+TyV+TQeVUdGUNSr4Ji8CA== X-Received: by 2002:a63:a042:: with SMTP id u2-v6mr22811479pgn.80.1530568893688; Mon, 02 Jul 2018 15:01:33 -0700 (PDT) Received: from zhangjerry.mtv.corp.google.com ([2620:0:1000:1611:ee20:2649:babf:1d14]) by smtp.gmail.com with ESMTPSA id a8-v6sm33725469pfe.72.2018.07.02.15.01.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Jul 2018 15:01:32 -0700 (PDT) From: Jerry Zhang To: Felipe Balbi , Michal Nazarewicz , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, zhangjerry@google.com, jerryxzha@gmail.com, android-kernel-team@google.com Subject: [PATCH 3/3] Documentation: usb: Add docs for configfs control requests Date: Mon, 2 Jul 2018 15:01:03 -0700 Message-Id: <20180702220103.176398-4-zhangjerry@google.com> X-Mailer: git-send-email 2.18.0.399.gad0ab374a1-goog In-Reply-To: <20180702220103.176398-1-zhangjerry@google.com> References: <20180702220103.176398-1-zhangjerry@google.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Jerry Zhang --- Documentation/usb/gadget_configfs.txt | 34 +++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/Documentation/usb/gadget_configfs.txt b/Documentation/usb/gadget_configfs.txt index b8cb38a98c19..64f69dd3f123 100644 --- a/Documentation/usb/gadget_configfs.txt +++ b/Documentation/usb/gadget_configfs.txt @@ -285,6 +285,40 @@ e.g.: $ rmdir g1 +8. Handling control requests +-------------- + +A composite gadget with changing configurations may still want to handle +vendor control requests in a centralized location. In particular, functionfs +instances can pass control requests to user-space, but there is no +guarantee that a functionfs is in the current config. + +To handle this there is a special config in the root of the gadget +called control_config. Functions linked here do not appear in the +configuration, but will receive control requests. To use it: + +Create a special instance of functionfs. + +$ mkdir functions/ffs.ctrl + +Mount the functionfs instance and write descriptors. + +mount functionfs ctrl /dev/ffs-ctrl +# Write functionfs descriptors to /dev/ffs-ctrl/ep0 +# Descriptor header must include ALL_CTRL_RECIP AND CONTROL_ONLY +# and must *not* include any speed descriptors. + +Link the function into control config. + +$ ln -s functions/ffs.ctrl control_config/f1 + +Link normal functions into the appropriate config, and enable the gadget. + +$ echo > UDC + +Handle control requests in /dev/ffs-ctrl/ep0. +See functionfs documentation on how to do this. +