diff options
author | Jean-François Moine <moinejf@free.fr> | 2012-03-19 03:22:44 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-03-19 21:27:27 -0400 |
commit | 1f42df0db04356ff9384514e1ec027df9ce3d132 (patch) | |
tree | 2323442e6be0a8f1a65161bb9d94574fc4419a36 /drivers/media | |
parent | a2816edaaca2586cac66270844614586810f53ea (diff) |
[media] gspca - sn9c20x: Fix loss of frame start
The frame header was checked on packets of size 64 bytes only, while the webcams
may put a frame header at the beginning of bigger packets.
Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/gspca/sn9c20x.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/media/video/gspca/sn9c20x.c b/drivers/media/video/gspca/sn9c20x.c index 9e198b45c3c8..e54bf54b3901 100644 --- a/drivers/media/video/gspca/sn9c20x.c +++ b/drivers/media/video/gspca/sn9c20x.c | |||
@@ -2457,7 +2457,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
2457 | int avg_lum; | 2457 | int avg_lum; |
2458 | static u8 frame_header[] = | 2458 | static u8 frame_header[] = |
2459 | {0xff, 0xff, 0x00, 0xc4, 0xc4, 0x96}; | 2459 | {0xff, 0xff, 0x00, 0xc4, 0xc4, 0x96}; |
2460 | if (len == 64 && memcmp(data, frame_header, 6) == 0) { | 2460 | if (len >= 64 && memcmp(data, frame_header, 6) == 0) { |
2461 | avg_lum = ((data[35] >> 2) & 3) | | 2461 | avg_lum = ((data[35] >> 2) & 3) | |
2462 | (data[20] << 2) | | 2462 | (data[20] << 2) | |
2463 | (data[19] << 10); | 2463 | (data[19] << 10); |
@@ -2485,7 +2485,10 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
2485 | avg_lum >>= 9; | 2485 | avg_lum >>= 9; |
2486 | atomic_set(&sd->avg_lum, avg_lum); | 2486 | atomic_set(&sd->avg_lum, avg_lum); |
2487 | gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0); | 2487 | gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0); |
2488 | return; | 2488 | len -= 64; |
2489 | if (len == 0) | ||
2490 | return; | ||
2491 | data += 64; | ||
2489 | } | 2492 | } |
2490 | if (gspca_dev->last_packet_type == LAST_PACKET) { | 2493 | if (gspca_dev->last_packet_type == LAST_PACKET) { |
2491 | if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv | 2494 | if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv |