gspcav2-2.0.4 testing
"Andoni Zubimendi" <[email protected]> Sat, 28 Jun 2008 11:46:34 -0300
| Newsgroups | gmane.linux.drivers.spca50x.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi! I've been testing my webcam (a sn9c103 with ov7630) with the latest version of the driver, I don't have it working yet. But now the grab.c program output something in toto.jpg (972 bytes). Something that happens now that didn't happen with the previous versión is that the green light of the camera, flashes (it's on just a moment). As far as I can see from the logs, the initialization is good, because the camera sends some frames (3 frames: 972, 990 and 14 bytes each). I'm attaching all the patches I've made to the last version. Some are fixes, and some are costumization I've made to attach me to my sniff logs. I also attach the toto.jpg file generated by the grab.c program and the usbmon log of that execution. ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Spca50x-devs mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/spca50x-devs
001_add-bridge-header-len.patch
(application/octet-stream, 3.2 KB)
diff -urN gspcav2-2.0.4.orig/sonixb.c gspcav2-2.0.4.new/sonixb.c
--- gspcav2-2.0.4.orig/sonixb.c 2008-06-26 16:29:06.000000000 -0300
+++ gspcav2-2.0.4.new/sonixb.c 2008-06-28 10:42:40.000000000 -0300
@@ -41,7 +41,10 @@
unsigned char brightness;
unsigned char contrast;
-
+ char bridge; /* Type of bridge */
+#define BRIDGE_SN9C101 0
+#define BRIDGE_SN9C102 1
+#define BRIDGE_SN9C103 2
char sensor; /* Type of image sensor chip */
#define SENSOR_HV7131R 0
#define SENSOR_OV6650 1
@@ -502,15 +505,21 @@
/* case 0x0c45: * Sonix */
switch (product) {
case 0x6001: /* SN9C102 */
+ sd->sensor = SENSOR_TAS5110;
+ sd->bridge = BRIDGE_SN9C102;
+ sif = 1;
+ break;
case 0x6005: /* SN9C101 */
case 0x6007: /* SN9C101 */
sd->sensor = SENSOR_TAS5110;
+ sd->bridge = BRIDGE_SN9C101;
sif = 1;
break;
case 0x6009: /* SN9C101 */
case 0x600d: /* SN9C101 */
case 0x6029: /* SN9C101 */
sd->sensor = SENSOR_PAS106;
+ sd->bridge = BRIDGE_SN9C101;
sif = 1;
break;
case 0x6011: /* SN9C101 - SN9C101G */
@@ -518,25 +527,34 @@
sif = 1;
break;
case 0x6019: /* SN9C101 */
+ sd->sensor = SENSOR_OV7630;
+ sd->bridge = BRIDGE_SN9C101;
+ break;
case 0x602c: /* SN9C102 */
case 0x602e: /* SN9C102 */
sd->sensor = SENSOR_OV7630;
+ sd->bridge = BRIDGE_SN9C102;
break;
case 0x60b0: /* SN9C103 */
sd->sensor = SENSOR_OV7630_3;
+ sd->bridge = BRIDGE_SN9C103;
break;
case 0x6024: /* SN9C102 */
case 0x6025: /* SN9C102 */
sd->sensor = SENSOR_TAS5130CXX;
+ sd->bridge = BRIDGE_SN9C102;
break;
case 0x6028: /* SN9C102 */
sd->sensor = SENSOR_PAS202;
+ sd->bridge = BRIDGE_SN9C102;
break;
case 0x602d: /* SN9C102 */
sd->sensor = SENSOR_HV7131R;
+ sd->bridge = BRIDGE_SN9C102;
break;
case 0x60af: /* SN9C103 */
sd->sensor = SENSOR_PAS202;
+ sd->bridge = BRIDGE_SN9C103;
break;
}
/* break; */
@@ -893,6 +911,18 @@
}
}
+static inline int bridge_header_size(int bridge)
+{
+ switch (bridge) {
+ case BRIDGE_SN9C103:
+ return 18;
+ case BRIDGE_SN9C101:
+ case BRIDGE_SN9C102:
+ default:
+ return 12;
+ }
+}
+
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
unsigned char *data, /* isoc packet */
@@ -900,9 +930,10 @@
{
struct sd *sd = (struct sd *) gspca_dev;
int p;
+ int headlen = bridge_header_size(sd->bridge);
/*fixme:andoni: paquet de 900! */
- if (len > 6 && len < 24) {
+ if (len > 6) {
for (p = 0; p < len - 6; p++) {
if (data[0 + p] == 0xff
&& data[1 + p] == 0xff
@@ -912,6 +943,11 @@
&& data[5 + p] == 0x96) { /* start of frame */
if (gspca_dev->last_packet_type ==
FIRST_PACKET) {
+
+ if (p && sd->buflen + p > sizeof sd->tmpbuf) {
+ memcpy(&sd->tmpbuf[sd->buflen], data, p);
+ sd->buflen += p;
+ }
sonix_decompress(gspca_dev);
frame = gspca_frame_add(gspca_dev,
LAST_PACKET,
@@ -921,8 +957,8 @@
}
gspca_frame_add(gspca_dev, FIRST_PACKET,
frame, data, 0);
- data += 12;
- len -= 12;
+ data += headlen + p;
+ len -= headlen + p;
if (len > 0)
memcpy(sd->tmpbuf, data, len);
else len = 0;
002_patch-fix-initialization.patch
(application/octet-stream, 2.3 KB)
diff -urN gspcav2-2.0.4.new/sonixb.c gspcav2-2.0.4.new.2/sonixb.c
--- gspcav2-2.0.4.new/sonixb.c 2008-06-28 10:42:40.000000000 -0300
+++ gspcav2-2.0.4.new.2/sonixb.c 2008-06-28 10:53:05.000000000 -0300
@@ -622,42 +622,49 @@
switch (sd->sensor) {
case SENSOR_HV7131R:
sn9c10x = initHv7131;
+ l = sizeof(initHv7131);
reg17_19[0] = 0x60;
reg17_19[1] = (mode << 4) | 0x8a;
reg17_19[2] = 0x20;
break;
case SENSOR_OV6650:
sn9c10x = initOv6650;
+ l = sizeof(initOv6650);
reg17_19[0] = 0x68;
reg17_19[1] = (mode << 4) | 0x8b;
reg17_19[2] = 0x20;
break;
case SENSOR_OV7630:
sn9c10x = initOv7630;
+ l = sizeof(initOv7630);
reg17_19[0] = 0x68;
reg17_19[1] = (mode << 4) | COMP2;
reg17_19[2] = MCK_INIT1;
break;
case SENSOR_OV7630_3:
sn9c10x = initOv7630_3;
+ l = sizeof(initOv7630_3);
reg17_19[0] = 0x68;
reg17_19[1] = (mode << 4) | COMP2;
reg17_19[2] = MCK_INIT1;
break;
case SENSOR_PAS106:
sn9c10x = initPas106;
+ l = sizeof(initPas106);
reg17_19[0] = 0x24; /* 0x28 */
reg17_19[1] = (mode << 4) | COMP1;
reg17_19[2] = MCK_INIT1;
break;
case SENSOR_PAS202:
sn9c10x = initPas202;
+ l = sizeof(initPas202);
reg17_19[0] = mode ? 0x24 : 0x20;
reg17_19[1] = (mode << 4) | 0x89;
reg17_19[2] = 0x20;
break;
case SENSOR_TAS5110:
sn9c10x = initTas5110;
+ l = sizeof(initTas5110);
reg17_19[0] = 0x60;
reg17_19[1] = (mode << 4) | 0x86;
reg17_19[2] = 0x2b; /* 0xf3; */
@@ -665,6 +672,7 @@
default:
/* case SENSOR_TAS5130CXX: */
sn9c10x = initTas5130;
+ l = sizeof(initTas5130);
reg17_19[0] = 0x60;
reg17_19[1] = (mode << 4) | COMP;
reg17_19[2] = mode ? 0x23 : 0x43;
@@ -674,17 +682,14 @@
case SENSOR_OV7630:
reg01 = 0x06;
reg17 = 0x29;
- l = 0x10;
break;
case SENSOR_OV7630_3:
reg01 = 0x44;
reg17 = 0x68;
- l = 0x10;
break;
default:
reg01 = sn9c10x[0];
reg17 = sn9c10x[0x17 - 1];
- l = 0x1f;
break;
}
@@ -692,8 +697,9 @@
reg_w(dev, 0x01, ®01, 1);
/* reg 0x17 SensorClk enable inv Clk 0x60 */
reg_w(dev, 0x17, ®17, 1);
-/*fixme: for ov7630
- reg_w(dev, 0x01, {0x06, sn9c10x[1]}, 2); */
+
+ if (sd->sensor == SENSOR_OV7630_3)
+ reg_w(dev, 0x01, sn9c10x, 2);
/* Set the registers from the template */
reg_w(dev, 0x01, sn9c10x, l);
switch (sd->sensor) {
003_patch-debug_frame.diff
(text/x-patch, 399 B)
diff -urN gspcav2-2.0.4.new.2/sonixb.c gspcav2-2.0.4/sonixb.c
--- gspcav2-2.0.4.new.2/sonixb.c 2008-06-28 10:53:05.000000000 -0300
+++ gspcav2-2.0.4/sonixb.c 2008-06-28 10:56:45.000000000 -0300
@@ -866,6 +874,8 @@
int bitpos;
unsigned char code;
+ PDEBUG(D_ERR, "decoding frame %d (%dx%d)", sd->buflen,
+ width, height);
bitpos = 0;
for (row = 0; row < height; row++) {
col = 0;
004_patch-probe-ov7630.diff
(text/x-patch, 603 B)
diff -urN gspcav2-2.0.4.new.3/sonixb.c gspcav2-2.0.4.new.4/sonixb.c --- gspcav2-2.0.4.new.3/sonixb.c 2008-06-28 11:00:01.000000000 -0300 +++ gspcav2-2.0.4.new.4/sonixb.c 2008-06-28 11:05:17.000000000 -0300 @@ -573,7 +573,8 @@ sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value; sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value; #if 0 - if (sd->sensor == SENSOR_OV7630) /* jfm: from win trace */ + if (sd->sensor == SENSOR_OV7630 /* jfm: from win trace */ + || sd->sensor == SENSOR_OV7630_3) reg_w(gspca_dev->dev, 0x01, probe_ov7630, sizeof probe_ov7630); #endif return 0;
005_fix_send_zeros.diff
(text/x-patch, 324 B)
diff -urN gspcav2-2.0.4/sonixb.c gspcav2-2.0.4.new.5/sonixb.c --- gspcav2-2.0.4/sonixb.c 2008-06-28 11:07:05.000000000 -0300 +++ gspcav2-2.0.4.new.5/sonixb.c 2008-06-28 11:16:55.000000000 -0300 @@ -390,7 +390,7 @@ reg_w(dev, 0x08, *buffer, 8); buffer++; len -= 8; - if (len < 0) + if (len <= 0) break; } }
006_patch-misc.diff
(text/x-patch, 3.4 KB)
diff -urN gspcav2-2.0.4.new.4/sonixb.c gspcav2-2.0.4/sonixb.c
--- gspcav2-2.0.4.new.4/sonixb.c 2008-06-28 11:05:17.000000000 -0300
+++ gspcav2-2.0.4/sonixb.c 2008-06-28 11:07:05.000000000 -0300
@@ -193,13 +193,16 @@
0x68, COMP1, MCK_INIT1, /* r17 .. r19 */
0x1d, 0x10, 0x02, 0x03, 0x0f, 0x0c /* r1a .. r1f */
};
+
static const __u8 initOv7630_3[] = {
0x44, 0x44, 0x00, 0x1a, 0x20, 0x20, 0x20, 0x80, /* r01 .. r08 */
0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, /* r09 .. r10 */
- 0x00, 0x02, 0x01, 0x0a, /* r11 .. r14 */
+ 0x00, 0x01, 0x01, 0x0a, /* r11 .. r14 */
0x28, 0x1e, /* H & V sizes r15 .. r16 */
0x68, COMP1, MCK_INIT1, /* r17 .. r19 */
- 0x1d, 0x10, 0x02, 0x03, 0x0f, 0x0c /* r1a .. r1f */
+ 0x1d, 0x10, 0x02, 0x03, 0x0f, 0x0c, 0x00, /* r1a .. r20 */
+ 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80,
+ 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0, 0xff
};
static const __u8 ov7630_sensor_init_com[][8] = {
{0xa0, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10},
@@ -210,8 +213,8 @@
{0xa0, 0x21, 0x20, 0x44, 0x00, 0x80, 0x34, 0x10},
{0xa0, 0x21, 0x23, 0xee, 0x00, 0x80, 0x34, 0x10},
{0xd0, 0x21, 0x26, 0xa0, 0x9a, 0xa0, 0x30, 0x10},
- {0xb0, 0x21, 0x2a, 0x80, 0x00, 0xa0, 0x30, 0x10},
{0xb0, 0x21, 0x2f, 0x3d, 0x24, 0xa0, 0x30, 0x10},
+ {0xb0, 0x21, 0x2a, 0x80, 0x00, 0xa0, 0x30, 0x10},
{0xa0, 0x21, 0x32, 0x86, 0x24, 0xa0, 0x30, 0x10},
/* {0xb0, 0x21, 0x60, 0xa9, 0x4a, 0xa0, 0x30, 0x10}, jfm */
{0xb0, 0x21, 0x60, 0xa9, 0x42, 0xa0, 0x30, 0x10}, /* jfm */
@@ -229,6 +232,7 @@
{0xa0, 0x21, 0x76, 0x02, 0xbd, 0x06, 0xf6, 0x16},
{0xa0, 0x21, 0x00, 0x10, 0xbd, 0x06, 0xf6, 0x15}, /* gain */
};
+
static const __u8 ov7630_sensor_init_3[][8] = {
{0xa0, 0x21, 0x10, 0x36, 0xbd, 0x06, 0xf6, 0x16}, /* exposure */
{0xa0, 0x21, 0x76, 0x03, 0xbd, 0x06, 0xf6, 0x16},
@@ -723,8 +727,6 @@
i2c_w_vector(dev, ov7630_sensor_init_com,
sizeof ov7630_sensor_init_com);
msleep(200);
- i2c_w_vector(dev, ov7630_sensor_init_3,
- sizeof ov7630_sensor_init_3);
break;
case SENSOR_PAS106:
pas106_i2cinit(dev);
@@ -743,27 +745,32 @@
sizeof tas5130_sensor_init);
break;
}
+ /* AE_STRX AE_STRY AE_ENDX AE_ENDY */
+ reg_w(dev, 0x1c, &sn9c10x[0x1c - 1], 4);
/* H_size V_size 0x28, 0x1e maybe 640x480 */
reg_w(dev, 0x15, &sn9c10x[0x15 - 1], 2);
- /* compression register */
+ /* compression register */
reg_w(dev, 0x18, ®17_19[1], 1);
- /* H_start */ /*fixme: not ov7630*/
- reg_w(dev, 0x12, &sn9c10x[0x12 - 1], 1);
- /* V_START */ /*fixme: not ov7630*/
- reg_w(dev, 0x13, &sn9c10x[0x13 - 1], 1);
+ /* Enable video transfert */
+ reg_w(dev, 0x01, &sn9c10x[0], 1);
/* reset 0x17 SensorClk enable inv Clk 0x60 */
/*fixme: ov7630 [17]=68 8f (+20 if 102)*/
- reg_w(dev, 0x17, ®17_19[0], 1);
+ reg_w(dev, 0x17, ®17_19[0], 2);
+ /* H_start */ /*fixme: not ov7630*/
+ //reg_w(dev, 0x12, &sn9c10x[0x12 - 1], 1);
+ /* V_START */ /*fixme: not ov7630*/
+ //reg_w(dev, 0x13, &sn9c10x[0x13 - 1], 1);
/*MCKSIZE ->3 */ /*fixme: not ov7630*/
- reg_w(dev, 0x19, ®17_19[2], 1);
- /* AE_STRX AE_STRY AE_ENDX AE_ENDY */
- reg_w(dev, 0x1c, &sn9c10x[0x1c - 1], 4);
- /* Enable video transfert */
- reg_w(dev, 0x01, &sn9c10x[0], 1);
+ //reg_w(dev, 0x19, ®17_19[2], 1);
/* Compression */
reg_w(dev, 0x18, ®17_19[1], 2);
msleep(20);
+ if (sd->sensor == SENSOR_OV7630_3) {
+ i2c_w_vector(dev, ov7630_sensor_init_3,
+ sizeof ov7630_sensor_init_3);
+ }
+
setcontrast(gspca_dev);
setbrightness(gspca_dev);
}
toto.jpg
(image/jpeg, 972 B) - not displayed
usbmon-log.txt
(text/plain, 5.3 KB) - not displayed