After you get information of your webcam and figure out it's a Microdia cam (List of Known Microdia Webcams),
you probably want to download and test the latest experimental microdia driver version from our source repository. This page will help you do it.
The Microdia drivers are stored in the following Git repository: http://repo.or.cz/w/microdia.git
Note: To download it you must have installed Git in your system. If you don't, take a look here : [Link]
1. Download the source code
From a command-line prompt, cd to a directory where you want to download it, then run the command:
$ git clone http://repo.or.cz/r/microdia.git
This will create a folder named "microdia" which contains all the source code.
Sometimes the above command doesn't work. In such cases please try this one:
$ git clone http://repo.or.cz/microdia.git
2. Install bare minimum packages
To be able to compile the driver, you must have kernel sources and the necessary tools to compile it. For most applications you will also need libv4l.
-
Debian/Ubuntu
# apt-get install kernel-package linux-headers build-essential ctags libv4l
Note: linux-source is not necessary, rather linux-headers with the same version of your kernel will install /lib/modules/<kernel_version>/build.
for details refer to here. if you use the latest kernel of ubuntu, linux-headers depends on it. libv4l package may not be available in the stable distribution so I'm attacheing a version that installs on debian lenny.
-
Gentoo
# emerge -av gentoo-sources libv4l
-
Fedora
# yum install git kernel-devel gcc make libv4l
-
openSUSE
# have a Repository /drivers:/webcam (OpenSUSE 11 updated) with a microdia Kernel Driver (kmp)
-
Arch Linux
Driver lies in AUR, http://aur.archlinux.org/packages.php?ID=17451.
If you have yaourt:
# yaourt -S microdia-git
Or to do it manually, create a folder, download the PKGBUILD to that folder, and use:
$ makepkg
# pacman -U microdia-git*.pkg.tar.gz
-
FIXME: Add your distro here
3. Setting up the compilation environment
The linux kernel needs to be locally compiled in order to compile the microdia driver.
If the kernel is not compiled, "make" will complain of "modpost" missing.
The Makefile expects the source of linux to be located in /lib/modules/$(KVER)/build, if this is not the case edit the Makefile to set KSRC to point to the linux source location.
4. Building Microdia driver from source
After installing Git, you need to download microdia kernel driver source.
After installing Kernel packages and necessary tools to compile it,
you will be able to compile it by typing:
$ cd microdia
$ make
Attention: Do _NOT_ under any circumstances use "$ sudo make" or "# make". There are no root privileges necessary at this point and using them causes a never ending chain of different problems later on.
Troubleshooting MAKE errors
If you get the following error:
make: *** [driver] Error 127
Error 127 simply means that the module is not in the proper location. This is not a major error.
5. Loading the driver
Now comes el gran finale. Using root user (su), load the driver module by typing:
# insmod ./sn9c20x.ko
If everything works fine you won't see any message on stdout, but your dmesg will have lines like the following:
sn9c20x: SN9C20X USB 2.0 webcam driver loaded
sn9c20x: SN9C20X USB 2.0 Webcam - 0C45:624E plugged-in.
sn9c20x: Detected SOI968 Sensor
sn9c20x: SN9C20X USB 2.0 Webcam is now controlling video device /dev/video0
usbcore: registered new interface driver usb_sn9c20x_driver
sn9c20x: v2008.10 : SN9C20X USB 2.0 Webcam Driver
So, congratulations! Your webcam is ready for action now. If not:
Troubleshooting insmod errors
# insmod sn9c20x.ko
insmod: error inserting 'sn9c20x.ko': -1 Unknown symbol in module
See the output of #dmesg
The last few lines would be complaints about missing symbols, depending upon whats missing
you may not have loaded the modules that module depends on,
So it failed with those error messages. You would need to modprobe for that module's dependencies
Try:
# sudo modprobe videodev
# sudo modprobe compat-ioctl32
then
# sudo insmod sn9c20x.ko
If still you get errors on #insmod, perhaps you have had a recent kernel update.
Update a the lists the dependencies for every module.
# depmod -a
# m-a update,prepare
You may also need to regenerate kernel initrd image (really).
insmod: error inserting './sn9c20x.ko': -1 Invalid module format
Possible Reason
"The gcc which compiled the kernel and
the gcc which compiled the module are incompatible."
Possible Solution
Install an older gcc side-by-side, and change cc environment variable to use older version.
Possible Solution
Reinstall the kernel image using
#apt-get install --reinstall linux-image-`uname -r`
Possible Reason 2
This happened to me(may be more people) when ubuntu Jaunty was upgdated with a 2.6.28-14-generic
kernel.
If your dmesg says something like:
microdia: Unknown symbol video_devdata
The videodev module needs to be loaded.
Possible Solution
modprobe videodev
insmod sn9c20.ko (from the directory where you have this file, i.e, where you compiled it)
FIXME: more possibilities
6. Test it using mplayer
Please note that the test requires libv4l for video decoding. mplayer does not support JPEG compression on its own.
$ LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so mplayer tv:// \
-tv driver=v4l2:width=640:height=480:fps=25:device=/dev/video0 -vo x11
7. Installing the Microdia Driver
This step is optional. If you don't do it though you will have to insmod sn9c20x.ko everytime you reboot.
# strip -g sn9c20x.ko
# mkdir -p /lib/modules/`uname -r`/kernel/drivers/media/video/usbvideo/
# cp sn9c20x.ko /lib/modules/`uname -r`/kernel/drivers/media/video/usbvideo/
# depmod -a