Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Using sq905 webcam driver with SQ905-based camera
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
crusti
n00b
n00b


Joined: 21 Jun 2004
Posts: 17
Location: Canada

PostPosted: Sat Jul 10, 2004 6:44 am    Post subject: Using sq905 webcam driver with SQ905-based camera Reply with quote

Using sq905 webcam driver with SQ905-based camera

Some of the webcams out there are of the vend/prod 2770/9120 variety. Among these are webcams with an SQ905 chipset. There is a driver available which can be downloaded from sourceforge.net under the name sq905cam-0.1a.tar.gz. This driver attempts to work with such a webcam.

Here are a few hints that I've learned while messing around with the driver and webcam:

    Compiling the driver on the 2.4 kernel
    Fixing the red/blue reversal

Compiling the driver on the 2.4 kernel
First, download the tarball; you can get it through the following link:
http://sourceforge.net/project/showfiles.php?group_id=92691&package_id=98114&release_id=207078
Put the file somewhere you have write privledges, like /home/you/ and unpack the tarball with the following command:
Code:
$ tar -zxvf sq905cam-0.1a.tar.gz

Now enter the directory:
Code:
$ cd sq905cam-dir

There is a file called sq905.o and that is a pre-compiled binary file. It's compiled for a specific version of the kernel, and if you don't have that version it may not work properly. The best thing to do is to compile a new sq905.o using make, but first you must delete sq905.o or else the make program will tell you that everything is up-to-date and you'll get nothing.
Code:
$ rm -f sq905.o

Next use the make command to compile a new sq905.o file.
Code:
$ make

Now move this new compiled driver into its proper place in the tree, probably someplace where there are other drivers of a similar type. In my case, it's the following:
Code:
# mv sq905.o /lib/modules/2.4.xx/kernel/drivers/media/video/

Now you have to insert the module into the running kernel to use it.
Code:
# modprobe sq905

And if there are no errors, you should see sq905 on a list of installed modules using lsmod.
Please note, that first character is a lowercase L:
Code:
# lsmod

In order to have this module loaded at boot, you can put it into the file:
/etc/modules.autoload.d/kernel-2.4
The entry should look like this:
sq905
Pretty simple, but I don't want to leave you wondering.
If all worked out correctly, after you boot with your webcam connected you should be able to use an application like effectv to see yourself in a window on your screen, probably using /dev/video0 as the input device file.


Fixing the red/blue reversal
With my particular webcam, if I don't change the source code in sq905.c then I get an image which is oriented properly, but has the red and blue colors reversed. After much headache, I came across a simple fix.

Here is the original excerpt from sq905.c:
Code:
static int tile_colors[8][4] = {
   {0, 1, 1, 2},
   {1, 0, 2, 1},
   {2, 1, 1, 0},
   {1, 2, 0, 1},
   {0, 1, 1, 2},
   {1, 0, 2, 1},
   {2, 1, 1, 0},
   {1, 2, 0, 1}};

#define RED 0
#define GREEN 1
#define BLUE 2

And here is what I did to change that code:
Code:
#define A 2
#define B 1
#define C 0

#define RED A
#define GREEN B
#define BLUE C

static int tile_colors[8][4] = {
   {A, B, B, C},
   {B, A, C, B},
   {C, B, B, A},
   {B, C, A, B},
   {A, B, B, C},
   {B, A, C, B},
   {C, B, B, A},
   {B, C, A, B}};


A, B, and C are used to ensure there is correlation between the RED, GREEN, BLUE variable values and their counterparts in the integer matrix, as in the original code. Of course, the original code shows RED=0 BLUE=2, and my fix gives RED=2, BLUE=0. The variable values and the matrix must match. Now when you compile and install the driver, you should see yourself in correct color.

Hope this is of some use to somebody, perhaps I can spare you some hours of wondering.

crusti
_________________
Gentoo 2004.1 with vanilla sources
Kernel 2.4.26
PentiumII 333 MHz MMX (i686)
192Mb RAM
384 Mb swap
ASUS P2L97 Rev 2.05
ATI 3D Rage Pro AGP 2x 4096Kb
Kingston KNE100TX Fast Ethernet
Creative Tech 94 sound card
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum