Thread: Writing USB webcam (UVC) driver

  1. #1
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,229

    Writing USB webcam (UVC) driver

    I'm thinking about writing a USB webcam (USB video class) driver for an embedded platform. Probably just going to implement things used by my webcam (only MJPEG payload, etc).

    I have very little experience with USB, but I have skimmed over the specifications and it doesn't seem overly complex and mostly make sense.

    The UVC document is fairly long... but I'm hoping I won't have to implement most things, as all I need to do is read MJPEG frames from the webcam, and write them directly to SD card. No decoding required.
    USB.org - Approved Device Class Document Download

    Has anyone done anything like this before? What's the most challenging part? Anything easily overlooked?

    Thanks

  2. #2
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by cyberfish View Post
    Has anyone done anything like this before? What's the most challenging part? Anything easily overlooked?
    WRT linux, I made a feeble attempt a few years ago but could not get the model specific end-point description from the webcam manufacturer. And that was that.

    As you say, "the UVC document is fairly long", like hundreds of pages, and it is just a general protocol describing things that may or may not be present in your device. Which without the model specific doc, you are pacing a dark basement filled with boxes and shelves, blindfolded with one hand tied behind your back, looking for for specific books and cans of paint. If you can sort them out by smell, great!

    Not to be discouraging, but that was the impression I walked away with. I might find it easier now but am not in any rush to head back. Support for USB web cams, beyond a few major manufacturers, in linux is poor because of this. Of course, if you already have a driver that works on your desktop, then you should be able to look at the source for that.

    I believe in you, cyberfish. If you do get somewhere, come back and let me know!
    Last edited by MK27; 09-07-2011 at 06:50 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  3. #3
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,229
    Oh! That's good to know.

    I thought the point of UVC is that we won't need vendor-specific drivers anymore.

    I guess I should dig into the specs some more before I go ahead and design the hardware... I'm trying to make a glasses-mounted mini video camera that records to an SD card.

  4. #4
    Make Fortran great again
    Join Date
    Sep 2009
    Posts
    1,413
    Probably could get in touch with these guys and or look at these codes:
    Linux UVC driver & tools
    GTK+ UVC Viewer

  5. #5
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,229
    Thanks. That will definitely come in handy.

  6. #6
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Epy View Post
    Probably could get in touch with these guys and or look at these codes:
    Linux UVC driver & tools
    GTK+ UVC Viewer
    Hmm, this is a few years ago so my memory of it is unclear. My device ID is not on that list anyway. Maybe I thought the UVC would help if the device was "somewhat compliant".

    Moral: buy a known UVC compliant device.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Writing a linux hardware driver
    By nexusone in forum Linux Programming
    Replies: 1
    Last Post: 08-12-2008, 07:33 PM
  2. Writing a driver.
    By eXeCuTeR in forum C Programming
    Replies: 13
    Last Post: 07-06-2008, 06:09 PM
  3. Writing a driver...
    By Devil Panther in forum C Programming
    Replies: 4
    Last Post: 06-30-2005, 07:55 AM
  4. Driver writing for windows
    By BrownB in forum C Programming
    Replies: 1
    Last Post: 10-31-2003, 07:14 AM
  5. writing device driver
    By ronin in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 07-08-2002, 10:48 AM