Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Jun 2011 11:19:51 +0200
From:      Hans Petter Selasky <hselasky@c2i.net>
To:        freebsd-usb@freebsd.org
Subject:   Re: Read from bulk end point
Message-ID:  <201106271119.51079.hselasky@c2i.net>
In-Reply-To: <4E084297.2040200@bally-wulff.de>
References:  <4E084297.2040200@bally-wulff.de>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201106271119.51079.hselasky>