Re: [PATCH v2 1/2] gspca: sn9c2028: Add support for Genius Videocam Live v2

2015-05-20 Thread Mauro Carvalho Chehab
Em Fri, 24 Apr 2015 10:04:03 +0300
Vasily Khoruzhick anars...@gmail.com escreveu:

 This cam seems to return different values on long commands, so make status 
 check
 in sn9c2028_long_command() more tolerant. Anyway, read value isn't used 
 anywhere
 later.
 
 Signed-off-by: Vasily Khoruzhick anars...@gmail.com

Hans,

You forgot to add your SOB on those two patches on your pull request.

 ---
 v2: update commit message to explain change in sn9c2028_long_command()
 
  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 kilg...@auburn.edu
 + * Copyright (C) 2015 Vasily Khoruzhick anars...@gmail.com

Hmm... adding a new copyright driver-wide only justifies if you changed 30%
or more of the code. The copyright of your changes will be preserved at
the git history.

   *
   * 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;
   }
 @@ -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, 

Re: [PATCH v2 1/2] gspca: sn9c2028: Add support for Genius Videocam Live v2

2015-05-20 Thread Hans de Goede

Hi,

On 20-05-15 14:12, Mauro Carvalho Chehab wrote:

Em Fri, 24 Apr 2015 10:04:03 +0300
Vasily Khoruzhick anars...@gmail.com escreveu:


This cam seems to return different values on long commands, so make status check
in sn9c2028_long_command() more tolerant. Anyway, read value isn't used anywhere
later.

Signed-off-by: Vasily Khoruzhick anars...@gmail.com


Hans,

You forgot to add your SOB on those two patches on your pull request.


Weird I always use git am -s, ah well. I'll send a new pull-req fixing this.

Regards,

Hans





---
v2: update commit message to explain change in sn9c2028_long_command()

  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 kilg...@auburn.edu
+ * Copyright (C) 2015 Vasily Khoruzhick anars...@gmail.com


Hmm... adding a new copyright driver-wide only justifies if you changed 30%
or more of the code. The copyright of your changes will be preserved at
the git history.


   *
   * 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;
}
@@ -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, 

Re: [PATCH v2 1/2] gspca: sn9c2028: Add support for Genius Videocam Live v2

2015-05-20 Thread Vasily Khoruzhick
Hi Mauro,

On Wed, May 20, 2015 at 3:12 PM, Mauro Carvalho Chehab
mche...@osg.samsung.com wrote:
 Em Fri, 24 Apr 2015 10:04:03 +0300
 Vasily Khoruzhick anars...@gmail.com escreveu:
 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 kilg...@auburn.edu
 + * Copyright (C) 2015 Vasily Khoruzhick anars...@gmail.com

 Hmm... adding a new copyright driver-wide only justifies if you changed 30%
 or more of the code. The copyright of your changes will be preserved at
 the git history.

OK, not a problem.

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


Re: [PATCH v2 1/2] gspca: sn9c2028: Add support for Genius Videocam Live v2

2015-05-15 Thread Vasily Khoruzhick
Ping?

On Fri, Apr 24, 2015 at 10:04 AM, Vasily Khoruzhick anars...@gmail.com wrote:
 This cam seems to return different values on long commands, so make status 
 check
 in sn9c2028_long_command() more tolerant. Anyway, read value isn't used 
 anywhere
 later.

 Signed-off-by: Vasily Khoruzhick anars...@gmail.com
 ---
 v2: update commit message to explain change in sn9c2028_long_command()

  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 kilg...@auburn.edu
 + * Copyright (C) 2015 Vasily Khoruzhick anars...@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;
 }
 @@ -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, 

Re: [PATCH v2 1/2] gspca: sn9c2028: Add support for Genius Videocam Live v2

2015-05-15 Thread Vasily Khoruzhick
Hi Hans,

On Fri, May 15, 2015 at 8:51 PM, Hans de Goede hdego...@redhat.com wrote:
 Sorry for being a bit slow on this one, v2 looks good. I'll queue it up for
 merging into 4.2 as soon as I find some time to work on this,

Thanks!

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


Re: [PATCH v2 1/2] gspca: sn9c2028: Add support for Genius Videocam Live v2

2015-05-15 Thread Hans de Goede

Hi Vasily

On 15-05-15 17:55, Vasily Khoruzhick wrote:

Ping?


Sorry for being a bit slow on this one, v2 looks good. I'll queue it up for
merging into 4.2 as soon as I find some time to work on this,

Regards,

Hans



On Fri, Apr 24, 2015 at 10:04 AM, Vasily Khoruzhick anars...@gmail.com wrote:

This cam seems to return different values on long commands, so make status check
in sn9c2028_long_command() more tolerant. Anyway, read value isn't used anywhere
later.

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
v2: update commit message to explain change in sn9c2028_long_command()

  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 kilg...@auburn.edu
+ * Copyright (C) 2015 Vasily Khoruzhick anars...@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;
 }
@@ -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, 

[PATCH v2 1/2] gspca: sn9c2028: Add support for Genius Videocam Live v2

2015-04-24 Thread Vasily Khoruzhick
This cam seems to return different values on long commands, so make status check
in sn9c2028_long_command() more tolerant. Anyway, read value isn't used anywhere
later.

Signed-off-by: Vasily Khoruzhick anars...@gmail.com
---
v2: update commit message to explain change in sn9c2028_long_command()

 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 kilg...@auburn.edu
+ * Copyright (C) 2015 Vasily Khoruzhick anars...@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;
}
@@ -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},