Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 May 2008 19:11:53 +0200
From:      Hans Petter Selasky <hselasky@c2i.net>
To:        freebsd-usb@freebsd.org
Subject:   Re: Webcam ugen iso transfer problems
Message-ID:  <200805111911.55524.hselasky@c2i.net>
In-Reply-To: <JIEGIIKNNGNDIBENLEAOAECLDOAA.ee@athyriogames.com>
References:  <JIEGIIKNNGNDIBENLEAOAECLDOAA.ee@athyriogames.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sunday 11 May 2008, Engineering wrote:
> Hello
>
> I am having much trouble trying to read isochronous data from a UVC webcam.
> I understand that a full driver is being worked on right now, but I'd love
> to be able to get my 'mini-driver' which only does one frame rate working
> in the meantime.
>
> I have updated the USB stack with Hans Petter Selasky's work, and am now
> able to get data. The problem is, much of the YUV data seems to be missing.
>
> I have just run tests through all of the Alt Interfaces, and have some
> results.
>
> I am just setting the cam to 160x120 uncompressed, and trying to get the
> stream
>
> In each case, I try to set the buffer to wMaxPacketSize * 400 (ugen seems
> to collect 50 * 8 packets)
>
> I notice at the faster interfaces, the ugen Frame Size no longer matches
> wMaxPacketSize.
>
> This should give me 12 byte stream headers, and lots of YUV data. I read
> the results as a 2 channel raw file in Photoshop. I discarded the 2nd
> channel (UV) for clarity, so the 12 bytes headers become 6 bytes, which you
> can see in the png files.
>
> the basic test code loop is
>
> dev->isopipe = open(pipename,O_RDONLY);
> (set the buffer size, timeout, short XFER)
> FILE *f;
> f = fopen("/usr/src/sys/dev/usb/test.raw","wb");
> int i;
> int bytes;
> for(i = 0;i<210;i++)
> {
> 	bytes = read(dev->isopipe,uvcbuf,UVCBUFSIZE); // 42240
> 	if (bytes > 0)
> 	{
> 		fwrite(&uvcbuf,bytes,1,f);
> 		zinfo("read %d bytes\n",bytes);
> 	}
> }
> fclose(f);
>

Hi Sam,

How does the parsing code look?

Can you provide a Hexdump of the data you get from the ugen endpoint ?

for (i = 0; i != 240; i++)
{
	bytes = read(dev->isopipe,buf,count * wMaxPacketSize);
	if (bytes > 0) {
		...
	} else {
		break; /* detached */
	}
}

--HPS



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