USB device with multiple interfaces, sample code anyone?

M. Warner Losh imp at bsdimp.com
Thu Jun 1 15:00:01 PDT 2006


In message: <447B0CD3.1080309 at vwsoft.com>
            Volker <volker at vwsoft.com> writes:
: Hi hackers,
: 
: I'm trying to correctly implement a driver for an USB device which
: has multiple (serial) interfaces (at least 3). Each interface should
: be seen by the kernel as a tty device entry /dev(/cuaU* or /dev/ttyU*).
: 
: After reading the usb kernel sources I'm not quite sure how to deal
: with that. As the device entry is being created in ucom.c
: (ucom_attach calls ttycreate) I'm not quite sure which code is
: responsible for scanning (enumerating) and correctly attaching to
: the usb device interfaces or if there's just a wrong enumeration
: return code.
: 
: I haven't found any usb code which deals with more than 1 interface
: per usb device (except sound/pcm/uaudio but while doing a quick read
: of that code I do not understand much of uaudio).
: 
: Does any of the hackers have a piece of sample code on how to scan
: usb device interfaces and attach a device file entry (/dev/) to it?
: Or any pseudo-code or graphical explanation on how the usb code is
: actually doing device enumeration?

Either you are going to have to attach multiple ucom devices, or
manage the tty layer yourself.  enumeration is something that's device
specific, but the freebsd side is just adding mutiple devices.  I
think that the ucom stuff right now isn't a 'real' device, so there
might be dragons there.

Warner


More information about the freebsd-hackers mailing list