Date: Tue, 30 May 2006 10:12:14 +0200 From: Bernd Walter <ticso@cicely12.cicely.de> To: Volker <volker@vwsoft.com> Cc: hackers@freebsd.org Subject: Re: USB device with multiple interfaces, sample code anyone? Message-ID: <20060530081213.GZ2409@cicely12.cicely.de> In-Reply-To: <447B0CD3.1080309@vwsoft.com> References: <447B0CD3.1080309@vwsoft.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, May 29, 2006 at 05:01:39PM +0200, Volker wrote: > 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*). You either build a device driver managing the whole device and create multiple ttys in a single device instance. uftdi(4) is an example for this, which supports single and twin channel USB-devices. Or you build a driver matching a single interface which attaches in multiple instances. ubser is a single interface driver, it creates multiple ttys on a single interface however. Although real hardware don't exist with multiple interfaces the driver would allow it. http://www.bwct.de/modbus/ubmb-0.3.tgz is a very simple interface level driver which was already used for multiple interfaces. It attaches once for each device and create a single device for each instance. But it is not a tty driver. > 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. This is done in usbd_probe_and_attach(). Forst the whole device is offered and if no driver claims it each single interface is offered. > 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). Normaly a driver only handles a single instance and attaches multiple times. -- B.Walter http://www.bwct.de http://www.fizon.de bernd@bwct.de info@bwct.de support@fizon.de
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060530081213.GZ2409>