Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1238849imu; Wed, 23 Jan 2019 13:12:02 -0800 (PST) X-Google-Smtp-Source: ALg8bN6axGMvBmGEBK02lb3UpaT3TLM/zMwxsJ+WxbB/HCMl4MWHXuI+PlLdvd0FjOU/6UN59Q30 X-Received: by 2002:a17:902:720c:: with SMTP id ba12mr3893006plb.79.1548277922309; Wed, 23 Jan 2019 13:12:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548277922; cv=none; d=google.com; s=arc-20160816; b=Yz/PgWLa4ZbcGP4QMASegPbm+Y3ryXcbQ0L50nd9AdYeF9kgLGRtiXWLGF7bgwUMy4 AJ8SRWnZITQ6onixZ1MVwizPVnKJ4o/WmioP/m9r/RL8B2iL8I5IySk9ee0CLww0vm5n R8v4DqZqFEQW7LqEeKpvWzVGJJfH340/zQJfbkE+aFQS4p067jF93aVBPvV0MC/wI2sl +PnbHv78V+bUr/WSD797JHPvXnukkb1k7Ene6UWwPnMsCDimrBwD7q/hb0sUWkaEWLUn sfQqQB4Ri/ZR4WWYk/wKmdjuAhhT4YuYy+VTuM1E1MkMZnchpMMiQgUKIxfevJG5LDCa 5L/A== 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=riAgJU96Krh6i9Pdt24hVI9FookZXMSD9vNo3WXcN/U=; b=IiQad1DR5h5y4Spb/R2w3Fp/ObEg96zBgGNgpsqwJVKcBodZeZwdtvtptSsh6aEWgU ddxuh5jwN8Hp2AXr9V33OIieaqGENdXcb/IYjVOw4/BlpKjU3QSfubfnz5lxCOLtnqHh cI9vOOh5K3qUx5jteFxCrTxIEcqtHfWF+pySFKXonOjAY3hci10mxqCK890IzV9XkG9a wU25SgygXbV3B9aiMFBIdK5F1bUd6jrjiH71H48YbihrVucqFxnesaKdjQepZ0sCjB8i LTEYdsbjK8BMM8eUdE65i66MIkEfCq9xhmBe95zrSOTrYXa3Nut0MUWsl8iAPiFK+4fk KGGA== 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 c10si1764453pgw.294.2019.01.23.13.11.46; Wed, 23 Jan 2019 13:12:02 -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 S1726965AbfAWVKN (ORCPT + 99 others); Wed, 23 Jan 2019 16:10:13 -0500 Received: from iolanthe.rowland.org ([192.131.102.54]:51310 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1726345AbfAWVKN (ORCPT ); Wed, 23 Jan 2019 16:10:13 -0500 Received: (qmail 28071 invoked by uid 2102); 23 Jan 2019 16:10:12 -0500 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 23 Jan 2019 16:10:12 -0500 Date: Wed, 23 Jan 2019 16:10:12 -0500 (EST) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Paul Elder cc: laurent.pinchart@ideasonboard.com, , , , , , , Subject: Re: [PATCH v5 4/6] usb: gadget: add mechanism to specify an explicit status stage In-Reply-To: <20190114051113.GD32268@localhost.localdomain> 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 Mon, 14 Jan 2019, Paul Elder wrote: > On Fri, Jan 11, 2019 at 10:50:11AM -0500, Alan Stern wrote: > > On Fri, 11 Jan 2019, Paul Elder wrote: > > > > > On Wed, Jan 09, 2019 at 02:06:31PM -0500, Alan Stern wrote: > > > > On Wed, 9 Jan 2019, Paul Elder wrote: > > > > > > > > > A usb gadget function driver may or may not want to delay the status > > > > > stage of a control OUT request. An instance where it might want to is to > > > > > asynchronously validate the data of a class-specific request. > > > > > > > > > > A function driver that wants an explicit status stage should set the > > > > > newly added explicit_status flag of the usb_request corresponding to the > > > > > data stage. Later on, the function driver can explicitly complete the > > > > > status stage by enqueueing a usb_request for ACK, or calling > > > > > usb_ep_set_halt() for STALL. > > > > > > > > > > To support both explicit and implicit status stages, a UDC driver must > > > > > call the newly added usb_gadget_control_complete function right before > > > > > calling usb_gadget_giveback_request. To support the explicit status > > > > > stage, it might then check what stage the usb_request was queued in, and > > > > > for control IN ACK the host's zero-length data packet, or for control > > > > > OUT send a zero-length DATA1 ACK packet. > > > > > > > > > > Signed-off-by: Paul Elder > > > > > v4 Acked-by: Alan Stern > > > > > v1 Reviewed-by: Laurent Pinchart > > > > > > > > This looks good and has passed my tests so far. > > > > > > Good! Thank you :) > > > > > > > Can you check your uvc > > > > changes using dummy_hcd with the patch below? > > > > > > I'm not sure what to make of the test results. I get the same results > > > with or without the patch. Which I guess makes sense... in dummy_queue, > > > this is getting hit when the uvc function driver tries to complete the > > > delayed status: > > > > > > req = usb_request_to_dummy_request(_req); > > > if (!_req || !list_empty(&req->queue) || !_req->complete) > > > return -EINVAL; > > > > > > So the delayed/explicit status stage is never completed, afaict. > > > > I presume you are hitting the !list_empty(&req->queue) test, yes? The > > other two tests are trivial. > > Yes, that is what's happening. > > > Triggering the !list_empty() test means the request has already been > > submitted and not yet completed. This probably indicates there is a > > bug in the uvc function driver code. > > The uvc function driver works with musb, though :/ Did you ever figure out the reason for the "!list_empty(&req->queue)" error with dummy_hcd? Was it related to the confusion about completion callbacks for status requests? Interesting new question: How does your code in musb tell the difference between a 0-length data-stage reply to a control-IN transfer, and a status-stage request? Both would appear to the UDC driver as 0-length request submissions for ep0. Do you explicitly keep track of whether the data stage is pending? Alan Stern