From nobody Thu Apr 28 05:53:36 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 B03471AACE09 for ; Thu, 28 Apr 2022 05:53:47 +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 4KplDB1Mrdz3wM6 for ; Thu, 28 Apr 2022 05:53:45 +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 7C6413200945; Thu, 28 Apr 2022 01:53:38 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Thu, 28 Apr 2022 01:53:38 -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=1651125217; x= 1651211617; bh=hCTuWs3Vb0+1jWHMynmqOM8WvX7wHH4uAk5vT6w6c9Q=; b=N X+96fTiEB7BunJPYx2uqIq5/gDt6xPDyjTWXpDuz025TL/nzKoa3kwf4i7K68fOb HfLYDgs+3713ouZMXTFdJ1x7sV2+CAe9RnCCk8bxBLimTTOHhF+lSST8BAXnRcVy yQRuMK+7/fK29JHnu7prV7lnQy09EQ+n6yKioBbxl6OaIcH96NE/yfK9G4AcA39k 8BVj7u1SHB0oijQsDFMttqxYWn03d3mEdD3vT2+hsjo+VXpUAgRdBxzp5K6ia96M g8EncZuJrE/33pz9o5TGaArrY1MmZ12YTiyfpef3c0JlCHSbujE8+tlbl9WcMjsa RPackjZwBTWOSZ8T1wApQ== 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=1651125217; x=1651211617; bh=hCTuWs3Vb0+1jWHMynmqOM8WvX7w HH4uAk5vT6w6c9Q=; b=WEVvZ/0Sb/Mh3Bwii893flzw4s2Lc4efgoKZMfsXgBqz MDbllyUsKl1+nAEoRBV6zUzSnpi0cPjpVCkYTI/6aNPUYbeGXhCb/STrGdgilZfh pKVSTG7qy1nFokWk+qCiygyIVd+zBcDx8h9yUWTzv7Se/dMo1PU2oGVMClhkv4Np LI0gdb8K00mM6723Ywb1c+Hxo4wbd818ACgA2Zng1p3Btd3mK0JFZpClggPQlXH8 4zqk0sY+Sdty3/O46w1JKMepkj/Y7TqT/th9RnTqN1Cl+bH7/722YEzG+nDZeVqH /91plh+X3xtG8SUML5u1o7JG0RK5CGECe6mut0Kuog== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudeigddutdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkjghfggfgtgesthfure dttddtvdenucfhrhhomhephfgrrhhhrghnucfmhhgrnhcuoehfrghrhhgrnhesfhgrrhhh rghnrdgtohguvghsqeenucggtffrrghtthgvrhhnpeekudefgfdvleejteduhfdtfffhie euteelvdettdehhfekhfdtfeeuffehhfetfeenucffohhmrghinhepghhithhhuhgsrdgt ohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepfh grrhhhrghnsehfrghrhhgrnhdrtghouggvsh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 28 Apr 2022 01:53:37 -0400 (EDT) From: Farhan Khan To: freebsd-usb@freebsd.org, Hans Petter Selasky Subject: Re: Trouble loading firmware to USB device Date: Thu, 28 Apr 2022 01:53:36 -0400 Message-ID: <1901464.PYKUYFuaPT@fedora> In-Reply-To: <05b3c211-2b77-7e59-a9da-d28a21d5b389@selasky.org> References: <9ca0e355-d780-f9c0-4d38-b99662f43edd@selasky.org> <05b3c211-2b77-7e59-a9da-d28a21d5b389@selasky.org> 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 Content-Type: text/plain; charset="us-ascii" X-Rspamd-Queue-Id: 4KplDB1Mrdz3wM6 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=farhan.codes header.s=fm2 header.b="N X+96fT"; dkim=pass header.d=messagingengine.com header.s=fm1 header.b="WEVvZ/0S"; 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 [-3.60 / 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)[-1.000]; 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]; MID_RHS_NOT_FQDN(0.50)[]; 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]; NEURAL_HAM_SHORT(-1.00)[-1.000]; MLMMJ_DEST(0.00)[freebsd-usb]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; CTE_CASE(0.50)[]; ASN(0.00)[asn:29838, ipnet:64.147.123.0/24, country:US]; RCVD_TLS_LAST(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[64.147.123.19:from] X-ThisMailContainsUnwantedMimeParts: N On Wednesday, April 27, 2022 3:41:27 AM EDT Hans Petter Selasky wrote: > Somewhere in the code you are asking for a read of 1024 bytes on the > interrupt endpoint. That is what usbdump says. That means multiple > packets will have to be received for it to complete. I'm not sure Making progress: I got this down to 64 bytes, not 1024, and identified the read location. ----- 18:17:30.880855 usbus3.2 SUBM-INTR-EP=00000083,SPD=HIGH,NFR=1,SLEN=0,IVAL=1 frame[0] READ 64 bytes flags 0xa status 0xeb023 ----- The source of this read appears to be after the usbd_transfer_setup(), where I send two initial usbd_transfer_start()s, specifically the for the RX Data transfer. usbd_transfer_start(usc->usc_xfer[ATHN_RX_DATA]); I do this immediately after the usbd_transfer_setup(). I identified this by commenting out other lines until I narrowed it down to this single source. This line should trigger this callback: The code is located here: https://github.com/khanzf/freebsd/blob/ar9271/sys/ dev/athn/usb/if_athn_usb.c#L303 I believe earlier in our conversation you advised me to include that transfer. Is there something wrong in my callback? The OpenBSD callback is pretty robust but for now I was aiming for the minimum necessary to load the firmware. > printf("FRAME LENGTH = %d\n", usbd_xfer_max_len(xfer)); 64 bytes, sounds correct. > Also make sure there is only one instance of your .ko in /boot/kernel or > /boot/modules, that you are not loading an old version of the built .ko. My build script is running make -C /usr/src/sys/modules/athn_usb/ clean, cleandepend, then load, I never actually install the module such that it is stored in my /boot/modules directory, so I do not anticipate this being an issue. - Farhan