Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

AVstream & USB Webcam

102 views
Skip to first unread message

Daniel

unread,
Dec 28, 2009, 12:33:53 PM12/28/09
to
I'm new to writing device drivers and my work has asked me to write a driver for a USB webcam. After much research it seems that AVstream is the way to go. I was able to manipulating the samples, provided in the WDK, and I believe i understand AVstream pity well, but I ran into a wall while trying to figure out how to connect to the USB stack. Can someone please point me in the right direction on how to connect my driver to the USB stack?

Also another side note, while experimenting with kernal level drivers I was able to debug with a program called DebugView but once I moved into the user space debugging became a whole ordeal. Is there any special way to view my debug statements?

Thanks,
Daniel


Submitted via EggHeadCafe - Software Developer Portal of Choice
HTML Entities Class
http://www.eggheadcafe.com/tutorials/aspnet/ca7f59b0-e086-4974-9130-3210625e675c/html-entities-class.aspx

Tim Roberts

unread,
Dec 29, 2009, 1:27:14 AM12/29/09
to
Daniel wrote:
>
>I'm new to writing device drivers and my work has asked me to write
>a driver for a USB webcam. After much research it seems that AVstream
>is the way to go.

No, the "way to go" is to build your webcam so that it adheres to the USB
Video Class Specification. If you do that, you don't need to write a
driver at all. Usbvideo.sys handles it all for you. You cannot get the
Windows Logo for a device that does not work with usbvideo.sys.

>I was able to manipulating the samples, provided in the WDK, and I
>believe i understand AVstream pity well, but I ran into a wall while
>trying to figure out how to connect to the USB stack. Can someone
>please point me in the right direction on how to connect my driver
>to the USB stack?

It's basically a plumbing problem. The samples (avshws and avssamp) have
"simulated" hardware classes providing the data. You just need to unbolt
the simulated class and supply your own USB interface class. You read the
descriptors at startup time, then select the proper alternate setting and
submit your own queue of URBs at the transition to "pause" mode.

AVStream will handle "connecting it to the stack" as long as the INF loads
the driver.

>Also another side note, while experimenting with kernal level drivers I

>was able to debug with a program called DebugView ...

Well, that's really just "debugging with printf". The proper way to debug
kernel code is by using WinDbg.

>but once I moved into the user space debugging became a whole ordeal.
>Is there any special way to view my debug statements?

I'm not sure I understand the question. A user-mode app can write to
DebugView by using OutputDebugString, if you're really enamored with
DebugView. Personally, I'd rather use WinDbg or even the Visual Studio
debugger for my user-mode code.
--
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.

danielk

unread,
Dec 29, 2009, 2:19:46 PM12/29/09
to
Thanks Tim for the fast reply, I probably should have mentioned this but the USB webcam is just a stepping stone to learn about writing a video streaming driver for windows. We didn't create this webcam I just found the specifications for it online and decided to use it as a stepping stone (its an older webcam so it doesn't conform to the USB standards). Once I understand video streaming drivers I will be moving onto writing a driver, for windows, to read in a custom video stream from a embedded Linux evaluation board.

WinDbg is something I have looked into but I have yet to master it. It's probably one of the most complicated debugging programs I have ever used. Yet I'm sure once I figure it out it will seem very easy to use.

I have looked into OutputDebugString but according to msdn I need to include windows.h, which doesn't play well with drivers.

Tim Roberts wrote:

Daniel wrote:No, the "way to go" is to build your webcam so that it adheres to
29-Dec-09

Daniel wrote:

No, the "way to go" is to build your webcam so that it adheres to the USB

Video Class Specification. If you do that, you do not need to write a


driver at all. Usbvideo.sys handles it all for you. You cannot get the
Windows Logo for a device that does not work with usbvideo.sys.


it is basically a plumbing problem. The samples (avshws and avssamp) have


"simulated" hardware classes providing the data. You just need to unbolt
the simulated class and supply your own USB interface class. You read the
descriptors at startup time, then select the proper alternate setting and
submit your own queue of URBs at the transition to "pause" mode.

AVStream will handle "connecting it to the stack" as long as the INF loads
the driver.


Well, that is really just "debugging with printf". The proper way to debug


kernel code is by using WinDbg.


I am not sure I understand the question. A user-mode app can write to
DebugView by using OutputDebugString, if you are really enamored with


DebugView. Personally, I'd rather use WinDbg or even the Visual Studio
debugger for my user-mode code.
--
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.

Previous Posts In This Thread:


Submitted via EggHeadCafe - Software Developer Portal of Choice

ASP.NET RSS/Atom FeedReader with just one line of code
http://www.eggheadcafe.com/tutorials/aspnet/c3ed5bbb-0967-46ee-87e9-810fc9b21a3c/aspnet-rssatom-feedread.aspx

Jeremy Noring

unread,
Dec 30, 2009, 1:58:52 PM12/30/09
to
On Dec 28, 10:27 pm, Tim Roberts <t...@probo.com> wrote:
> Daniel wrote:
>
> >I'm new to writing device drivers and my work has asked me to write
> >a driver for a USB webcam. After much research it seems that AVstream
> >is the way to go.
>
> No, the "way to go" is to build your webcam so that it adheres to the USB
> Video Class Specification.  If you do that, you don't need to write a
> driver at all.  Usbvideo.sys handles it all for you.  You cannot get the
> Windows Logo for a device that does not work with usbvideo.sys.

Tim,

A quick question, since you seem to know something about this--I saw
that the USB video class specification defined a set of pre-defined
outputs, such as MJPEG, raw YUV types and even MPEG2. Is there any
way to inform usbvideo.sys about a custom media type? (like, say I
want to output H.264, for example, and I want to use one of the
existent H.264 media subtypes on the output pin)

Tim Roberts

unread,
Dec 30, 2009, 11:13:06 PM12/30/09
to
Daniel K wrote:
>
>I have looked into OutputDebugString but according to msdn I need to
>include windows.h, which doesn't play well with drivers.

You asked about debugging your apps. OutputDebugString is the user-mode
API that writes to the debug log, just like DbgPrint and KdPrint do in
kernel mode.

Tim Roberts

unread,
Dec 30, 2009, 11:27:50 PM12/30/09
to
Jeremy Noring <kid...@gmail.com> wrote:
>
>A quick question, since you seem to know something about this--I saw
>that the USB video class specification defined a set of pre-defined
>outputs, such as MJPEG, raw YUV types and even MPEG2. Is there any
>way to inform usbvideo.sys about a custom media type? (like, say I
>want to output H.264, for example, and I want to use one of the
>existent H.264 media subtypes on the output pin)

If you package your H.264 frames inside an MPEG2 Transport Stream, then
usbvideo.sys will handle it.

0 new messages