Saturday, September 1, 2007

Camera

My father gave me a cheap webcam some time ago and I never got around to setting it up, today I felt like playing around a bit and decided that the camera would be todays victim, and fell it did :-)

Here are the steps I had to take:

Since I am using debian unstable things are a little bit more difficult for me then the average linux user. My first problem was to make sure the computer recognised the camera. I have a USB camera that I had no idea of what kind it was, all it said on the front was "Creative" (which is a company that all computer personal know) but that did not tell me much about what drivers to use for it or anything else. So it is a USB thing, then the command lsusb must show it (just like lspci shows all pci devices) and there it was:

Bus 001 Device 002: ID 041e:4028 Creative Technology, Ltd

ok, it has ID 041e:4028, lets head over to the guy who holds a good list over most of these cameras, a cool french physician who decided to make a lot of drivers for USB webcams in his retirement. There is a table somewhere there that shows all the different types of cameras and what company produces them and some other information. There I found my USB ID under PIXART

Creative 191 0x041e 0x4028 Vista Plus Pac207 Pac207 Yes gbrg spca5xx ****

This told me to use the spca5xx driver so I searched through the debian archive for this driver but all I came up with was the gspca-source package. After a little pondering I finally tossed my eyes over to the download page of the french mans front page and there lo and behold stood "for kernel up from 2.6.11 : gspcav1-20070508.tar.gz
for kernel below 2.6.11: spca5xx version 0.60.00-1:
spca5xx-v4l1goodbye.tar.gz". Ok, I had kernel version 2.6.17-2 (seen by uname -a), so did a aptitude install gspcd-source and read the README.Debian file for this package where it showed how to use module-assistant to compile these modules into the current kernel. I fired up module-assistant but it complained right away that I did not have any kernel headers on my computer that it could compile these modules against. Ok, lets search for my headers

apt-cache search kernel-headers-2.6.17

gave me no result what so ever! Damn.

After searching a bit I decided that these headers were just not available for Debian any more since it is an unstable kernel after all and I did not want to bother putting up my own custom headers (dont know how to do that) so I decided to upgrade my kernel instead.

aptitude install kernel-image-2.6.22-k7

Ok, reboot and problems start, first the aptitude did not run lilo for me automatically so I had to do it by hand after one reboot (should have checked, never trust computer guys :-) ) and tell it to use my new kernel. Then reboot and again more problems, it said it could not find the modules for this kernel and failed booting. Hmmm .. strange. I boot into the old kernel again and check if the modules are there and yes they are

ojs@heima:~$ ls /lib/modules/
2.6.17-2-k7 2.6.22-1-k7 2.6.8-2-386

After a bit of pondering I found that I had forgotten to change one line in my lilo.conf file, I had copy/pasted from the 2.6.17 lines and the initrd line still had the old kernel version, that is changed

initrd=/boot/initrd.img-2.6.17-2-k7

to

initrd=/boot/initrd.img-2.6.22-1-k7

Rerun lilo and the kernel was up and running.

After booting into the new kernel I installed the kernel header files

aptitude install kernel-headers-2.6.22-k7

and after that I followed the module building directions in the README.Debian file for gspca modules. There I noticed that this does actually build a debian package and used dpkg to install that package then, pretty nice if one wants to upgrade later on.

Now how do I let the kernel then use the webcam? For that I have to load the correct module that I just created with the module-assistant, but how do I find it. Well, since it uses the dpkg to install the modules it is no problem

dpkg -L package_name

shows all the files installed by that package and it installed only one module, gspca.

modprobe gspca

worked like a charm and then I all of a sudden had a working camera! The camorama program all of a sudden started showing a picture of me in front of my computer looking like a ... well, not gonna tell you.

That was that, now I have a working webcam, what to do with it I have no idea, thought about taking some pictures out of the window to show to friends and family from around the world but I dont think it can handle that, at least it gets all blurred and crazy, perhaps I just have to fiddle around with some settings.

This took me a while, about 20 hours, but in the meantime I slept for 8-9 hours, ate a lot, got a haircut, watched TV, procrastinated and tried to figure out how to use POP access to my gmail account (will blog about that later when I have completed that step).

3 comments:

Einar Örn said...

What about setting up a live camera in you room - overlooking the computer and the desk (and the poster of the nak.. woman on the wall)?

Ólafur Jens Sigurðsson said...

hey ... how did you know about the nak!

And this live camera thing is a bad idea ... you dont want to know what I do in front of my computer >:-)

Marigold said...

Good for people to know.