struct usb_config: pass custom parameter to callback?

Hans Petter Selasky hselasky at c2i.net
Fri Nov 12 15:25:34 UTC 2010


On Friday 12 November 2010 16:01:44 Lev Serebryakov wrote:
> Hello, Freebsd-usb.
> 
>   Is it possible to pass custom parameter to xfer callback, configured
> via "struct usb_config"?
> 
>   I'm writing driver for device, which have multiple equivalent ports,
>   each whith its own paor of pipes (for IN and OUT), and I want to use
>   only   two   callbacks.   Is  it  possible? Or should I make N pairs
>   of almost-the-same thunk functions?

Hi,

There is usbd_xfer_get/set_priv() and usbd_xfer_softc() which you can use to 
get and set private and softc alike structure pointers after that the USB 
transfers are setup. Any more custom parameters you need wrap using callback 
wrappers.

--HPS


More information about the freebsd-usb mailing list