From owner-freebsd-hackers@FreeBSD.ORG Fri Apr 8 23:13:18 2005 Return-Path: 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 6ACA116A4CE for ; Fri, 8 Apr 2005 23:13:18 +0000 (GMT) Received: from srv1.cosmo-project.de (srv1.cosmo-project.de [213.83.6.106]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9F2C043D45 for ; Fri, 8 Apr 2005 23:13:17 +0000 (GMT) (envelope-from ticso@cicely12.cicely.de) Received: from cicely5.cicely.de (cicely5.cicely.de [10.1.1.7]) (authenticated bits=0)j38ND7np016046 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK); Sat, 9 Apr 2005 01:13:09 +0200 (CEST) (envelope-from ticso@cicely12.cicely.de) Received: from cicely12.cicely.de (cicely12.cicely.de [IPv6:3ffe:400:8d0:301::12]) by cicely5.cicely.de (8.12.10/8.12.10) with ESMTP id j38NClhs083915 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 9 Apr 2005 01:12:48 +0200 (CEST) (envelope-from ticso@cicely12.cicely.de) Received: from cicely12.cicely.de (localhost [127.0.0.1]) by cicely12.cicely.de (8.12.11/8.12.11) with ESMTP id j38NClGk006703; Sat, 9 Apr 2005 01:12:47 +0200 (CEST) (envelope-from ticso@cicely12.cicely.de) Received: (from ticso@localhost) by cicely12.cicely.de (8.12.11/8.12.11/Submit) id j38NCk0L006702; Sat, 9 Apr 2005 01:12:46 +0200 (CEST) (envelope-from ticso) Date: Sat, 9 Apr 2005 01:12:46 +0200 From: Bernd Walter To: Maksim Yevmenkin Message-ID: <20050408231246.GV96690@cicely12.cicely.de> References: <16982.46075.115518.130213@canoe.dclg.ca> <4256B5EB.9080506@savvis.net> <16982.47024.135663.645297@canoe.dclg.ca> <20050408190514.GS96690@cicely12.cicely.de> <16983.465.572693.73195@canoe.dclg.ca> <42570698.4070205@savvis.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42570698.4070205@savvis.net> X-Operating-System: FreeBSD cicely12.cicely.de 5.2-CURRENT alpha User-Agent: Mutt/1.5.6i X-Spam-Status: No, hits=-4.9 required=3.0 tests=BAYES_00 autolearn=no version=2.64 X-Spam-Report: * -4.9 BAYES_00 BODY: Bayesian spam probability is 0 to 1% * [score: 0.0000] X-Spam-Checker-Version: SpamAssassin 2.64 (2004-01-11) on cicely12.cicely.de cc: freebsd-hackers@freebsd.org cc: ticso@cicely.de cc: David Gilbert Subject: Re: Tricky USB device. X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: ticso@cicely.de List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Apr 2005 23:13:18 -0000 On Fri, Apr 08, 2005 at 03:32:56PM -0700, Maksim Yevmenkin wrote: > hmm... why even use libusb? cant you just "fd = open("/dev/ugen0.1", > O_RDWR);" and then "write(fd, "MK255", 5)" and "read(fd, ...);". note: > here i assume ugen0 is the device. > > >I'm also not entirely clear how/when to use usb_interrupt_read() > >... as many of the commands listed in the manual return data, but > >usb_inerrupt_write() doesn't seem to allow for data to be returned, > >but following usb_interrupt_write(), the read will hang. > > i'd guess you have to keep read pipe open at all times. that is what "fd > = open("/dev/ugen0.1", O_RDWR);" will do - it will open both read and > write pipes (because of O_RDWR). > > then you just > > write(fd, ...); > read(fd, ...); select(2) and non-blocking should work with ugen and interrupt endpoints too. -- B.Walter BWCT http://www.bwct.de bernd@bwct.de info@bwct.de