From patchwork Tue Jul 3 18:23:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry Zhang X-Patchwork-Id: 10504943 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 2665C6035E for ; Tue, 3 Jul 2018 18:23:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 13DA71FF7F for ; Tue, 3 Jul 2018 18:23:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0818B205F8; Tue, 3 Jul 2018 18:23:54 +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 A57421FF7F for ; Tue, 3 Jul 2018 18:23:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934710AbeGCSXu (ORCPT ); Tue, 3 Jul 2018 14:23:50 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:35718 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934693AbeGCSXr (ORCPT ); Tue, 3 Jul 2018 14:23:47 -0400 Received: by mail-pl0-f66.google.com with SMTP id k1-v6so1427023plt.2 for ; Tue, 03 Jul 2018 11:23:47 -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=PQ7g89FYKLS+nCCfr5oiPN+WHSM2suvzSNRU7LHHhwM=; b=DjT6KYOWzvYTcIcTJrVHgzroVPFYuLXWRndvOF1WdaMPrFXjhY6bMBdIg+k52RjGjI tg8Q9BzadWVBQH+e+EVrWlmZ00I+u/l7PDDCt/ymhkfMW9KIoCV/dn4oLJdWThgIiigH z9E4ddvoDBkVgFRq5GLXLSHC5QLPP0XZ9Fo0FUNn7wh6mh7VKxjB4Q3wdugQN3HesRJ0 BKpdP7FR9SCwQlpWfNS3OeZ87QkGMZ+zeCh6YusWR5WqcqRprHJEDMS/jMKY+3BuMEUZ fhshzVTRr9FzITB3wBXq1XEgLjEZ66Hn40Pwnb9wPhhoV3KsA36xcreC4V4xAO0GpcfS vvCw== 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=PQ7g89FYKLS+nCCfr5oiPN+WHSM2suvzSNRU7LHHhwM=; b=foR1EbggEnGVbM4gIXW9xOzkIoKhaVaRXvyu9QS4qdh/S2S9uiVDKJfoD6YAR/5z8P 2GAm3aoWe4zKt1qYItj7kMdJ1LMypb2mz6+XlxcwI9e1D8YoQO2fMGNxP6gpsorNw5Nx VelrGfXVuQudUvfsaOZdzGkFDHRpq1RXfEwKNO4k/jWPWprAJDS6AD/paR/n63RhXTrS SdcdMX2yXsfbYHfOn+r/Ymk/W9va6cvqBJT65Y9Mpdz2o767MkstlZo4IP8zRr1hqEfh +rWM+L8x9RhBv4N64rHhjI6VRb3V2kAMBF9E3j6fDveyZUa/UDFGssu8kuEfoDVLxZ2k cfRg== X-Gm-Message-State: APt69E22P2CwuWsYN9ZqrmGYzQ2uAWOaFRRlWqYwsH5zdr7FG6UzqcHd +pVA0k69wPGCh913Rf8Hwx256zzjbBA= X-Google-Smtp-Source: ADUXVKIMaN97HmRd3xn57SY7m/EhoLB3Q3d3HRo9sU5d8mmeVXM6GVK+7HKxTfJU0pnKQRyg/KFIHg== X-Received: by 2002:a17:902:15a8:: with SMTP id m37-v6mr31331519pla.219.1530642226605; Tue, 03 Jul 2018 11:23:46 -0700 (PDT) Received: from zhangjerry.mtv.corp.google.com ([2620:0:1000:1611:ee20:2649:babf:1d14]) by smtp.gmail.com with ESMTPSA id j21-v6sm3052992pfn.121.2018.07.03.11.23.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Jul 2018 11:23:46 -0700 (PDT) From: Jerry Zhang To: Felipe Balbi , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, zhangjerry@google.com, jerryxzha@gmail.com, android-kernel-team@google.com Subject: [PATCH V2 3/3] Documentation: usb: Add docs for configfs control requests Date: Tue, 3 Jul 2018 11:23:33 -0700 Message-Id: <20180703182333.47964-3-zhangjerry@google.com> X-Mailer: git-send-email 2.18.0.399.gad0ab374a1-goog In-Reply-To: <20180703182333.47964-1-zhangjerry@google.com> References: <20180703182333.47964-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 Add explanation and examples of how to set up control request handling with configfs. Signed-off-by: Jerry Zhang --- Changes in V2: Added changelog text 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. +