summaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/pac7311.c
diff options
context:
space:
mode:
authorJean-Francois Moine <moinejf@free.fr>2008-09-03 16:47:33 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-09-03 18:36:37 -0300
commit285a4f6c8e518f03758c7b085bda13bb3795df0a (patch)
treeff8a1967de9bf98b1cd4cf973770928a05b03777 /drivers/media/video/gspca/pac7311.c
parent7879d459f1601be742d0d63930d17cd4aac956fd (diff)
V4L/DVB (8673): gspca: Bad frame scanning again and bad init in pac7311.
Signed-off-by: Jean-Francois Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/gspca/pac7311.c')
-rw-r--r--drivers/media/video/gspca/pac7311.c62
1 files changed, 50 insertions, 12 deletions
diff --git a/drivers/media/video/gspca/pac7311.c b/drivers/media/video/gspca/pac7311.c
index 730b4a1aed9..85d9ddbc5b7 100644
--- a/drivers/media/video/gspca/pac7311.c
+++ b/drivers/media/video/gspca/pac7311.c
@@ -220,6 +220,7 @@ static const __u8 probe_7302[] = {
};
static const __u8 start_7302[] = {
/* index, len, [value]* */
+ 0xff, 1, 0x00, /* page 0 */
0x00, 12, 0x01, 0x40, 0x40, 0x40, 0x01, 0xe0, 0x02, 0x80,
0x00, 0x00, 0x00, 0x00,
0x0d, 24, 0x03, 0x01, 0x00, 0xb5, 0x07, 0xcb, 0x00, 0x00,
@@ -249,7 +250,7 @@ static const __u8 start_7302[] = {
0xd1, 11, 0x01, 0x30, 0x49, 0x5e, 0x6f, 0x7f, 0x8e, 0xa9,
0xc1, 0xd7, 0xec,
0xdc, 1, 0x01,
- 0xff, 1, 0x01,
+ 0xff, 1, 0x01, /* page 1 */
0x12, 3, 0x02, 0x00, 0x01,
0x3e, 2, 0x00, 0x00,
0x76, 5, 0x01, 0x20, 0x40, 0x00, 0xf2,
@@ -257,26 +258,26 @@ static const __u8 start_7302[] = {
0x7f, 10, 0x4b, 0x0f, 0x01, 0x2c, 0x02, 0x58, 0x03, 0x20,
0x02, 0x00,
0x96, 5, 0x01, 0x10, 0x04, 0x01, 0x04,
- 0xc8, 17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00,
+ 0xc8, 14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00,
0x07, 0x00, 0x01, 0x07, 0x04, 0x01,
- 0x01,
+ 0xd8, 1, 0x01,
0xdb, 2, 0x00, 0x01,
- 0xde, 8, 0x00, 0x01, 0x04, 0x04, 0x00, 0x00, 0x00,
+ 0xde, 7, 0x00, 0x01, 0x04, 0x04, 0x00, 0x00, 0x00,
0xe6, 4, 0x00, 0x00, 0x00, 0x01,
0xeb, 1, 0x00,
- 0xff, 1, 0x02,
+ 0xff, 1, 0x02, /* page 2 */
0x22, 1, 0x00,
- 0xff, 1, 0x03,
+ 0xff, 1, 0x03, /* page 3 */
0x00, 255, /* load the page 3 */
0x11, 1, 0x01,
- 0xff, 1, 0x02,
+ 0xff, 1, 0x02, /* page 2 */
0x13, 1, 0x00,
0x22, 4, 0x1f, 0xa4, 0xf0, 0x96,
0x27, 2, 0x14, 0x0c,
0x2a, 5, 0xc8, 0x00, 0x18, 0x12, 0x22,
0x64, 8, 0x00, 0x00, 0xf0, 0x01, 0x14, 0x44, 0x44, 0x44,
0x6e, 1, 0x08,
- 0xff, 1, 0x03,
+ 0xff, 1, 0x03, /* page 1 */
0x78, 1, 0x00,
0, 0 /* end of sequence */
};
@@ -321,14 +322,14 @@ static const __u8 probe_7311[] = {
static const __u8 start_7311[] = {
/* index, len, [value]* */
- 0xff, 1, 0x01,
- 0x02, 53, 0x48, 0x0a, 0x40, 0x08, 0x00, 0x00, 0x08, 0x00,
+ 0xff, 1, 0x01, /* page 1 */
+ 0x02, 43, 0x48, 0x0a, 0x40, 0x08, 0x00, 0x00, 0x08, 0x00,
0x06, 0xff, 0x11, 0xff, 0x5a, 0x30, 0x90, 0x4c,
0x00, 0x07, 0x00, 0x0a, 0x10, 0x00, 0xa0, 0x10,
0x02, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00,
- 0x3e, 52, 0x00, 0x00, 0x78, 0x52, 0x4a, 0x52, 0x78, 0x6e,
+ 0x3e, 42, 0x00, 0x00, 0x78, 0x52, 0x4a, 0x52, 0x78, 0x6e,
0x48, 0x46, 0x48, 0x6e, 0x5f, 0x49, 0x42, 0x49,
0x5f, 0x5f, 0x49, 0x42, 0x49, 0x5f, 0x6e, 0x48,
0x46, 0x48, 0x6e, 0x78, 0x52, 0x4a, 0x52, 0x78,
@@ -342,7 +343,7 @@ static const __u8 start_7311[] = {
0xa0, 4, 0x44, 0x44, 0x44, 0x04,
0xf0, 13, 0x01, 0x00, 0x00, 0x00, 0x22, 0x00, 0x20, 0x00,
0x3f, 0x00, 0x0a, 0x01, 0x00,
- 0xff, 1, 0x04,
+ 0xff, 1, 0x04, /* page 4 */
0x00, 254, /* load the page 4 */
0x11, 1, 0x01,
0, 0 /* end of sequence */
@@ -738,6 +739,24 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
#define INTER_FRAME 0x53 /* eof + inter frame + sof */
#define LUM_OFFSET 0x1e /* reverse offset / start of frame */
+/*fixme:test+*/
+/* dump the packet */
+ if (gspca_debug & 0x200) {
+ static char tmp[50];
+
+ PDEBUG(0x200, "pkt_scan");
+ tmp[0] = 0;
+ for (i = 0; i < len; i++) {
+ if (i % 16 == 0 && i != 0) {
+ PDEBUG(0x200, "%s", tmp);
+ tmp[0] = 0;
+ }
+ sprintf(&tmp[(i % 16) * 3], "%02x ", data[i]);
+ }
+ if (tmp[0] != 0)
+ PDEBUG(0x200, "%s", tmp);
+ }
+/*fixme:test-*/
/*
* inside a frame, there may be:
* escaped ff ('ff 00')
@@ -819,6 +838,25 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
put_jpeg_head(gspca_dev, frame);
break;
case 0xff: /* 'ff ff ff xx' */
+/*fixme:test+*/
+/* is there a start of frame ? */
+ if (data[i + 2] == 0x00) {
+ static __u8 ffd9[2] = {0xff, 0xd9};
+
+ gspca_frame_add(gspca_dev,
+ INTER_PACKET,
+ frame, data,
+ i + 7 - INTER_FRAME);
+ frame = gspca_frame_add(gspca_dev,
+ LAST_PACKET,
+ frame, ffd9, 2);
+ data += i + 7;
+ len -= i + 7;
+ i = 0;
+ put_jpeg_head(gspca_dev, frame);
+ break;
+ }
+/*fixme:test-*/
gspca_frame_add(gspca_dev, INTER_PACKET,
frame, data, i);
data += i + 4;