Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Mar 2020 17:23:38 -0700
From:      John-Mark Gurney <jmg@funkthat.com>
To:        "Wall, Stephen" <stephen.wall@redcom.com>
Cc:        "freebsd-drivers@freebsd.org" <freebsd-drivers@freebsd.org>
Subject:   Re: Sending data packets to USB bulk endpoint
Message-ID:  <20200326002338.GS4213@funkthat.com>
In-Reply-To: <14d06ca2f98e42eca84e9b0d0df8b39e@redcom.com>
References:  <14d06ca2f98e42eca84e9b0d0df8b39e@redcom.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Wall, Stephen wrote this message on Wed, Mar 25, 2020 at 01:53 +0000:
> I posted this on the FreeBSD Drivers forum, got no response, so I'm trying here.
> 
> 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 straightforward. 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.

Is there a specific reason you want a native kernel driver instead of
using something like libusb + cuse4bsd?

Also, have you looked at usbdi(9)?  It looks like it contains the
information on how to setup a transfer w/ the buffer, and use that.

https://www.freebsd.org/cgi/man.cgi?query=usbdi&manpath=FreeBSD+12.1-RELEASE+and+Ports

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20200326002338.GS4213>