From owner-freebsd-usb@FreeBSD.ORG Mon Jun 27 11:14:56 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 A5AB810658AF for ; Mon, 27 Jun 2011 11:14:56 +0000 (UTC) (envelope-from l.pizzamiglio@bally-wulff.de) Received: from mail2.bally-wulff-berlin.de (mail2.bally-wulff-berlin.de [212.144.118.9]) by mx1.freebsd.org (Postfix) with ESMTP id 687F28FC24 for ; Mon, 27 Jun 2011 11:14:56 +0000 (UTC) Received: from bwex.bally-wulff.de (unknown [192.9.204.106]) by mail2.bally-wulff-berlin.de (Postfix) with ESMTP id EE68599074; Mon, 27 Jun 2011 13:14:54 +0200 (CEST) Received: from pizzamig.bally.de ([192.9.205.30]) by bwex.bally-wulff.de with Microsoft SMTPSVC(6.0.3790.4675); Mon, 27 Jun 2011 13:14:55 +0200 Message-ID: <4E08662F.7000401@bally-wulff.de> Date: Mon, 27 Jun 2011 13:14:55 +0200 From: Luca Pizzamiglio User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.9.2.18) Gecko/20110622 Thunderbird/3.1.11 MIME-Version: 1.0 To: Hans Petter Selasky References: <4E084297.2040200@bally-wulff.de> <201106271119.51079.hselasky@c2i.net> In-Reply-To: <201106271119.51079.hselasky@c2i.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 27 Jun 2011 11:14:55.0179 (UTC) FILETIME=[715471B0:01CC34BB] Cc: freebsd-usb@freebsd.org 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 11:14:59 -0000 Hi, thanks HPS, yes, the buffer size works well. It was strange, because for other endpoints I don't see this kind of behavior. BTW now the problem is solved. Thanks again Luca On 06/27/11 11:19, Hans Petter Selasky wrote: > 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