PATCH: gspca-mercurial fix sn9c103 decoding frames
"Andoni Zubimendi" <[email protected]> Sat, 5 Jul 2008 12:05:07 -0300
| Newsgroups | gmane.linux.drivers.spca50x.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi All, This patch makes the sonixb gspca driver decode the frames correctly with this bridge. The problem with the decoding is the header size, that is different in SN9C103, it is 6 bytes bigger. Now my webcam works with wrong colors, I'm looking at the documentation of the sensor it has (OV7630) to see what's going on. Also have some other drivers that work with this sensor. Any hints appreciated. I'm attaching a picture taken with camorama and libv4lconvert. Regards, Andoni ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Spca50x-devs mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/spca50x-devs
gspca_make_sn9c103_work.diff
(text/x-patch, 2.8 KB)
The header size of the data received from the bridge differs from bridges SN9C101/2 and bridge SN9C103. The latter has 6 additional bytes in the header. We have to differenciate the bridge, to know the header size. Signed-off-by: Andoni Zubimendi <[email protected]> diff -r 3bbf8991628b linux/drivers/media/video/gspca/sonixb.c --- a/linux/drivers/media/video/gspca/sonixb.c Sat Jul 05 13:49:20 2008 +0200 +++ b/linux/drivers/media/video/gspca/sonixb.c Sat Jul 05 11:15:27 2008 -0300 @@ -47,6 +47,9 @@ #define SENSOR_PAS202 5 #define SENSOR_TAS5110 6 #define SENSOR_TAS5130CXX 7 + unsigned char customid; +#define SN9C101_2 0 +#define SN9C103 1 }; #define COMP2 0x8f @@ -527,38 +530,47 @@ case 0x6005: /* SN9C101 */ case 0x6007: /* SN9C101 */ sd->sensor = SENSOR_TAS5110; + sd->customid = SN9C101_2; sif = 1; break; case 0x6009: /* SN9C101 */ case 0x600d: /* SN9C101 */ case 0x6029: /* SN9C101 */ sd->sensor = SENSOR_PAS106; + sd->customid = SN9C101_2; sif = 1; break; case 0x6011: /* SN9C101 - SN9C101G */ sd->sensor = SENSOR_OV6650; + sd->customid = SN9C101_2; sif = 1; break; case 0x6019: /* SN9C101 */ case 0x602c: /* SN9C102 */ case 0x602e: /* SN9C102 */ sd->sensor = SENSOR_OV7630; + sd->customid = SN9C101_2; break; case 0x60b0: /* SN9C103 */ sd->sensor = SENSOR_OV7630_3; + sd->customid = SN9C103; break; case 0x6024: /* SN9C102 */ case 0x6025: /* SN9C102 */ sd->sensor = SENSOR_TAS5130CXX; + sd->customid = SN9C101_2; break; case 0x6028: /* SN9C102 */ sd->sensor = SENSOR_PAS202; + sd->customid = SN9C101_2; break; case 0x602d: /* SN9C102 */ sd->sensor = SENSOR_HV7131R; + sd->customid = SN9C101_2; break; case 0x60af: /* SN9C103 */ sd->sensor = SENSOR_PAS202; + sd->customid = SN9C103; break; } /* break; */ @@ -778,12 +790,29 @@ { } +static inline int getheaderlength(struct gspca_dev *gspca_dev) +{ + struct sd *sd = (struct sd *) gspca_dev; + int len; + + switch(sd->customid) { + case SN9C103: + len = 18; + case SN9C101_2: + default: + len = 12; + } + return len; +} + static void sd_pkt_scan(struct gspca_dev *gspca_dev, struct gspca_frame *frame, /* target */ unsigned char *data, /* isoc packet */ int len) /* iso packet length */ { int i; + + int headlen = getheaderlength(gspca_dev); if (len > 6 && len < 24) { for (i = 0; i < len - 6; i++) { @@ -795,8 +824,8 @@ && data[5 + i] == 0x96) { /* start of frame */ frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame, data, 0); - data += i + 12; - len -= i + 12; + data += i + headlen; + len -= i + headlen; gspca_frame_add(gspca_dev, FIRST_PACKET, frame, data, len); return;
Webcam.png
(image/png, 43.5 KB) - not displayed