From nobody Thu Apr 21 04:18:50 2022 X-Original-To: freebsd-usb@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5A6C611DCDB7 for ; Thu, 21 Apr 2022 04:18:55 +0000 (UTC) (envelope-from farhan@farhan.codes) Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4KkPRy2ZJLz3NCW for ; Thu, 21 Apr 2022 04:18:54 +0000 (UTC) (envelope-from farhan@farhan.codes) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 679B4320094D; Thu, 21 Apr 2022 00:18:52 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Thu, 21 Apr 2022 00:18:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=farhan.codes; h= cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1650514731; x= 1650601131; bh=LHw1VcZ4CK33aluof7xKPf6h3jI9sXyy1F7ipg8LzOw=; b=j GoWrxinSz26SCoVvtDjz0SJj0DGDJSpsGD8ANvXS9DTzRtdlx8Vc+OBWpZ9DJ7hQ NMcL1jCWAFQt+mhdha9PujI68Xmkti6AoDyGX7fdCFikClk9UESC9OpNYysanGtg /9PQimLGoEl8u5jwoxSs3JnnlxJoxTLF3+X6XU9c0t3uR/yV0ifcqiZ5HlnoE3Qv 0HGxv5p+jV+x6VshB/zCG+oKYq/oJEXzOzDgLHrvOwO0YRUFz2I9q0iG7w3CsY7L d2zw305XTy2Xq/HPGF67Ye9nGchq8VDBk2JuNNd/oT9I+7R4cztRKFXrUlf3qrKw KKL5M17H1WOr6gHMHKHSg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1650514731; x=1650601131; bh=LHw1VcZ4CK33aluof7xKPf6h3jI9 sXyy1F7ipg8LzOw=; b=PTmaAnIzGGv+gu0BtmXyS5ehodfBxIOJhcxoy15ujeyT nIndBo1oMIPNeKzgR5jvOJzUIgsuY+y/xgRTEtxUFfXvyg6v7xzmgw6dot8yraoW bfd6IWx5M0CqFJpVk+Mflera/2obFNcl07wIdIwGwvw6rwwvFYhaoRP7xENlv+JE pJTrRnWb9m/WRMbMPHEC6kPR00OvasQ2IbHtSVydY7Fz3WSXii3duwNvCOGRmyDB N4ulvrhLqwQUR7isQdO4xxNFarnpPublOQk0PtP86bw1+vKqmDEucgbUFXkKCUZd KLmz76lXVptuo9/6U0usLW19ynWokjMysBKoRr5Ecg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrtddugdekfecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepkffuhffvffgjfhgtfggggfesthejre dttderjeenucfhrhhomhephfgrrhhhrghnucfmhhgrnhcuoehfrghrhhgrnhesfhgrrhhh rghnrdgtohguvghsqeenucggtffrrghtthgvrhhnpeeujeejvdffhfeutdekkeejuefgge fgvdejkeekgfffkeetgeelgeeuudelheegffenucevlhhushhtvghrufhiiigvpedtnecu rfgrrhgrmhepmhgrihhlfhhrohhmpehfrghrhhgrnhesfhgrrhhhrghnrdgtohguvghs X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 21 Apr 2022 00:18:51 -0400 (EDT) Message-ID: <6fd2d680bf9edd969476f4544314235538c7fe41.camel@farhan.codes> Subject: Re: Trouble loading firmware to USB device From: Farhan Khan To: Hans Petter Selasky , freebsd-usb@freebsd.org Date: Thu, 21 Apr 2022 00:18:50 -0400 In-Reply-To: References: <9315bf6d-b9a9-89a2-9a32-aca9fd9cc015@farhan.codes> <007551144c601a21e2ec8133a8359323de29725f.camel@farhan.codes> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.4 List-Id: FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-usb List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-usb@freebsd.org X-BeenThere: freebsd-usb@freebsd.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4KkPRy2ZJLz3NCW X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=farhan.codes header.s=fm2 header.b="j GoWrxi"; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=PTmaAnIz; dmarc=none; spf=pass (mx1.freebsd.org: domain of farhan@farhan.codes designates 64.147.123.19 as permitted sender) smtp.mailfrom=farhan@farhan.codes X-Spamd-Result: default: False [-4.59 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[farhan.codes:s=fm2,messagingengine.com:s=fm1]; NEURAL_HAM_MEDIUM(-1.00)[-0.999]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:64.147.123.19]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[farhan.codes]; DWL_DNSWL_LOW(-1.00)[messagingengine.com:dkim]; RCVD_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[farhan.codes:+,messagingengine.com:+]; RCPT_COUNT_TWO(0.00)[2]; RWL_MAILSPIKE_EXCELLENT(0.00)[64.147.123.19:from]; MLMMJ_DEST(0.00)[freebsd-usb]; NEURAL_HAM_SHORT(-0.99)[-0.988]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:29838, ipnet:64.147.123.0/24, country:US]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[64.147.123.19:from] X-ThisMailContainsUnwantedMimeParts: N On Wed, 2022-04-20 at 20:37 +0200, Hans Petter Selasky wrote: > > Hi, > > It appears you've programmed the interrupt endpoint to only receive > one > USB packet, because there is no /* FALLTHROUGH */, but a "break;" > statement instead! > > > break; > > case USB_ST_SETUP: > > Maybe if you change that, it will work. > > --HPS Hi! I removed that break and the issue remains. I would not expect this to make a difference because the USB_ST_SETUP condition is below the USB_ST_TRANSFERRED condition and the USB_ST_TRANSFERRED condition is never called. Since I am only getting USB_ST_SETUP calls, USB_ST_TRANSFERRED's fallthrough never happens anyways. The timeline of events is this: ---- 1. athn_data_rx_callback called via usbd_transfer_start() when pipes are opened, with USB_ST_SETUP condition - no USB_ST_TRANSFERRED occurs 2. athn_usb_intr callback called via usbd_transfer_start(), also when pipes are opened. This creates a USB_ST_SETUP condition, but no USB_ST_TRANSFFERRED condition. 3. Loading firmware content via usbd_do_request_flags() 4. Sending final usbd_do_request() with length of 0. 5. msleep() called, times out with EWOUDLBLOCK condition. This should be woke up by wakeup(9), which would happen if athn_usb_intr with the USB_ST_TRANSFERRED condition happened, but it does not. 6. Firmware loading failure due to timeout. 7. Driver unloaded 8. athn_usb_intr called with USB_ST_ERROR/USB_ST_CANCELLED (Why?) ---- Between steps 4 and 5, I am expecting athn_usb_intr to be called with the USB_ST_TRANSFERRED condition which will eventually execute wakeup(9). However, this is never called and I have not been able to determine why. Do I need to run a callback manually? If how do I msleep() and make the call at the same time? Still stuck :/ - Farhan