From owner-freebsd-usb@FreeBSD.ORG Mon Jun 27 09:21:34 2011 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B27E41065670 for ; Mon, 27 Jun 2011 09:21:34 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe03.c2i.net [212.247.154.66]) by mx1.freebsd.org (Postfix) with ESMTP id 32EFB8FC14 for ; Mon, 27 Jun 2011 09:21:33 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=EIZfbDsN8gr1c4B7uGrP4foh/gtfZ6zZRee2cLtKwTU= c=1 sm=1 a=SvYTsOw2Z4kA:10 a=WQU8e4WWZSUA:10 a=8nJEP1OIZ-IA:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=_TuTmXaz1bU1WRQUx0cA:9 a=wPNLvfGTeEIA:10 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe03.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 145730469; Mon, 27 Jun 2011 11:21:31 +0200 From: Hans Petter Selasky To: freebsd-usb@freebsd.org Date: Mon, 27 Jun 2011 11:19:51 +0200 User-Agent: KMail/1.13.5 (FreeBSD/8.2-STABLE; KDE/4.4.5; amd64; ; ) References: <4E084297.2040200@bally-wulff.de> In-Reply-To: <4E084297.2040200@bally-wulff.de> X-Face: *nPdTl_}RuAI6^PVpA02T?$%Xa^>@hE0uyUIoiha$pC:9TVgl.Oq, NwSZ4V"|LR.+tj}g5 %V,x^qOs~mnU3]Gn; cQLv&.N>TrxmSFf+p6(30a/{)KUU!s}w\IhQBj}[g}bj0I3^glmC( :AuzV9:.hESm-x4h240C`9=w MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201106271119.51079.hselasky@c2i.net> Cc: Subject: Re: Read from bulk end point X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jun 2011 09:21:34 -0000 On Monday 27 June 2011 10:43:03 Luca Pizzamiglio wrote: > Hi USB list, > > I've a little problem, but I'm not able to find a solution... > I've a generic custom USB device with several end points. > One of them (a bulk one) is read periodically (polled, 64 byte) every > second. There was some time inconsistencies, so I checked the USB > traffic with a sniffer, and I discovered that transactions are compacted > at the start of the loop in a block of 64 read (64 byte * 64 msg = 4096 > byte). In other words, on the bus the first read is followed immediately > by the next 63 read. > > I guess that this is a pre-fetch optimization for BULK end points. How > can I disable this optimization for this end point? How can I come back > to a more "real-time" behavior? I tried to play with open() flags > (O_NONBLOCK, O_DIRECT) without luck. > > Using FreeBSD 7 with HPS stack, this behavior didn't happen. Every read > consists in 1 read on the bus and everything is fine. > > Thanks in advance! > > Luca There is an IOCTL to set the RX and TX buffer sizes. Please use that. See dev/usb/usb_ioctl.h. The default is more than one full packet. --HPS