From nobody Tue Mar 29 20:30:06 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 625AF1A36953 for ; Tue, 29 Mar 2022 20:30:15 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (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 4KSh5L3j8Rz3JSb for ; Tue, 29 Mar 2022 20:30:14 +0000 (UTC) (envelope-from hps@selasky.org) Received: from [10.36.2.165] (unknown [178.17.145.105]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 09ED826012D; Tue, 29 Mar 2022 22:30:06 +0200 (CEST) Message-ID: <5d339238-87ac-482a-05cf-d0e65abf0187@selasky.org> Date: Tue, 29 Mar 2022 22:30:06 +0200 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 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: Why receiving USB_ERR_CANCELLED error during initial Rx transfer Content-Language: en-US To: Farhan Khan , freebsd-usb@freebsd.org References: <55adbaa5-27d3-451d-9320-a1966f167498@www.fastmail.com> From: Hans Petter Selasky In-Reply-To: <55adbaa5-27d3-451d-9320-a1966f167498@www.fastmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4KSh5L3j8Rz3JSb X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of hps@selasky.org designates 88.99.82.50 as permitted sender) smtp.mailfrom=hps@selasky.org X-Spamd-Result: default: False [-1.30 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+a:mail.turbocat.net:c]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[selasky.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999]; NEURAL_SPAM_SHORT(1.00)[0.998]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; MLMMJ_DEST(0.00)[freebsd-usb]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:88.99.0.0/16, country:DE]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-ThisMailContainsUnwantedMimeParts: N On 3/29/22 20:10, Farhan Khan wrote: > Hi all, > > I am trying to send the initial "wakeup" USB Rx interrupt packet via usbd_transfer_start(), but after running the callback with USB_ST_SETUP, I receive another callback with USB_ERR_CANCELLED as the value of usb_error_t. What might be causing the cancellation? > > Detailed explanation: > I am opening the pipes, then immediately running usbd_transfer_start() on the Rx Interrupt with this: > usbd_transfer_start(usc->usc_xfer[ATHN_RX_INTR]); > > The callback function runs this: > > case USB_ST_SETUP: > usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer)); > usbd_transfer_submit(xfer); > break; > > The next time the callback is invoked, the USB_GET_STATE macro reports USB_ST_ERROR with the value being USB_ERR_CANCELLED. The manual page suggests that this is the result of a transfer currently happening, but I am not clear on the issue. I have both set and disabled pipe_bof on the Rx Interrupt with the same result. > > I borrowed the above code from the otus(4) driver. > Please assist. Thanks! Something in your code is calling usbd_transfer_stop() or unsetup(). --HPS