Re: Understanding USB callback + assertion panic

From: Farhan Khan <farhan_at_farhan.codes>
Date: Wed, 09 Mar 2022 21:42:58 UTC
On Wed, 2022-03-09 at 20:26 +1030, Daniel O'Connor wrote:
> 
> This one?
> 
>         USB_XFER_LOCK_ASSERT(xfer, MA_OWNED);
> 
> 
> I think that assertion is saying you have to have acquired the USB
> transfer lock USB_XFER_LOCK() et al, although I am not entirely sure
> how you do that 'bare'. I have only called usbd_transfer_start in the
> USB FIFO setup routines.
> 

Hi Daniel and Hans!

In my case, I am hitting the assertion panic even though I have this:

---------
error = usbd_transfer_setup(uaa->device, &iface_index, usc->usc_xfer,
   athn_config_common, ATHN_N_TRANSFERS, usc, &sc->sc_mtx);
ATHN_LOCK(sc);
usbd_transfer_start(usc->usc_xfer[ATHN_BULK_TX_DATA]);
ATHN_UNLOCK(sc);
---------

Considering this is quite similar to how other drivers do this, what
might I be doing wrong?

I removed the error checking on 'error' for brevity, but it returns 0.

Thanks!
Farhan