From patchwork Tue Apr 24 21:33:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry Zhang X-Patchwork-Id: 10361105 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 5A11A6038F for ; Tue, 24 Apr 2018 21:34:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4998A27F89 for ; Tue, 24 Apr 2018 21:34:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E25B28DD1; Tue, 24 Apr 2018 21:34:04 +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 D257B27F89 for ; Tue, 24 Apr 2018 21:34:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751037AbeDXVeC (ORCPT ); Tue, 24 Apr 2018 17:34:02 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:37612 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750735AbeDXVeB (ORCPT ); Tue, 24 Apr 2018 17:34:01 -0400 Received: by mail-pf0-f196.google.com with SMTP id p6so13345093pfn.4 for ; Tue, 24 Apr 2018 14:34:01 -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=op+LPSST5eq40I0CM0lTPFJ95fWWWYJclUv11Zci8Xg=; b=iTg3OCIG535ESze6eSpoNgvHhw00kuYtXw4M+aHyHnfVwlib1OnGqVLGm6K0sEjsTY pZJgI2+wOneKB2OvmoyJXok9cXbtMPQB0P7bb09qCqHvL9CvKztMSjzPHv0+8ZWsGXZc pyPY80/SLS4TcF/OAnGNAJRQIUdddi8m4MpY7G7G9fMnKogd/SGjRvQ6TuUwAchuuAZP 89dzs7HU8S7qfb7Bn/6kZVJYzH6miqpOMbli/ujxobtP0Gm2jqmZ7ZhM8pJDG7i0rkIQ 3RypDsJOk5YG+jLi0WEak/iDbkp1ofAm0ZifH5N6isi0Gi+CXkeZxUXU1599iPrALNLR dk9Q== 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=op+LPSST5eq40I0CM0lTPFJ95fWWWYJclUv11Zci8Xg=; b=MAIWoxashf7SpdyHr078kCclmnHMe31tNmaaFbAaxqOJ8vCsa6C6QO3QI0u2L0fU6b yihh8GZ+dfcnEPyKjoGQZWYwwPkc3NONQgM4oTulT/lzzfx7MiZZRzHroIzFVzSg78lM LdWh1S8yhI8cl/9U7hSn9JT8keBTm0/iN/rJFTa+BC5A3XSQyc4c5J1m8hBOSfoGCO1Z 8SRNCMLcm1xrvMLMQTmyz2iM2aznxDchLGFJpYYPUEdLOQvgOGsRiGV6wCkNnQ5JwgHq kECyW+R+oNIFfhwyjGnI5wrMV+2nlSt+5HKStk/c1YRU7kdXdb52ULImHJK/4qmzS+7o wKGw== X-Gm-Message-State: ALQs6tBn4wHNGCNCulmS8dbvRumwoBsSg2/KDZKzz8vbtAcPFebwYw24 2XZDbjYxJ8NfZPhkmtLi8ygylVG6i5mmcA== X-Google-Smtp-Source: AIpwx48LYt1DjbUF/wYvoVUPC+cMcxCtFrnI8DnNRvIkUpPPNfUQNSEVb37xPcE5gZusnm4MhxSdXw== X-Received: by 10.98.82.131 with SMTP id g125mr25229274pfb.198.1524605641019; Tue, 24 Apr 2018 14:34:01 -0700 (PDT) Received: from zhangjerry.mtv.corp.google.com ([2620:0:1000:1611:ee20:2649:babf:1d14]) by smtp.gmail.com with ESMTPSA id y17sm1171909pfl.19.2018.04.24.14.34.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Apr 2018 14:34:00 -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 , felixhaedicke@web.de, Jerry Zhang Subject: [PATCH V2 3/4] Documentation: usb: Add docs for configfs control requests Date: Tue, 24 Apr 2018 14:33:48 -0700 Message-Id: <20180424213348.178096-1-zhangjerry@google.com> X-Mailer: git-send-email 2.17.0.484.g0c8726318c-goog In-Reply-To: <20180417011045.183035-4-zhangjerry@google.com> References: <20180417011045.183035-4-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 --- Changes in V2: - Updated doc with the FUNCTIONFS_CONTROL_ONLY flag 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 635e57493709..964edc314ee2 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. +