ov534: fix end of frame handling, make the camera work again.

Message ID 1263678300-20313-1-git-send-email-ospite@studenti.unina.it (mailing list archive)
State Superseded, archived
Headers

Commit Message

Antonio Ospite Jan. 16, 2010, 9:45 p.m. UTC
  Fix a regression, probably introduced in the driver split, which made
the ov534 driver unusable: every last packet was discarded because we
were mis-calculating the frame size before actually adding the packet.

Plus, the debug message should reflect that we discard also packets
beyond the expected frame size.

Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
Cc: Max Thrun <bear24rw@gmail.com>
---

Max, can you test this as well? This should be better than removing all
the discard logic at once. After this is in I'll keep working on your
changes.

Jean-Francois, if this is proven to be the right thing to do, it should
go mainline along with the driver split.

Thanks,
   Antonio Ospite

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  

Comments

Max Thrun Jan. 16, 2010, 10:25 p.m. UTC | #1
Thanks for the patch Antonio

I can confirm that this patch does fix the problem, definitely needs
to be merged asap as the webcam is unusable without.

- Max Thrun
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  
Jim Paris Jan. 31, 2010, 12:05 a.m. UTC | #2
Antonio Ospite wrote:
> Fix a regression, probably introduced in the driver split, which made
> the ov534 driver unusable: every last packet was discarded because we
> were mis-calculating the frame size before actually adding the packet.

Hi Antonio,

> Index: gspca/linux/drivers/media/video/gspca/ov534.c
> ===================================================================
> --- gspca.orig/linux/drivers/media/video/gspca/ov534.c
> +++ gspca/linux/drivers/media/video/gspca/ov534.c
> @@ -992,9 +992,9 @@
>  			frame = gspca_get_i_frame(gspca_dev);
>  			if (frame == NULL)
>  				goto discard;
> -			if (frame->data_end - frame->data !=
> +			if (frame->data_end - frame->data + (len - 12) !=
>  			    gspca_dev->width * gspca_dev->height * 2) {
> -				PDEBUG(D_PACK, "short frame");
> +				PDEBUG(D_PACK, "wrong sized frame");
>  				goto discard;
>  			}
>  			gspca_frame_add(gspca_dev, LAST_PACKET,

This change looks correct to me.  Thanks.

Acked-by: Jim Paris <jim@jtan.com>

-jim
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  

Patch

Index: gspca/linux/drivers/media/video/gspca/ov534.c
===================================================================
--- gspca.orig/linux/drivers/media/video/gspca/ov534.c
+++ gspca/linux/drivers/media/video/gspca/ov534.c
@@ -992,9 +992,9 @@ 
 			frame = gspca_get_i_frame(gspca_dev);
 			if (frame == NULL)
 				goto discard;
-			if (frame->data_end - frame->data !=
+			if (frame->data_end - frame->data + (len - 12) !=
 			    gspca_dev->width * gspca_dev->height * 2) {
-				PDEBUG(D_PACK, "short frame");
+				PDEBUG(D_PACK, "wrong sized frame");
 				goto discard;
 			}
 			gspca_frame_add(gspca_dev, LAST_PACKET,