HOWTO: Serval Performance (SERP2) webcam
by Kevin Godby
I spent a little time this evening working on getting the built-in webcam of my Serval Performance (SERP2) to function under Ubuntu Hardy (8.04).
I found a driver for the webcam here: https://groups.google.com/group/microdia.
Instructions on downloading and building the driver follow. For more thorough instructions, I’d recommend looking at Testing the Microdia driver.
Since we’ll be compiling a kernel driver, you’ll need to install the kernel source files:
$ sudo apt-get install kernel-package linux-source build-essential exuberant-ctags
Next you’ll need to install git
so we can download the driver’s source code:
$ sudo apt-get install git-core gitk git-gui git-doc curl
Now we’ll download the webcam driver:
$ git clone http://repo.or.cz/r/microdia.git
Let’s compile the kernel module (webcam driver):
$ cd microdia
The Microdia driver uses some functions that only exist in newer kernels. Check your kernel version:
$ uname -r
If the kernel version is less than 2.6.22, open the microdia.h file in a text editor and add the following two lines after the #define MICRODIA_H line (around line 35):
#define list_first_entry(ptr, type, member) \ list_entry((ptr)->next, type, member)
Make sure you included the initial hash mark (#). Save your file and continue with these instructions.
Now we’ll compile the Microdia driver:
$ make
Load the videodev kernel module so that /dev/video0 can be created:
$ sudo modprobe videodev
Now let’s load our new kernel driver:
$ sudo insmod ./microdia.ko
Check to see that the driver loaded successfully:
$ dmesg
You should see something like this at the bottom of the output:
[107348.616179] microdia: Microdia USB2.0 webcam driver startup [107348.616563] microdia: Microdia USB2.0 Webcam - Product ID 624F. [107348.616570] microdia: Release: 0100 [107348.616574] microdia: Number of interfaces : 1 [107348.623570] microdia: Microdia USB2.0 Camera is now controlling video device /dev/video0 [107348.623950] usbcore: registered new interface driver usb_microdia_driver
Now we can test the driver with Ekiga:
$ sudo apt-get install ekiga
Run Ekiga by selecting “Ekiga Softphone” from the “Internet” menu. After walking through the configuration wizard (if this is the first time you’ve run Ekiga), you should be able to test your webcam. During configuration, set the video manager to V4L2. You should see “Microdia USB Video Camera” listed in the video devices.
If all goes well, you may wish to install the kernel module/driver so that it will be loaded automatically each time you boot your computer.
Copy the driver to the kernel tree:
$ sudo cp microdia.ko /lib/modules/`uname -r`/kernel/drivers/media/video/usbvideo/
Now add the videodev and microdia drivers to your /etc/modules file so that they get loaded automatically every time you boot your computer:
$ sudo sh -c "echo videodev >> /etc/modules" $ sudo sh -c "echo microdia >> /etc/modules"
The biggest hurdle that I see is that you’d have to recompile the driver each time the kernel is upgraded. System76 is working on packaging it up as a System76 driver that can be updated as new kernels are released, and so that users don’t have to compile kernel drivers themselves (’cause let’s face it, no one should have to learn to do that!).
Please note that I didn’t write the driver; I just discovered it this evening and got it running.
If you run into any problems, see the Microdia kernel driver site for more details from the driver developers themselves. There is also a thread on the Ubuntu Forums covering this topic.
Comments
I have amd64 nvidia gforce laptop computer – ubuntu studio – hardy- kernel /usr/src/linux-headers-2.6.24-19-rt
I get compiling error
/home/johnwm/microdia/microdia-usb.c: In function ‘usb_microdia_isoc_handler’:
/home/johnwm/microdia/microdia-usb.c:333: error: size of array ‘type name’ is negative
/home/johnwm/microdia/microdia-usb.c:333: warning: comparison of distinct pointer types lacks a cast
/home/johnwm/microdia/microdia-usb.c:337: error: size of array ‘type name’ is negative
and,
/home/johnwm/microdia/microdia-usb.c:337: warning: comparison of distinct pointer types lacks a cast
Please email me if you see this –
I’m unable to compile the driver so far
July-30-2008
thanks for any help
Johnwm
Hello, Johnwm.
I haven’t seen that error message before. I just downloaded a fresh copy of the Microdia driver source code and recompiled it and it worked fine for me. One difference between our systems is the kernel. I’m using a slightly newer version (which I don’t think matters), and I’m using generic while you’re using real-time. I’m wondering if the real-time kernel has different function calls in some places.
I’d recommend emailing the developers of the Microdia drivers to see if they can help you more. I’m afraid since I’m not running the real-time kernel that I can’t be of much help. You can sign up for their email list here:
http://groups.google.com/group/microdia
At that same site, you can look in the “Pages” sections for more instructions and information that may be of some help.
Sorry I can’t be of more assistance. Best of luck, and please post back if you find a solution — it may very well help someone else in the future!
Thanks for writing.
–Kevin Godby
Hi kevin
thanks for replying.
I also have the generic current ubuntu 2.6.24-19-generic kernel to boot into.
The microdia module compiles on the generic
and works for me using xawtv. However, I cannot capture anything – picture or video. I’ve been hunting for answers on the microdia list so, as you said , I’ll probably find aswers there.
Yes there is defiantly some differences in the real-time kernel that don’t jibe with the module compile – that’s what I’ll be trackig info for.
I guess the web-cam is not quite ready for any music videos yet – pun intended : – )
Johnwm
Kevin:
I’m running 7.04. The make command fails. Any recommendations?
scott@ubuntu:~/microdia$ make
make -C /lib/modules/2.6.20-17-generic/build SUBDIRS=/home/scott/microdia modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.20-17-generic’
CC [M] /home/scott/microdia/microdia-usb.o
/home/scott/microdia/microdia-usb.c: In function ‘usb_microdia_isoc_handler’:
/home/scott/microdia/microdia-usb.c:335: warning: implicit declaration of function ‘list_first_entry’
/home/scott/microdia/microdia-usb.c:335: error: expected expression before ‘struct’
/home/scott/microdia/microdia-usb.c:336: warning: assignment makes pointer from integer without a cast
make[2]: *** [/home/scott/microdia/microdia-usb.o] Error 1
make[1]: *** [_module_/home/scott/microdia] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.20-17-generic’
make: *** [driver] Error 2
Thanks,
-Scott
Hello, Scott.
It looks like the list_first_entry macro wasn’t added until kernel version 2.6.22. There are a couple options:
Add the line after the #define MICRODIA_H line (around line 35).
If you choose the second option, please let me know if it works. If it does, I’ll add that to the instructions for those who are running older kernels.
Kevin:
Much thanks for your help.
dmesg returned correctly but VLC did not display video, giving the message:
scott@ubuntu:~/microdia$ vlc v4l:// :v4l-vdev=”/dev/video0″ :v4l-adev=”/dev/dsp” :v4l-norm=3 :v4l-frequency=-1
VLC media player 0.8.6 Janus
[00000291] v4l demuxer error: mmap unsupported
If there’s no easy fix, I’ll wait until I upgrade to 8.04.
-Scott
I had just upgraded my kernel and recompiled the latest Microdia driver. It looks like they rewrote it to use V4L2 instead of just V4L. Unfortunately, VLC doesn’t understand V4L2, so i got the same error message.
The camera does work fine in Ekiga, though. I’ll just need to write new test instructions.
Try running Ekiga (formerly called GNOME Meeting). You’ll find it under the “Internet” menu. Once you’ve walked through the configuration wizard (if it’s your first time running the program), you should be able to test your webcam.
Please let me know if you hit any snags.
I’ve updated the instructions on this page to include support for older kernels and replaced the VLC test with a test using Ekiga.
Kevin:
Tried Ekiga, but got this error message:
Error while opening video device Microdia USB Video Camera
…(irrelevant stuff omitted) …
Your video driver doesn’t support the requested video format.
-Scott
What a vague error message! 🙁
Try running ekiga -d 4 from the command-line and post the output. We’ll see if there’s anything more useful there.
I followed all the steps, but in the end got this error:
insmod: can’t read ‘./microdia.ko’: No such file or directory
If you type ls, does microdia.ko appear n the current directory? If not, you’ll need to change to that directory before running the insmod command.