From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 1 21:59:54 2006 Return-Path: X-Original-To: hackers@freebsd.org Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6A62516BA6D for ; Thu, 1 Jun 2006 21:59:54 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (vc4-2-0-87.dsl.netrack.net [199.45.160.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id 08DBA43D46 for ; Thu, 1 Jun 2006 21:59:53 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (localhost.village.org [IPv6:::1] (may be forged)) by harmony.bsdimp.com (8.13.4/8.13.4) with ESMTP id k51LwQpB080227; Thu, 1 Jun 2006 15:58:29 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Thu, 01 Jun 2006 15:58:32 -0600 (MDT) Message-Id: <20060601.155832.-1935222835.imp@bsdimp.com> To: volker@vwsoft.com From: "M. Warner Losh" In-Reply-To: <447B0CD3.1080309@vwsoft.com> References: <447B0CD3.1080309@vwsoft.com> X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: hackers@freebsd.org Subject: Re: USB device with multiple interfaces, sample code anyone? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jun 2006 22:00:01 -0000 In message: <447B0CD3.1080309@vwsoft.com> Volker 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