From owner-freebsd-usb@FreeBSD.ORG Mon Nov 12 12:41:06 2012 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7DA899B3 for ; Mon, 12 Nov 2012 12:41:06 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe06.c2i.net [212.247.154.162]) by mx1.freebsd.org (Postfix) with ESMTP id 070888FC12 for ; Mon, 12 Nov 2012 12:41:05 +0000 (UTC) X-T2-Spam-Status: No, hits=-0.2 required=5.0 tests=ALL_TRUSTED, BAYES_50,T_FRT_BELOW2 Received: from [176.74.213.204] (account mc467741@c2i.net HELO laptop015.hselasky.homeunix.org) by mailfe06.swip.net (CommuniGate Pro SMTP 5.4.4) with ESMTPA id 342605706; Mon, 12 Nov 2012 13:41:03 +0100 From: Hans Petter Selasky To: freebsd-usb@freebsd.org Subject: Re: isochronous transfer packet is out of sequence Date: Mon, 12 Nov 2012 13:42:47 +0100 User-Agent: KMail/1.13.7 (FreeBSD/9.1-PRERELEASE; KDE/4.8.4; amd64; ; ) References: <20121112.205208.208974549.toshi@ruby.ocn.ne.jp> In-Reply-To: <20121112.205208.208974549.toshi@ruby.ocn.ne.jp> X-Face: 'mmZ:T{)),Oru^0c+/}w'`gU1$ubmG?lp!=R4Wy\ELYo2)@'UZ24N@d2+AyewRX}mAm; Yp |U[@, _z/([?1bCfM{_"B<.J>mICJCHAzzGHI{y7{%JVz%R~yJHIji`y>Y}k1C4TfysrsUI -%GU9V5]iUZF&nRn9mJ'?&>O MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201211121342.47141.hselasky@c2i.net> X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Nov 2012 12:41:06 -0000 On Monday 12 November 2012 12:52:08 SAITOU Toshihide wrote: > I have tryed the USB isochronous transfer for UVC cam using libusb > interface and I find the packet fragment is out of sequence on the > FreeBSD(1). But I don't find it on the MacBook(2). > > (1) FreeBSD 9.1-RC2, Intel Core i7 3770T > (2) Mac OS X 10.6.8, Intel Core 2 Duo, libusb 1.0.9 (single core) > > Can I prevent this behaviour using libusb interface or is > this an expected behaviour? > > The bellow I issued two libusb_submit_transfer at the beginning. > > > ----- log (1) > 049 4437e06b 0 c 818 > 04a 4437e06b 0 c c00 > 04b 4437e06b 0 c 818 > UVC_STREAM_EOF > total a1400 > 04c 4402516b 1 c b9c > 04d 4402516b 1 c 87c > 04e 4402516b 1 c 800 > 04f 4402516b 1 c c00 > 050 4402516b 1 c 800 > 051 4437e06b 0 c c00 > 052 4437e06b 0 c 744 > 053 4437e06b 0 c c00 > > > ----- callback function > static void cb(struct libusb_transfer *xfer) > { > uint8_t *p; > int plen; > int i; > > p = xfer->buffer; > > for (i = 0; i < xfer->num_iso_packets; i++, p += PKT_LEN) > { > if (xfer->iso_packet_desc[i].status == > LIBUSB_TRANSFER_COMPLETED) { > plen = xfer->iso_packet_desc[i].actual_length; > > if (plen < 2) > continue; > > if (p[1] & UVC_STREAM_ERR) // bmHeaderInfo > continue; > > fprintf(stderr, "%03x ", i); > fprintf(stderr, "%08x ", p[2] | p[3]<<8 | p[4]<<16 > | p[5]<<24); // pts fprintf(stderr, "%01x ", p[1] & UVC_STREAM_FID); // > fid fprintf(stderr, "%01x ", p[0]); // header length fprintf(stderr, > "%x\n", plen); // actual length > > total += plen - p[0]; > > if (p[1] & UVC_STREAM_EOF) > { > fprintf(stderr, "UVC_STREAM_EOF\n", total); > fprintf(stderr, "total %x\n", total); > > if (total < FrameSize) > { > fprintf(stderr, "insufficient frame data.\n"); > write(fd, padding, FrameSize - total); // zero padding > } > total = 0; > } > write(fd, p + p[0], plen - p[0]); // write payload data > } > } > > if (libusb_submit_transfer(xfer) != 0) > { > fprintf(stderr, "submit transfer failed.\n"); > } > } Hi, You need to submit two transfers for continued operation. --HPS