Ok, this is not a tech blog, but I am a techie, and I discovered something today that hopefully helps someone someplace.

I just upgraded to the latest Ubuntu 11.04 on an old laptop with a built-in webcam.  The official kernel driver for the webcam sucks, but you can get a good one here:

git clone http://repo.or.cz/r/microdia.git

You’ll have to make this yourself.  There’s a link to to do that below.  First note, however, that the files reference an include file that no longer ships with Ubuntu.  That is videodef.h — an include file for V4L version 1, which is no longer supported.

So , you’ll need to edit out a line in sn9c20x-queue.c.

Change:

#include <linux/videodev.h>

to

/* #include <linux/videodev.h> */

(i.e. comment it out).

Then follow the rest of these instructions:  http://ubuntuforums.org/showpost.php?p=7456689&postcount=4

You’ll also need to remove the standard-issue sn9c20x driver (gspca_sn9c20x) from /lib/modules/(linux kernel version)/kernel/drivers/media/video/gspca:

sudo rmmod gspca_sn9c20x

I just moved it to my homedir so it wouldn’t be probed:

mv /lib/modules/(whatever)/kernel/drivers/media/video/gspca_sn9c20x.ko  ~

And put the sn9c20x.ko driver in:

cp /(wherever you ran make)/sn9c20x.ko /lib/modules/(whatever)/kernel/drivers/media/video

depmod -ae

Voila.  Webcam works again.  Whatever videodev.h provides has been replaced elsewhere.  For Skype you’ll still want to use compatibility libraries, running it this way:

LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so /usr/bin/skype

Hope that helps someone!

#!/bin/bash
LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so /usr/bin/skype

6 comments

  1. Someone should make a .deb out of it. I have one of those SN9C201-powered cams out there, and while Sonix Technology does provide drivers for Windows and OS X, I’m afraid that people who just happened to have one, and are not that experienced with -nix, might end up getting bummed up about it.

  2. Thank you, very nice post.

    Could you probably have an idea why may I be entirely missing my Microdia camera in lsusb (and lshw)? It is built in my lenovo 3000 n100 notebook. I am asking because I am sure I *did have it working in Ubuntu*, may be it was 8.04, but many kernels ago it stopped appearing in lsusb, and obviously no hacking around the drivers may help.

    Regards,
    Mike

  3. very good instructions, the best so far on the net (I searched days/nights for it and did now some time for getting it to work):

    I am trying now with Ubuntu 12.04 on my older Thinkpad Z61m, however without success (my webcam is 0c45:627b Microdia PC Camera (SN9C201 + OV7660)

    Did you try with 12.04 and if yes could you send me the instructions?
    (I am getting errors during “make microdia”, so probably some data is already outdated.

    kind regards, your help is highly appreciated
    JM

    (ubuntu newbie but open to learn…)

  4. @Joseph Smith — apologies for long delay. I had the same laptop (z61m) and camera but I sold it a few months ago, so I can’t really provide any further help. I hope you (and/or Ubuntu) has worked it out by now.

    Incidentally, I don’t use Ubuntu anymore– in my opinion, their attempt to make X too tablet-friendly made it too computer-unfriendly. I recommend Mint Linux, which is basically Ubuntu with fewer Microsoft-style annoyances.

  5. @msulyaev — Sorry, I have no idea why it would disappear from lsusb. Have you checked dmesg? It could be faulty hardware, but that’s usually a last-resort diagnosis. I didn’t have problems finding mine with lsusb in Ubuntu.

Leave a Reply

Your email address will not be published. Required fields are marked *

*