Linux Media Controller development
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Vasily Khoruzhick <anarsoul@gmail.com>,
	linux-media@vger.kernel.org,
	Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Subject: Re: [PATCH 1/2] gspca: sn9c2028: Add support for Genius Videocam Live v2
Date: Tue, 21 Apr 2015 16:21:58 +0200	[thread overview]
Message-ID: <55365D06.6030602@redhat.com> (raw)
In-Reply-To: <1429469565-2695-1-git-send-email-anarsoul@gmail.com>

Hi Vasily,

Thanks for the patches.

On 19-04-15 20:52, Vasily Khoruzhick wrote:
> Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
> ---
>   drivers/media/usb/gspca/sn9c2028.c | 120 ++++++++++++++++++++++++++++++++++++-
>   1 file changed, 119 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/usb/gspca/sn9c2028.c b/drivers/media/usb/gspca/sn9c2028.c
> index 39b6b2e..317b02c 100644
> --- a/drivers/media/usb/gspca/sn9c2028.c
> +++ b/drivers/media/usb/gspca/sn9c2028.c
> @@ -2,6 +2,7 @@
>    * SN9C2028 library
>    *
>    * Copyright (C) 2009 Theodore Kilgore <kilgota@auburn.edu>
> + * Copyright (C) 2015 Vasily Khoruzhick <anarsoul@gmail.com>
>    *
>    * This program is free software; you can redistribute it and/or modify
>    * it under the terms of the GNU General Public License as published by
> @@ -128,7 +129,7 @@ static int sn9c2028_long_command(struct gspca_dev *gspca_dev, u8 *command)
>   	status = -1;
>   	for (i = 0; i < 256 && status < 2; i++)
>   		status = sn9c2028_read1(gspca_dev);
> -	if (status != 2) {
> +	if (status < 0) {
>   		pr_err("long command status read error %d\n", status);
>   		return (status < 0) ? status : -EIO;
>   	}

Do you really need this change ? sn9c2028_read1 returns either a negative
error code, or the byte read from the sn9c2028 chip. This functions wait for
the sn9c2028 to return a read value of 2. I admit that the check in the for
vs the check in the error reporting is not chosen well, both should probably
be != 2. But checking for status < 0 is not good as this does not catch
a successful read from the chip not returning 2.

> @@ -178,6 +179,9 @@ static int sd_config(struct gspca_dev *gspca_dev,
>   	case 0x7005:
>   		PDEBUG(D_PROBE, "Genius Smart 300 camera");
>   		break;
> +	case 0x7003:
> +		PDEBUG(D_PROBE, "Genius Videocam Live v2");
> +		break;
>   	case 0x8000:
>   		PDEBUG(D_PROBE, "DC31VC");
>   		break;
> @@ -530,6 +534,116 @@ static int start_genius_cam(struct gspca_dev *gspca_dev)
>   				  ARRAY_SIZE(genius_start_commands));
>   }
>
> +static int start_genius_videocam_live(struct gspca_dev *gspca_dev)
> +{
> +	int r;
> +	struct sd *sd = (struct sd *) gspca_dev;
> +	struct init_command genius_vcam_live_start_commands[] = {
> +		{{0x0c, 0x01, 0x00, 0x00, 0x00, 0x00}, 0},
> +		{{0x16, 0x01, 0x00, 0x00, 0x00, 0x00}, 4},
> +		{{0x10, 0x00, 0x00, 0x00, 0x00, 0x00}, 4},
> +		{{0x13, 0x25, 0x01, 0x16, 0x00, 0x00}, 4},
> +		{{0x13, 0x26, 0x01, 0x12, 0x00, 0x00}, 4},
> +
> +		{{0x13, 0x28, 0x01, 0x0e, 0x00, 0x00}, 4},
> +		{{0x13, 0x27, 0x01, 0x20, 0x00, 0x00}, 4},
> +		{{0x13, 0x29, 0x01, 0x22, 0x00, 0x00}, 4},
> +		{{0x13, 0x2c, 0x01, 0x02, 0x00, 0x00}, 4},
> +		{{0x13, 0x2d, 0x01, 0x02, 0x00, 0x00}, 4},
> +		{{0x13, 0x2e, 0x01, 0x09, 0x00, 0x00}, 4},
> +		{{0x13, 0x2f, 0x01, 0x07, 0x00, 0x00}, 4},
> +		{{0x11, 0x20, 0x00, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x21, 0x2d, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x22, 0x00, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x23, 0x03, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x10, 0x00, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x11, 0x64, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x12, 0x00, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x13, 0x91, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x14, 0x01, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x15, 0x20, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x16, 0x01, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x17, 0x60, 0x00, 0x00, 0x00}, 4},
> +		{{0x1c, 0x20, 0x00, 0x2d, 0x00, 0x00}, 4},
> +		{{0x13, 0x20, 0x01, 0x00, 0x00, 0x00}, 4},
> +		{{0x13, 0x21, 0x01, 0x00, 0x00, 0x00}, 4},
> +		{{0x13, 0x22, 0x01, 0x00, 0x00, 0x00}, 4},
> +		{{0x13, 0x23, 0x01, 0x01, 0x00, 0x00}, 4},
> +		{{0x13, 0x24, 0x01, 0x00, 0x00, 0x00}, 4},
> +		{{0x13, 0x25, 0x01, 0x16, 0x00, 0x00}, 4},
> +		{{0x13, 0x26, 0x01, 0x12, 0x00, 0x00}, 4},
> +		{{0x13, 0x27, 0x01, 0x20, 0x00, 0x00}, 4},
> +		{{0x13, 0x28, 0x01, 0x0e, 0x00, 0x00}, 4},
> +		{{0x13, 0x29, 0x01, 0x22, 0x00, 0x00}, 4},
> +		{{0x13, 0x2a, 0x01, 0x00, 0x00, 0x00}, 4},
> +		{{0x13, 0x2b, 0x01, 0x00, 0x00, 0x00}, 4},
> +		{{0x13, 0x2c, 0x01, 0x02, 0x00, 0x00}, 4},
> +		{{0x13, 0x2d, 0x01, 0x02, 0x00, 0x00}, 4},
> +		{{0x13, 0x2e, 0x01, 0x09, 0x00, 0x00}, 4},
> +		{{0x13, 0x2f, 0x01, 0x07, 0x00, 0x00}, 4},
> +		{{0x12, 0x34, 0x01, 0x00, 0x00, 0x00}, 4},
> +		{{0x13, 0x34, 0x01, 0xa1, 0x00, 0x00}, 4},
> +		{{0x13, 0x35, 0x01, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x01, 0x04, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x02, 0x92, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x10, 0x00, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x11, 0x64, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x12, 0x00, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x13, 0x91, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x14, 0x01, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x15, 0x20, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x16, 0x01, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x17, 0x60, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x20, 0x00, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x21, 0x2d, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x22, 0x00, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x23, 0x03, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x25, 0x00, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x26, 0x02, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x27, 0x88, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x30, 0x38, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x31, 0x2a, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x32, 0x2a, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x33, 0x2a, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x34, 0x02, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x5b, 0x0a, 0x00, 0x00, 0x00}, 4},
> +		{{0x13, 0x25, 0x01, 0x28, 0x00, 0x00}, 4},
> +		{{0x13, 0x26, 0x01, 0x1e, 0x00, 0x00}, 4},
> +		{{0x13, 0x28, 0x01, 0x0e, 0x00, 0x00}, 4},
> +		{{0x13, 0x27, 0x01, 0x20, 0x00, 0x00}, 4},
> +		{{0x13, 0x29, 0x01, 0x62, 0x00, 0x00}, 4},
> +		{{0x13, 0x2c, 0x01, 0x02, 0x00, 0x00}, 4},
> +		{{0x13, 0x2d, 0x01, 0x03, 0x00, 0x00}, 4},
> +		{{0x13, 0x2e, 0x01, 0x0f, 0x00, 0x00}, 4},
> +		{{0x13, 0x2f, 0x01, 0x0c, 0x00, 0x00}, 4},
> +		{{0x11, 0x20, 0x00, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x21, 0x2a, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x22, 0x00, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x23, 0x28, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x10, 0x00, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x11, 0x04, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x12, 0x00, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x13, 0x03, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x14, 0x01, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x15, 0xe0, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x16, 0x02, 0x00, 0x00, 0x00}, 4},
> +		{{0x11, 0x17, 0x80, 0x00, 0x00, 0x00}, 4},
> +		{{0x1c, 0x20, 0x00, 0x2a, 0x00, 0x00}, 1},
> +		{{0x20, 0x34, 0xa1, 0x00, 0x00, 0x00}, 0},
> +		/* Camera should start to capture now. */
> +		{{0x12, 0x27, 0x01, 0x00, 0x00, 0x00}, 0},
> +		{{0x1b, 0x32, 0x26, 0x00, 0x00, 0x00}, 0},
> +		{{0x1d, 0x25, 0x10, 0x20, 0xab, 0x00}, 0},
> +	};
> +
> +	r = run_start_commands(gspca_dev, genius_vcam_live_start_commands,
> +				  ARRAY_SIZE(genius_vcam_live_start_commands));
> +	if (r < 0)
> +		return r;
> +
> +	return r;
> +}
> +
>   static int start_vivitar_cam(struct gspca_dev *gspca_dev)
>   {
>   	struct init_command vivitar_start_commands[] = {
> @@ -623,6 +737,9 @@ static int sd_start(struct gspca_dev *gspca_dev)
>   	case 0x7005:
>   		err_code = start_genius_cam(gspca_dev);
>   		break;
> +	case 0x7003:
> +		err_code = start_genius_videocam_live(gspca_dev);
> +		break;
>   	case 0x8001:
>   		err_code = start_spy_cam(gspca_dev);
>   		break;
> @@ -701,6 +818,7 @@ static const struct sd_desc sd_desc = {
>   /* -- module initialisation -- */
>   static const struct usb_device_id device_table[] = {
>   	{USB_DEVICE(0x0458, 0x7005)}, /* Genius Smart 300, version 2 */
> +	{USB_DEVICE(0x0458, 0x7003)}, /* Genius Videocam Live v2  */
>   	/* The Genius Smart is untested. I can't find an owner ! */
>   	/* {USB_DEVICE(0x0c45, 0x8000)}, DC31VC, Don't know this camera */
>   	{USB_DEVICE(0x0c45, 0x8001)}, /* Wild Planet digital spy cam */
>

Otherwise this patch looks good.

Regards,

Hans

  parent reply	other threads:[~2015-04-21 14:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-19 18:52 [PATCH 1/2] gspca: sn9c2028: Add support for Genius Videocam Live v2 Vasily Khoruzhick
2015-04-19 18:52 ` [PATCH 2/2] gspca: sn9c2028: Add gain and autogain controls " Vasily Khoruzhick
2015-04-19 21:09   ` Theodore Kilgore
2015-04-21 14:32   ` Hans de Goede
2015-04-21 15:00     ` Vasily Khoruzhick
2015-04-21 14:21 ` Hans de Goede [this message]
2015-04-21 14:50   ` [PATCH 1/2] gspca: sn9c2028: Add support for " Vasily Khoruzhick

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=55365D06.6030602@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=anarsoul@gmail.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@osg.samsung.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