tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Fwd: usb driver programming
On Tue, 4 Aug 2009, Dmitry Cherkassov wrote:
> Is that, what's you've been talking about searching for endpoints in
> atu_complete_attach: ?
>
> for (i = 0; i < id->bNumEndpoints; i++) {
> ed = usbd_interface2endpoint_descriptor(sc->atu_iface, i);
yes, you must iterate through the endpoint descriptors and find the ones
that you want according to direction and type (using hardcoded values eg
0x83 and 0x04 is not good). You note the endpoint address and use it later
to open the pipe
> 1) could you please tell me where is the code showing how to open a
> pipe for communication with the endpoint different that the 'control'?
that is in atu_start()
briefly, in order to transfer data over USB in an asynchronous manner,
you must
attach:
- find the endpoint address
setup:
- usbd_open_pipe("interface", "endpoint address", ...)
- usbd_alloc_xfer("device")
- usbd_alloc_buffer("xfer", "buffer size")
- goto transfer
transfer:
- usbd_setup_xfer("xfer", "pipe", ..., "callback")
- usbd_transfer("xfer")
callback:
- goto transfer
Unfortunately the documentation is poor for this, I think there may be a
more informative usbdi(9) manpage at the FreeBSD website that is mostly
valid.
Also in the atu driver, they queue more than one xfer at the same time (8
for transmit but only 1 for receive) in order to fill the bandwidth, and
this adds some complexity.
> 2) And what to do with that stuff:
> request
> value
> index
that is for sending commands to the device, such as setting it into
different modes or getting config information. Those commands will likely
be different for the wimax device than the atu
regards,
iain
Home |
Main Index |
Thread Index |
Old Index