Subject: usb stuff
To: None <tech-kern@netbsd.org>
From: Love <lha@stacken.kth.se>
List: tech-kern
Date: 11/21/2002 10:32:55
Hej

While writing a usb driver that uses a iso pipe from from the device I
found the follow problem ?

- setup_func() creates pipe
- setup_func() creates xfers and buffer

- setup_func() adds does usbd_setup_isoc_xfer(xfer) on all the xfers and
   with the callback set to foo_intr().
- setup_func() calls usbd_transfer(xfer)

foo_intr()
  takes the xfer, proceses it and does a
  usbd_setup_isoc_xfer(xfer) on the xfer and set it up for processing again
  with usbd_transfer(xfer).

The problem is that usbdi.c is not finished when processing with the xfer
and calles the ->done for the xfer after completing the ->callback for the
xfer. And the ->done function (in some drivers) find out that the xfer
isn't busy_free != XFER_BUSY, but rather XFER_ONQU because of the
usbd_transfer().

You only get a warning if you compile with DIAGNOSTIC.

ugen and uaudio seems to have the problem.

How should it work ? (did I understand the problem correctly ?)

Love