From patchwork Tue Apr 17 01:17:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry Zhang X-Patchwork-Id: 10344131 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 B2E8260216 for ; Tue, 17 Apr 2018 01:18:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF8EB288FE for ; Tue, 17 Apr 2018 01:18:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A401828915; Tue, 17 Apr 2018 01:18:20 +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 463A8288FE for ; Tue, 17 Apr 2018 01:18:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751193AbeDQBSS (ORCPT ); Mon, 16 Apr 2018 21:18:18 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:32982 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751086AbeDQBSR (ORCPT ); Mon, 16 Apr 2018 21:18:17 -0400 Received: by mail-pg0-f67.google.com with SMTP id i194so4637159pgd.0 for ; Mon, 16 Apr 2018 18:18:17 -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=nDFLpCVrqTniHzOJG1ebMVYz34jQhMee04NplgTo/5k=; b=C6jwIZ7ksF6BE6IqvosgBEBOpjPvQpL+1XbBbTIEPzE0S6DGW8HGM/yf+CP6gdtU8b a9p9g9Gq/oXTGuohlRStYWLwWl1vxaQa6XerQPfXVN5YftOHmS5poS41rY8NvbJ4rZsy 3Xnl4H/qJ+KTGGvjoJOwQRPSNkC+D8V0xSWpvlar6L0bdhaYl8UhKr4yr5CYAmFBvQFs bK8YOOnWmwYdaRQWAjSJipve4J8HC13qdE55UcNWyqBSyZ3DjLM2kB8ikkG12xCDstbB A+WRK7GhnojotOmwlkxzLRK2wmakOA3J+2SHzWbzCtsz2ABGqSQLWhYtfcAAbehUHK7u RasQ== 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=nDFLpCVrqTniHzOJG1ebMVYz34jQhMee04NplgTo/5k=; b=WGDWWM12L4t8KOS1jzQ1cp6VVGhem3XRTw/ViZ5Nza1v5vEPdNthZ7FGGTP2YEj/Wv d1hbHgnRxxo6EjQnTrSmVrlgW0iO3SaloB+qRNg5hqGct9nDX+H+za0/hbxXxFM+YzoP dEs1gzt3qRu1qVfsiSgsOnWZcPL9VsGg45EnavAYGJVzmBQKliR/cjUH8qwetE4D3kc4 3aS/oAS2N3LWG+xP3PoSUynF3Xab+NgLV0jJf9lKhmaxq76JEAM78vL3lxpI3PIzLsiU tz5WxK5QsQnuaFwHBeg7U9SyD+PT3UF2NMlMl0r9WBJoZXPAV9mZa0V8tDcul3cTIx0A LH3Q== X-Gm-Message-State: ALQs6tCbl8d1IPae4NEClf8sPg9i2l+TlDMY/8UgpVPGlQ2RONjnkUxM NNXET5yZhoc56WCWPsG92bv9Gw== X-Google-Smtp-Source: AIpwx4+5XFB3/534999cu4OtGuSYS2zYXOBy5RuZhrlsgQwhdEIItdpqAoMwjp4AoHnXgCh3uHuxXw== X-Received: by 10.99.167.75 with SMTP id w11mr54502pgo.351.1523927896666; Mon, 16 Apr 2018 18:18:16 -0700 (PDT) Received: from zhangjerry.mtv.corp.google.com ([2620:0:1000:1611:ee20:2649:babf:1d14]) by smtp.gmail.com with ESMTPSA id x14sm12694919pgq.50.2018.04.16.18.18.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Apr 2018 18:18:16 -0700 (PDT) From: Jerry Zhang To: Felipe Balbi , Greg Kroah-Hartman , linux-usb@vger.kernel.org Cc: Michal Nazarewicz , Krzysztof Opasiak , Badhri Jagan Sridharan , Andrzej Pietrasiewicz , Lars-Peter Clausen , felixhaedicke@web.de, Jerry Zhang Subject: [PATCH 3/3] Documentation: usb: Add docs for configfs control requests Date: Mon, 16 Apr 2018 18:17:42 -0700 Message-Id: <20180417011742.192184-4-zhangjerry@google.com> X-Mailer: git-send-email 2.17.0.484.g0c8726318c-goog In-Reply-To: <20180417011742.192184-1-zhangjerry@google.com> References: <20180417011742.192184-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 | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/Documentation/usb/gadget_configfs.txt b/Documentation/usb/gadget_configfs.txt index 635e57493709..a50f16c8a4bb 100644 --- a/Documentation/usb/gadget_configfs.txt +++ b/Documentation/usb/gadget_configfs.txt @@ -285,6 +285,38 @@ 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 dummy functionfs descriptors to /dev/ffs-ctrl/ep0 +# Descriptors should include flag FUNCTIONFS_ALL_CTRL_RECIP + +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. +