aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/pac7311.c
diff options
context:
space:
mode:
authorJean-Francois Moine <moinejf@free.fr>2008-09-03 15:47:33 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-09-03 17:36:37 -0400
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 730b4a1aed9e..85d9ddbc5b7f 100644
--- a/drivers/media/video/gspca/pac7311.c
+++ b/drivers/media/video/gspca/pac7311.c
@@ -220,6 +220,7 @@ static const __u8 probe_7302[] = {
220}; 220};
221static const __u8 start_7302[] = { 221static const __u8 start_7302[] = {
222/* index, len, [value]* */ 222/* index, len, [value]* */
223 0xff, 1, 0x00, /* page 0 */
223 0x00, 12, 0x01, 0x40, 0x40, 0x40, 0x01, 0xe0, 0x02, 0x80, 224 0x00, 12, 0x01, 0x40, 0x40, 0x40, 0x01, 0xe0, 0x02, 0x80,
224 0x00, 0x00, 0x00, 0x00, 225 0x00, 0x00, 0x00, 0x00,
225 0x0d, 24, 0x03, 0x01, 0x00, 0xb5, 0x07, 0xcb, 0x00, 0x00, 226 0x0d, 24, 0x03, 0x01, 0x00, 0xb5, 0x07, 0xcb, 0x00, 0x00,
@@ -249,7 +250,7 @@ static const __u8 start_7302[] = {
249 0xd1, 11, 0x01, 0x30, 0x49, 0x5e, 0x6f, 0x7f, 0x8e, 0xa9, 250 0xd1, 11, 0x01, 0x30, 0x49, 0x5e, 0x6f, 0x7f, 0x8e, 0xa9,
250 0xc1, 0xd7, 0xec, 251 0xc1, 0xd7, 0xec,
251 0xdc, 1, 0x01, 252 0xdc, 1, 0x01,
252 0xff, 1, 0x01, 253 0xff, 1, 0x01, /* page 1 */
253 0x12, 3, 0x02, 0x00, 0x01, 254 0x12, 3, 0x02, 0x00, 0x01,
254 0x3e, 2, 0x00, 0x00, 255 0x3e, 2, 0x00, 0x00,
255 0x76, 5, 0x01, 0x20, 0x40, 0x00, 0xf2, 256 0x76, 5, 0x01, 0x20, 0x40, 0x00, 0xf2,
@@ -257,26 +258,26 @@ static const __u8 start_7302[] = {
257 0x7f, 10, 0x4b, 0x0f, 0x01, 0x2c, 0x02, 0x58, 0x03, 0x20, 258 0x7f, 10, 0x4b, 0x0f, 0x01, 0x2c, 0x02, 0x58, 0x03, 0x20,
258 0x02, 0x00, 259 0x02, 0x00,
259 0x96, 5, 0x01, 0x10, 0x04, 0x01, 0x04, 260 0x96, 5, 0x01, 0x10, 0x04, 0x01, 0x04,
260 0xc8, 17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 261 0xc8, 14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00,
261 0x07, 0x00, 0x01, 0x07, 0x04, 0x01, 262 0x07, 0x00, 0x01, 0x07, 0x04, 0x01,
262 0x01, 263 0xd8, 1, 0x01,
263 0xdb, 2, 0x00, 0x01, 264 0xdb, 2, 0x00, 0x01,
264 0xde, 8, 0x00, 0x01, 0x04, 0x04, 0x00, 0x00, 0x00, 265 0xde, 7, 0x00, 0x01, 0x04, 0x04, 0x00, 0x00, 0x00,
265 0xe6, 4, 0x00, 0x00, 0x00, 0x01, 266 0xe6, 4, 0x00, 0x00, 0x00, 0x01,
266 0xeb, 1, 0x00, 267 0xeb, 1, 0x00,
267 0xff, 1, 0x02, 268 0xff, 1, 0x02, /* page 2 */
268 0x22, 1, 0x00, 269 0x22, 1, 0x00,
269 0xff, 1, 0x03, 270 0xff, 1, 0x03, /* page 3 */
270 0x00, 255, /* load the page 3 */ 271 0x00, 255, /* load the page 3 */
271 0x11, 1, 0x01, 272 0x11, 1, 0x01,
272 0xff, 1, 0x02, 273 0xff, 1, 0x02, /* page 2 */
273 0x13, 1, 0x00, 274 0x13, 1, 0x00,
274 0x22, 4, 0x1f, 0xa4, 0xf0, 0x96, 275 0x22, 4, 0x1f, 0xa4, 0xf0, 0x96,
275 0x27, 2, 0x14, 0x0c, 276 0x27, 2, 0x14, 0x0c,
276 0x2a, 5, 0xc8, 0x00, 0x18, 0x12, 0x22, 277 0x2a, 5, 0xc8, 0x00, 0x18, 0x12, 0x22,
277 0x64, 8, 0x00, 0x00, 0xf0, 0x01, 0x14, 0x44, 0x44, 0x44, 278 0x64, 8, 0x00, 0x00, 0xf0, 0x01, 0x14, 0x44, 0x44, 0x44,
278 0x6e, 1, 0x08, 279 0x6e, 1, 0x08,
279 0xff, 1, 0x03, 280 0xff, 1, 0x03, /* page 1 */
280 0x78, 1, 0x00, 281 0x78, 1, 0x00,
281 0, 0 /* end of sequence */ 282 0, 0 /* end of sequence */
282}; 283};
@@ -321,14 +322,14 @@ static const __u8 probe_7311[] = {
321 322
322static const __u8 start_7311[] = { 323static const __u8 start_7311[] = {
323/* index, len, [value]* */ 324/* index, len, [value]* */
324 0xff, 1, 0x01, 325 0xff, 1, 0x01, /* page 1 */
325 0x02, 53, 0x48, 0x0a, 0x40, 0x08, 0x00, 0x00, 0x08, 0x00, 326 0x02, 43, 0x48, 0x0a, 0x40, 0x08, 0x00, 0x00, 0x08, 0x00,
326 0x06, 0xff, 0x11, 0xff, 0x5a, 0x30, 0x90, 0x4c, 327 0x06, 0xff, 0x11, 0xff, 0x5a, 0x30, 0x90, 0x4c,
327 0x00, 0x07, 0x00, 0x0a, 0x10, 0x00, 0xa0, 0x10, 328 0x00, 0x07, 0x00, 0x0a, 0x10, 0x00, 0xa0, 0x10,
328 0x02, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x01, 0x00, 329 0x02, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x01, 0x00,
329 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 330 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
330 0x00, 0x00, 0x00, 331 0x00, 0x00, 0x00,
331 0x3e, 52, 0x00, 0x00, 0x78, 0x52, 0x4a, 0x52, 0x78, 0x6e, 332 0x3e, 42, 0x00, 0x00, 0x78, 0x52, 0x4a, 0x52, 0x78, 0x6e,
332 0x48, 0x46, 0x48, 0x6e, 0x5f, 0x49, 0x42, 0x49, 333 0x48, 0x46, 0x48, 0x6e, 0x5f, 0x49, 0x42, 0x49,
333 0x5f, 0x5f, 0x49, 0x42, 0x49, 0x5f, 0x6e, 0x48, 334 0x5f, 0x5f, 0x49, 0x42, 0x49, 0x5f, 0x6e, 0x48,
334 0x46, 0x48, 0x6e, 0x78, 0x52, 0x4a, 0x52, 0x78, 335 0x46, 0x48, 0x6e, 0x78, 0x52, 0x4a, 0x52, 0x78,
@@ -342,7 +343,7 @@ static const __u8 start_7311[] = {
342 0xa0, 4, 0x44, 0x44, 0x44, 0x04, 343 0xa0, 4, 0x44, 0x44, 0x44, 0x04,
343 0xf0, 13, 0x01, 0x00, 0x00, 0x00, 0x22, 0x00, 0x20, 0x00, 344 0xf0, 13, 0x01, 0x00, 0x00, 0x00, 0x22, 0x00, 0x20, 0x00,
344 0x3f, 0x00, 0x0a, 0x01, 0x00, 345 0x3f, 0x00, 0x0a, 0x01, 0x00,
345 0xff, 1, 0x04, 346 0xff, 1, 0x04, /* page 4 */
346 0x00, 254, /* load the page 4 */ 347 0x00, 254, /* load the page 4 */
347 0x11, 1, 0x01, 348 0x11, 1, 0x01,
348 0, 0 /* end of sequence */ 349 0, 0 /* end of sequence */
@@ -738,6 +739,24 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
738#define INTER_FRAME 0x53 /* eof + inter frame + sof */ 739#define INTER_FRAME 0x53 /* eof + inter frame + sof */
739#define LUM_OFFSET 0x1e /* reverse offset / start of frame */ 740#define LUM_OFFSET 0x1e /* reverse offset / start of frame */
740 741
742/*fixme:test+*/
743/* dump the packet */
744 if (gspca_debug & 0x200) {
745 static char tmp[50];
746
747 PDEBUG(0x200, "pkt_scan");
748 tmp[0] = 0;
749 for (i = 0; i < len; i++) {
750 if (i % 16 == 0 && i != 0) {
751 PDEBUG(0x200, "%s", tmp);
752 tmp[0] = 0;
753 }
754 sprintf(&tmp[(i % 16) * 3], "%02x ", data[i]);
755 }
756 if (tmp[0] != 0)
757 PDEBUG(0x200, "%s", tmp);
758 }
759/*fixme:test-*/
741 /* 760 /*
742 * inside a frame, there may be: 761 * inside a frame, there may be:
743 * escaped ff ('ff 00') 762 * escaped ff ('ff 00')
@@ -819,6 +838,25 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
819 put_jpeg_head(gspca_dev, frame); 838 put_jpeg_head(gspca_dev, frame);
820 break; 839 break;
821 case 0xff: /* 'ff ff ff xx' */ 840 case 0xff: /* 'ff ff ff xx' */
841/*fixme:test+*/
842/* is there a start of frame ? */
843 if (data[i + 2] == 0x00) {
844 static __u8 ffd9[2] = {0xff, 0xd9};
845
846 gspca_frame_add(gspca_dev,
847 INTER_PACKET,
848 frame, data,
849 i + 7 - INTER_FRAME);
850 frame = gspca_frame_add(gspca_dev,
851 LAST_PACKET,
852 frame, ffd9, 2);
853 data += i + 7;
854 len -= i + 7;
855 i = 0;
856 put_jpeg_head(gspca_dev, frame);
857 break;
858 }
859/*fixme:test-*/
822 gspca_frame_add(gspca_dev, INTER_PACKET, 860 gspca_frame_add(gspca_dev, INTER_PACKET,
823 frame, data, i); 861 frame, data, i);
824 data += i + 4; 862 data += i + 4;