Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Mar 2022 22:30:06 +0200
From:      Hans Petter Selasky <hps@selasky.org>
To:        Farhan Khan <farhan@farhan.codes>, freebsd-usb@freebsd.org
Subject:   Re: Why receiving USB_ERR_CANCELLED error during initial Rx transfer
Message-ID:  <5d339238-87ac-482a-05cf-d0e65abf0187@selasky.org>
In-Reply-To: <55adbaa5-27d3-451d-9320-a1966f167498@www.fastmail.com>
References:  <55adbaa5-27d3-451d-9320-a1966f167498@www.fastmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5d339238-87ac-482a-05cf-d0e65abf0187>