public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Jean-Francois Moine <moinejf@free.fr>
To: Antonio Ospite <ospite@studenti.unina.it>
Cc: video4linux-list@redhat.com
Subject: Re: [PATCH] gspca_ov534: Print only frame_rate actually used.
Date: Thu, 27 Nov 2008 10:23:04 +0100	[thread overview]
Message-ID: <1227777784.1752.20.camel@localhost> (raw)
In-Reply-To: <20081125235249.d45b50f4.ospite@studenti.unina.it>

[-- Attachment #1: Type: text/plain, Size: 722 bytes --]

On Tue, 2008-11-25 at 23:52 +0100, Antonio Ospite wrote:
> Print only frame_rate actually used.

Hello Antonio,

This may be simplified as in the attached patch (the frame_rate in the
sd structure was not used).

The patch also includes removing the bulk_size setting at streamon time:
the value is already used at this time, and also, there is only one
resolution.

I found a real problem: for USB read and write, you have a 16-bits
variable in/from which you read/write only one byte. This will fail with
big-endian machines. Anyway, it is safer to use the usb_buf from the
gspca structure.

Cheers.

-- 
Ken ar c'hentañ |             ** Breizh ha Linux atav! **
Jef             |               http://moinejf.free.fr/


[-- Attachment #2: ov534.patch --]
[-- Type: text/x-patch, Size: 2153 bytes --]

diff -r 3e0ba0a8e47f linux/drivers/media/video/gspca/ov534.c
--- a/linux/drivers/media/video/gspca/ov534.c	Wed Nov 26 20:17:13 2008 +0100
+++ b/linux/drivers/media/video/gspca/ov534.c	Thu Nov 27 10:15:08 2008 +0100
@@ -48,7 +48,6 @@
 /* specific webcam descriptor */
 struct sd {
 	struct gspca_dev gspca_dev;	/* !! must be the first item */
-	__u8 frame_rate;
 };
 
 /* V4L2 controls supported by the driver */
@@ -59,7 +58,7 @@
 	{640, 480, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
 	 .bytesperline = 640 * 2,
 	 .sizeimage = 640 * 480 * 2,
-	 .colorspace = V4L2_COLORSPACE_JPEG,
+	 .colorspace = V4L2_COLORSPACE_SRGB,
 	 .priv = 0},
 };
 
@@ -359,14 +358,13 @@
 static int sd_init(struct gspca_dev *gspca_dev)
 {
 	struct sd *sd = (struct sd *)gspca_dev;
+	int fr;
+
 	ov534_setup(gspca_dev->dev);
 
-	if (frame_rate > 0)
-		sd->frame_rate = frame_rate;
+	fr = frame_rate;
 
-	PDEBUG(D_PROBE, "frame_rate = %d", sd->frame_rate);
-
-	switch (sd->frame_rate) {
+	switch (fr) {
 	case 50:
 		sccb_reg_write(gspca_dev->dev, 0x11, 0x01);
 		sccb_check_status(gspca_dev->dev);
@@ -381,8 +379,9 @@
 		sccb_check_status(gspca_dev->dev);
 		ov534_reg_verify_write(gspca_dev->dev, 0xe5, 0x04);
 		break;
-	case 30:
+/*	case 30: */
 	default:
+		fr = 30;
 		sccb_reg_write(gspca_dev->dev, 0x11, 0x04);
 		sccb_check_status(gspca_dev->dev);
 		sccb_reg_write(gspca_dev->dev, 0x0d, 0x81);
@@ -396,18 +395,15 @@
 		sccb_check_status(gspca_dev->dev);
 		ov534_reg_verify_write(gspca_dev->dev, 0xe5, 0x04);
 		break;
-	};
+	}
+
+	PDEBUG(D_PROBE, "frame_rate: %d", fr);
 
 	return 0;
 }
 
 static int sd_start(struct gspca_dev *gspca_dev)
 {
-	PDEBUG(D_PROBE, "width = %d, height = %d",
-	       gspca_dev->width, gspca_dev->height);
-
-	gspca_dev->cam.bulk_size = gspca_dev->width * gspca_dev->height * 2;
-
 	/* start streaming data */
 	ov534_set_led(gspca_dev->dev, 1);
 	ov534_reg_write(gspca_dev->dev, 0xe0, 0x00);
@@ -433,7 +429,6 @@
 	int framesize = gspca_dev->cam.bulk_size;
 
 	if (len == framesize - 4) {
-		frame =
 		    gspca_frame_add(gspca_dev, FIRST_PACKET, frame, data, len);
 		frame =
 		    gspca_frame_add(gspca_dev, LAST_PACKET, frame, last_pixel,

[-- Attachment #3: Type: text/plain, Size: 164 bytes --]

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

  reply	other threads:[~2008-11-27  9:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-25 22:52 [PATCH] gspca_ov534: Print only frame_rate actually used Antonio Ospite
2008-11-27  9:23 ` Jean-Francois Moine [this message]
2008-11-27 11:05   ` Antonio Ospite
2008-11-27 12:22     ` Jean-Francois Moine
2008-11-27 13:52       ` Antonio Ospite
2008-12-03 16:45         ` Antonio Ospite
2008-12-03 18:01           ` Jim Paris
2008-12-03 18:44             ` Antonio Ospite
2008-12-03 19:17               ` Jean-Francois Moine
2008-12-04 11:55                 ` Antonio Ospite

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1227777784.1752.20.camel@localhost \
    --to=moinejf@free.fr \
    --cc=ospite@studenti.unina.it \
    --cc=video4linux-list@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox