USB Stack/# of bytes to read?

Brian J. McGovern mcgovern at spoon.beta.com
Tue Dec 7 17:37:31 UTC 2010


All,

  I have a couple of quick questions about the USB stack in 8.x that I'm hoping
someone with a bit more experience than I can answer.

  I am currently working on a device driver for a Velleman K8055 board. 
Basically, it does digital and analog I/O under the control of a PC via USB. 
I've got the basic driver working fine, and I'm moving data back and forth 
without issue.

  What I'd like to be able to do, however, is poll the driver to see how much
data is sitting in the input buffer, or at least see how many packet/buffers
are waiting. Looking through the control structures, it appears that something
like sc->fifo.fp[USB_FIFO_TX]->used_q.ifq_len would be the right field, but it
never appears to be set anywhere (and is always 0). Using something like 
USB_IF_POLL() on the used_q suggests there is something to write, but not how
much.

  On a similar line of thinking, how about flushing the queue entirely? Should
I call usb_fifo_reset() directly? Or should I just reimplement the logic?

  -B


More information about the freebsd-questions mailing list