diff options
author | Jim Paris <jim@jtan.com> | 2008-12-10 03:45:14 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-12-30 06:39:00 -0500 |
commit | 0f7a50b29dd9c8603d5ce15c11fd1a1d731e1a6d (patch) | |
tree | f8be4ed8528543fab438fc8ccd035add8b6045d6 /drivers/media/video | |
parent | 8d3f6e3582b762a3b28f52c8093631caee94c03a (diff) |
V4L/DVB (9873): gspca - ov534: Improve payload handling.
Frame data in bulk transfers is separated into 2048-byte payloads.
Each payload has its own header.
Signed-off-by: Jim Paris <jim@jtan.com>
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r-- | drivers/media/video/gspca/ov534.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/drivers/media/video/gspca/ov534.c b/drivers/media/video/gspca/ov534.c index 28a7982792b..74bb7962e11 100644 --- a/drivers/media/video/gspca/ov534.c +++ b/drivers/media/video/gspca/ov534.c | |||
@@ -1,6 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * ov534/ov772x gspca driver | 2 | * ov534/ov772x gspca driver |
3 | * Copyright (C) 2008 Antonio Ospite <ospite@studenti.unina.it> | 3 | * Copyright (C) 2008 Antonio Ospite <ospite@studenti.unina.it> |
4 | * Copyright (C) 2008 Jim Paris <jim@jtan.com> | ||
4 | * | 5 | * |
5 | * Based on a prototype written by Mark Ferrell <majortrips@gmail.com> | 6 | * Based on a prototype written by Mark Ferrell <majortrips@gmail.com> |
6 | * USB protocol reverse engineered by Jim Paris <jim@jtan.com> | 7 | * USB protocol reverse engineered by Jim Paris <jim@jtan.com> |
@@ -193,8 +194,8 @@ static const __u8 ov534_reg_initdata[][2] = { | |||
193 | 194 | ||
194 | { 0x1c, 0x00 }, | 195 | { 0x1c, 0x00 }, |
195 | { 0x1d, 0x40 }, | 196 | { 0x1d, 0x40 }, |
196 | { 0x1d, 0x02 }, | 197 | { 0x1d, 0x02 }, /* payload size 0x0200 * 4 = 2048 bytes */ |
197 | { 0x1d, 0x00 }, | 198 | { 0x1d, 0x00 }, /* payload size */ |
198 | { 0x1d, 0x02 }, /* frame size 0x025800 * 4 = 614400 */ | 199 | { 0x1d, 0x02 }, /* frame size 0x025800 * 4 = 614400 */ |
199 | { 0x1d, 0x58 }, /* frame size */ | 200 | { 0x1d, 0x58 }, /* frame size */ |
200 | { 0x1d, 0x00 }, /* frame size */ | 201 | { 0x1d, 0x00 }, /* frame size */ |
@@ -325,7 +326,7 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
325 | cam->cam_mode = vga_mode; | 326 | cam->cam_mode = vga_mode; |
326 | cam->nmodes = ARRAY_SIZE(vga_mode); | 327 | cam->nmodes = ARRAY_SIZE(vga_mode); |
327 | 328 | ||
328 | cam->bulk_size = 2048; | 329 | cam->bulk_size = 16384; |
329 | cam->bulk_nurbs = 2; | 330 | cam->bulk_nurbs = 2; |
330 | 331 | ||
331 | return 0; | 332 | return 0; |
@@ -402,6 +403,17 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, struct gspca_frame *frame, | |||
402 | struct sd *sd = (struct sd *) gspca_dev; | 403 | struct sd *sd = (struct sd *) gspca_dev; |
403 | __u32 this_pts; | 404 | __u32 this_pts; |
404 | int this_fid; | 405 | int this_fid; |
406 | int remaining_len = len; | ||
407 | __u8 *next_data = data; | ||
408 | |||
409 | scan_next: | ||
410 | if (remaining_len <= 0) | ||
411 | return; | ||
412 | |||
413 | data = next_data; | ||
414 | len = min(remaining_len, 2048); | ||
415 | remaining_len -= len; | ||
416 | next_data += len; | ||
405 | 417 | ||
406 | /* Payloads are prefixed with a the UVC-style header. We | 418 | /* Payloads are prefixed with a the UVC-style header. We |
407 | consider a frame to start when the FID toggles, or the PTS | 419 | consider a frame to start when the FID toggles, or the PTS |
@@ -452,12 +464,13 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, struct gspca_frame *frame, | |||
452 | gspca_frame_add(gspca_dev, LAST_PACKET, frame, NULL, 0); | 464 | gspca_frame_add(gspca_dev, LAST_PACKET, frame, NULL, 0); |
453 | } | 465 | } |
454 | 466 | ||
455 | /* Done */ | 467 | /* Done this payload */ |
456 | return; | 468 | goto scan_next; |
457 | 469 | ||
458 | discard: | 470 | discard: |
459 | /* Discard data until a new frame starts. */ | 471 | /* Discard data until a new frame starts. */ |
460 | gspca_frame_add(gspca_dev, DISCARD_PACKET, frame, NULL, 0); | 472 | gspca_frame_add(gspca_dev, DISCARD_PACKET, frame, NULL, 0); |
473 | goto scan_next; | ||
461 | } | 474 | } |
462 | 475 | ||
463 | /* sub-driver description */ | 476 | /* sub-driver description */ |