# Sending/receiving packets to a Bulk USB endpoint



## stephen.wall (Mar 18, 2020)

I am working on a driver to support a Silicon Labs I2S to USB bridge.  Besides the audio portion, the chip supports a bulk endpoint which uses a documented packet format to read & control 16 GPIO pins, and to pass messages to & from an I2C bus.  I have not previously worked with USB, or FreeBSD drivers.  I'm been handed a partially complete codebase - the audio stream works - and I'm trying to get the GPIO controls working.  My intent is to use _ioctl() _calls to read and set the pins.
Creating an entry in /dev and the associated character device structure for the GPIO control is pretty straighforward.  Where I'm getting stuck is trying to figure out how to get the messages I am creating in the driver down to the bulk endpoint - the USB driver code is a bit overwhelming to a newcomer, and I can't seem to find a function that fits "send this block of data to this endpoint".  The only way I've seen for interacting with bulk endpoints is to write a driver based on _usb_fifo_methods _rather than _cdevsw_ (per "FreeBSD Device Drivers", chapter 15), which does not seem to fit what I'm trying to do.
I would appreciate any pointers experienced driver developers could give me to get where I'm trying to go with this - either the name of the function I'm looking for, or some other was to get that functionality.

Thanks.

- Steve


----------



## unitrunker (Apr 15, 2020)

Are you trying to do a control transfer or an actual bulk transfer?


----------

