So can you please give things a try in 640x480 mode with the divisor kept at 3
or higher, and no changes to 2a / 13 ?
--- a/linux/drivers/media/video/gspca/sonixb.c 2008-07-21 20:41:08.000000000 -0300
+++ b/linux/drivers/media/video/gspca/sonixb.c 2008-07-21 20:40:03.000000000 -0300
@@ -774,6 +778,12 @@
i2c[1] = sd->sensor_addr;
i2c[3] = reg10;
i2c[4] |= reg11 - 1;
+
+ /* If register 11 didn't change, don't change it */
+ if (sd->reg11 == reg11 )
+ i2c[0] = 0xa0;
+
+ sd->reg11 = reg11;
if (i2c_w(gspca_dev, i2c) < 0)
PDEBUG(D_ERR, "i2c error exposure");
break;
@@ -910,7 +920,8 @@
sd->fr_h_sz = 12; /* default size of the frame header */
sd->sd_desc.nctrls = 2; /* default nb of ctrls */
sd->autogain = AUTOGAIN_DEF; /* default is autogain active */
-
+ sd->reg11 = 1;
+ sd->frames_to_drop = 0;
product = id->idProduct;
/* switch (id->idVendor) { */
/* case 0x0c45: * Sonix */
@@ -1205,6 +1216,7 @@
{
int i;
struct sd *sd = (struct sd *) gspca_dev;
+ int pkt_type = LAST_PACKET;
/* frames start with:
* ff ff 00 c4 c4 96 synchro
@@ -1223,8 +1235,6 @@
&& data[3 + i] == 0xc4
&& data[4 + i] == 0xc4
&& data[5 + i] == 0x96) { /* start of frame */
- frame = gspca_frame_add(gspca_dev, LAST_PACKET,
- frame, data, 0);
if (len - i < sd->fr_h_sz) {
atomic_set(&sd->avg_lum, -1);
PDEBUG(D_STREAM, "packet too short to"
@@ -1234,10 +1244,18 @@
data[i + 8] +
(data[i + 9] << 8));
} else {
- atomic_set(&sd->avg_lum,
- data[i + 9] +
- (data[i + 10] << 8));
+ unsigned short lum = data[i+9] +
+ (data[i + 10] << 8);
+ atomic_set(&sd->avg_lum, lum);
+ if (lum == 0)
+ sd->frames_to_drop = 2;
}
+ if (sd->frames_to_drop) {
+ sd->frames_to_drop--;
+ pkt_type = DISCARD_PACKET;
+ }
+ frame = gspca_frame_add(gspca_dev, pkt_type,
+ frame, data, 0);
data += i + sd->fr_h_sz;
len -= i + sd->fr_h_sz;
gspca_frame_add(gspca_dev, FIRST_PACKET,
diff -r 822926411b6e linux/drivers/media/video/gspca/sonixb.c
--- a/linux/drivers/media/video/gspca/sonixb.c Mon Jul 21 18:19:59 2008 +0200
+++ b/linux/drivers/media/video/gspca/sonixb.c Mon Jul 21 18:56:31 2008 -0300
@@ -358,7 +360,7 @@
{0xa0, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10},
{0xb0, 0x21, 0x01, 0x77, 0x3a, 0x00, 0x00, 0x10},
/* {0xd0, 0x21, 0x12, 0x7c, 0x01, 0x80, 0x34, 0x10}, jfm */
- {0xd0, 0x21, 0x12, 0x1c, 0x00, 0x80, 0x34, 0x10}, /* jfm */
+ {0xd0, 0x21, 0x12, 0x1c, 0x80, 0x80, 0x34, 0x10}, /* jfm */
{0xa0, 0x21, 0x1b, 0x04, 0x00, 0x80, 0x34, 0x10},
{0xa0, 0x21, 0x20, 0x44, 0x00, 0x80, 0x34, 0x10},
{0xa0, 0x21, 0x23, 0xee, 0x00, 0x80, 0x34, 0x10},
@@ -381,10 +383,6 @@
{0xa0, 0x21, 0x10, 0x57, 0xbd, 0x06, 0xf6, 0x16},
{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, 0x2a, 0xa0, 0x00, 0x00, 0x00, 0x10},
- {0xa0, 0x21, 0x2a, 0x80, 0x00, 0x00, 0x00, 0x10},
};
static const __u8 initPas106[] = {
@@ -768,19 +766,16 @@
else if (reg10 > reg10_max)
reg10 = reg10_max;
+ /* In 640x480, if the reg11 has less than 3, the image is
+ unstable. */
+ if (gspca_dev->cam.cam_mode[(int)gspca_dev->curr_mode].priv == 0
+ && reg11 < 3)
+ reg11 = 3;
+
/* Write reg 10 and reg11 low nibble */
i2c[1] = sd->sensor_addr;
i2c[3] = reg10;
i2c[4] |= reg11 - 1;
- if (sd->sensor == SENSOR_OV7630_3) {
- __u8 reg76 = reg10 & 0x03;
- __u8 i2c_reg76[] = {0xa0, 0x21, 0x76, 0x00,
- 0x00, 0x00, 0x00, 0x10};
- reg10 >>= 2;
- i2c_reg76[3] = reg76;
- if (i2c_w(gspca_dev, i2c_reg76) < 0)
- PDEBUG(D_ERR, "i2c error exposure");
- }
if (i2c_w(gspca_dev, i2c) < 0)
PDEBUG(D_ERR, "i2c error exposure");
break;
@@ -1138,7 +1133,6 @@
i2c_w_vector(gspca_dev, ov7630_sensor_init_com,
sizeof ov7630_sensor_init_com);
msleep(200);
- i2c_w(gspca_dev, ov7630_sensor_init_3[mode]);
break;
case SENSOR_PAS106:
pas106_i2cinit(gspca_dev);
Attachment:
00000021.jpg
Description: JPEG image
Attachment:
00000022.jpg
Description: JPEG image
------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________ Spca50x-devs mailing list Spca50x-devs@xxxxxxxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/spca50x-devs