All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kyle Guinn <elyk03@gmail.com>
To: kilgota@banach.math.auburn.edu
Cc: linux-media@vger.kernel.org, Hans de Goede <hdegoede@redhat.com>,
	"Jean-Francois Moine" <moinejf@free.fr>
Subject: Re: [PATCH] for the file gspca/mr97310a.c
Date: Thu, 5 Mar 2009 22:58:47 -0600	[thread overview]
Message-ID: <200903052258.48365.elyk03@gmail.com> (raw)
In-Reply-To: <alpine.LNX.2.00.0903052031490.28557@banach.math.auburn.edu>

On Thursday 05 March 2009 20:34:27 kilgota@banach.math.auburn.edu wrote:
> Signed-off-by: Theodore Kilgore <kilgota@auburn.edu>
> ----------------------------------------------------------------------
> --- mr97310a.c.old	2009-02-23 23:59:07.000000000 -0600
> +++ mr97310a.c	2009-03-05 19:14:13.000000000 -0600
> @@ -29,9 +29,7 @@ MODULE_LICENSE("GPL");
>   /* specific webcam descriptor */
>   struct sd {
>   	struct gspca_dev gspca_dev;  /* !! must be the first item */
> -
>   	u8 sof_read;
> -	u8 header_read;
>   };
>
>   /* V4L2 controls supported by the driver */
> @@ -100,12 +98,9 @@ static int sd_init(struct gspca_dev *gsp
>
>   static int sd_start(struct gspca_dev *gspca_dev)
>   {
> -	struct sd *sd = (struct sd *) gspca_dev;
>   	__u8 *data = gspca_dev->usb_buf;
>   	int err_code;
>
> -	sd->sof_read = 0;
> -

Good catch, I didn't realize this was kzalloc'd.

>   	/* Note:  register descriptions guessed from MR97113A driver */
>
>   	data[0] = 0x01;
> @@ -285,40 +280,29 @@ static void sd_pkt_scan(struct gspca_dev
>   			__u8 *data,                   /* isoc packet */
>   			int len)                      /* iso packet length */
>   {
> -	struct sd *sd = (struct sd *) gspca_dev;
>   	unsigned char *sof;
>
>   	sof = pac_find_sof(gspca_dev, data, len);
>   	if (sof) {
>   		int n;
> -
> +		int marker_len = sizeof pac_sof_marker;

The value doesn't change; there's no need to use a variable for this.

>   		/* finish decoding current frame */
>   		n = sof - data;
> -		if (n > sizeof pac_sof_marker)
> -			n -= sizeof pac_sof_marker;
> +		if (n > marker_len)
> +			n -= marker_len;
>   		else
>   			n = 0;
>   		frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame,
>   					data, n);
> -		sd->header_read = 0;
> -		gspca_frame_add(gspca_dev, FIRST_PACKET, frame, NULL, 0);
> -		len -= sof - data;
> +		/* Start next frame. */
> +		gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
> +			pac_sof_marker, marker_len);
> +		len -= n;
> +		len -= marker_len;
> +		if (len < 0)
> +			len = 0;

len -= sof - data; is a shorter way to find the remaining length.

>   		data = sof;
>   	}
> -	if (sd->header_read < 7) {
> -		int needed;
> -
> -		/* skip the rest of the header */
> -		needed = 7 - sd->header_read;
> -		if (len <= needed) {
> -			sd->header_read += len;
> -			return;
> -		}
> -		data += needed;
> -		len -= needed;
> -		sd->header_read = 7;
> -	}
> -
>   	gspca_frame_add(gspca_dev, INTER_PACKET, frame, data, len);
>   }
>
> @@ -337,6 +321,7 @@ static const struct sd_desc sd_desc = {
>   /* -- module initialisation -- */
>   static const __devinitdata struct usb_device_id device_table[] = {
>   	{USB_DEVICE(0x08ca, 0x0111)},
> +	{USB_DEVICE(0x093a, 0x010f)},

This change is unrelated; maybe it should be in a different patch?  Don't 
forget to update Documentation/video4linux/gspca.txt with the new camera.

-Kyle

  reply	other threads:[~2009-03-06  4:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-06  2:34 [PATCH] for the file gspca/mr97310a.c kilgota
2009-03-06  4:58 ` Kyle Guinn [this message]
2009-03-06  6:41   ` kilgota
2009-03-06  8:12     ` Hans de Goede
2009-03-06 21:22       ` [PATCH] for the file gspca/mr97310a.c (revisions) kilgota
2009-03-11  1:18       ` A question about documentation kilgota

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=200903052258.48365.elyk03@gmail.com \
    --to=elyk03@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=kilgota@banach.math.auburn.edu \
    --cc=linux-media@vger.kernel.org \
    --cc=moinejf@free.fr \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.