Skip to contentSkip to conversation

gspca: sn9c2028: Add support for Genius Videocam Live v2

PATCH In review Vasily Khoruzhick 3 participants 8 messages Apr 24, 2015 – May 20, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

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.

---
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(-)
drivers/media/usb/gspca/sn9c2028.c +119 -1
index 39b6b2e..317b02c 100644
@@ -2,6 +2,7 @@
  * SN9C2028 library
  *
  * Copyright (C) 2009 Theodore Kilgore <[email protected]>
+ * Copyright (C) 2015 Vasily Khoruzhick <[email protected]>
  *
  * 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},
+		{{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 */
Signature · 1 line
2.3.5
#1 lore raw

PATCH v2 2/2 gspca: sn9c2028: Add gain and autogain controls Genius Videocam Live v2

Autogain algorithm is very simple, if average luminance is low - increase gain, if it's high - decrease gain. Gain granularity is low enough for this algo to stabilize quickly.

---
v2: According to Hans, header lenght is 12 bytes, so drop 2 redundant bytes

 drivers/media/usb/gspca/sn9c2028.c | 122 +++++++++++++++++++++++++++++++++++++
 drivers/media/usb/gspca/sn9c2028.h |  18 +++++-
 2 files changed, 137 insertions(+), 3 deletions(-)
drivers/media/usb/gspca/sn9c2028.c +122 -0
index 317b02c..107200e 100644
@@ -34,6 +34,16 @@ struct sd {
 	struct gspca_dev gspca_dev;  /* !! must be the first item */
 	u8 sof_read;
 	u16 model;
+
+#define MIN_AVG_LUM 8500
+#define MAX_AVG_LUM 10000
+	int avg_lum;
+	u8 avg_lum_l;
+
+	struct { /* autogain and gain control cluster */
+		struct v4l2_ctrl *autogain;
+		struct v4l2_ctrl *gain;
+	};
 };
 
 struct init_command {
@@ -252,6 +262,78 @@ static int run_start_commands(struct gspca_dev *gspca_dev,
 	return 0;
 }
 
+static void set_gain(struct gspca_dev *gspca_dev, s32 g)
+{
+	struct sd *sd = (struct sd *) gspca_dev;
+
+	struct init_command genius_vcam_live_gain_cmds[] = {
+		{{0x1d, 0x25, 0x10 /* This byte is gain */,
+		  0x20, 0xab, 0x00}, 0},
+	};
+	if (!gspca_dev->streaming)
+		return;
+
+	switch (sd->model) {
+	case 0x7003:
+		genius_vcam_live_gain_cmds[0].instruction[2] = g;
+		run_start_commands(gspca_dev, genius_vcam_live_gain_cmds,
+				   ARRAY_SIZE(genius_vcam_live_gain_cmds));
+		break;
+	default:
+		break;
+	}
+}
+
+static int sd_s_ctrl(struct v4l2_ctrl *ctrl)
+{
+	struct gspca_dev *gspca_dev =
+		container_of(ctrl->handler, struct gspca_dev, ctrl_handler);
+	struct sd *sd = (struct sd *)gspca_dev;
+
+	gspca_dev->usb_err = 0;
+
+	if (!gspca_dev->streaming)
+		return 0;
+
+	switch (ctrl->id) {
+	/* standalone gain control */
+	case V4L2_CID_GAIN:
+		set_gain(gspca_dev, ctrl->val);
+		break;
+	/* autogain */
+	case V4L2_CID_AUTOGAIN:
+		set_gain(gspca_dev, sd->gain->val);
+		break;
+	}
+	return gspca_dev->usb_err;
+}
+
+static const struct v4l2_ctrl_ops sd_ctrl_ops = {
+	.s_ctrl = sd_s_ctrl,
+};
+
+
+static int sd_init_controls(struct gspca_dev *gspca_dev)
+{
+	struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler;
+	struct sd *sd = (struct sd *)gspca_dev;
+
+	gspca_dev->vdev.ctrl_handler = hdl;
+	v4l2_ctrl_handler_init(hdl, 2);
+
+	switch (sd->model) {
+	case 0x7003:
+		sd->gain = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
+			V4L2_CID_GAIN, 0, 20, 1, 0);
+		sd->autogain = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
+			V4L2_CID_AUTOGAIN, 0, 1, 1, 1);
+		break;
+	default:
+		break;
+	}
+
+	return 0;
+}
 static int start_spy_cam(struct gspca_dev *gspca_dev)
 {
 	struct init_command spy_start_commands[] = {
@@ -641,6 +723,9 @@ static int start_genius_videocam_live(struct gspca_dev *gspca_dev)
 	if (r < 0)
 		return r;
 
+	if (sd->gain)
+		set_gain(gspca_dev, v4l2_ctrl_g_ctrl(sd->gain));
+
 	return r;
 }
 
@@ -757,6 +842,8 @@ static int sd_start(struct gspca_dev *gspca_dev)
 		return -ENXIO;
 	}
 
+	sd->avg_lum = -1;
+
 	return err_code;
 }
 
@@ -776,6 +863,39 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
 		PERR("Camera Stop command failed");
 }
 
+static void do_autogain(struct gspca_dev *gspca_dev, int avg_lum)
+{
+	struct sd *sd = (struct sd *) gspca_dev;
+	s32 cur_gain = v4l2_ctrl_g_ctrl(sd->gain);
+
+	if (avg_lum == -1)
+		return;
+
+	if (avg_lum < MIN_AVG_LUM) {
+		if (cur_gain == sd->gain->maximum)
+			return;
+		cur_gain++;
+		v4l2_ctrl_s_ctrl(sd->gain, cur_gain);
+	}
+	if (avg_lum > MAX_AVG_LUM) {
+		if (cur_gain == sd->gain->minimum)
+			return;
+		cur_gain--;
+		v4l2_ctrl_s_ctrl(sd->gain, cur_gain);
+	}
+
+}
+
+static void sd_dqcallback(struct gspca_dev *gspca_dev)
+{
+	struct sd *sd = (struct sd *) gspca_dev;
+
+	if (sd->autogain == NULL || !v4l2_ctrl_g_ctrl(sd->autogain))
+		return;
+
+	do_autogain(gspca_dev, sd->avg_lum);
+}
+
 /* Include sn9c2028 sof detection functions */
 #include "sn9c2028.h"
 
@@ -810,8 +930,10 @@ static const struct sd_desc sd_desc = {
 	.name = MODULE_NAME,
 	.config = sd_config,
 	.init = sd_init,
+	.init_controls = sd_init_controls,
 	.start = sd_start,
 	.stopN = sd_stopN,
+	.dq_callback = sd_dqcallback,
 	.pkt_scan = sd_pkt_scan,
 };
 
drivers/media/usb/gspca/sn9c2028.h +15 -3
index 8fd1d3e..f85bc10 100644
@@ -21,8 +21,15 @@
  *
  */
 
-static const unsigned char sn9c2028_sof_marker[5] =
-	{ 0xff, 0xff, 0x00, 0xc4, 0xc4 };
+static const unsigned char sn9c2028_sof_marker[] = {
+	0xff, 0xff, 0x00, 0xc4, 0xc4, 0x96,
+	0x00,
+	0x00, /* seq */
+	0x00,
+	0x00,
+	0x00, /* avg luminance lower 8 bit */
+	0x00, /* avg luminance higher 8 bit */
+};
 
 static unsigned char *sn9c2028_find_sof(struct gspca_dev *gspca_dev,
 					unsigned char *m, int len)
@@ -32,8 +39,13 @@ static unsigned char *sn9c2028_find_sof(struct gspca_dev *gspca_dev,
 
 	/* Search for the SOF marker (fixed part) in the header */
 	for (i = 0; i < len; i++) {
-		if (m[i] == sn9c2028_sof_marker[sd->sof_read]) {
+		if ((m[i] == sn9c2028_sof_marker[sd->sof_read]) ||
+		    (sd->sof_read > 5)) {
 			sd->sof_read++;
+			if (sd->sof_read == 11)
+				sd->avg_lum_l = m[i];
+			if (sd->sof_read == 12)
+				sd->avg_lum = (m[i] << 8) + sd->avg_lum_l;
 			if (sd->sof_read == sizeof(sn9c2028_sof_marker)) {
 				PDEBUG(D_FRAM,
 					"SOF found, bytes to analyze: %u."
Signature · 1 line
2.3.5
#2 lore raw
In reply to Vasily Khoruzhick

Ping?

Quoted 180 lines · 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.

---
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(-)
drivers/media/usb/gspca/sn9c2028.c +119 -2
index 39b6b2e..317b02c 100644
@@ -2,6 +2,7 @@
  * SN9C2028 library
  *
  * Copyright (C) 2009 Theodore Kilgore <[email protected]>
+ * Copyright (C) 2015 Vasily Khoruzhick <[email protected]>
  *
  * 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},
+               {{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 */
--

2.3.5

#3 lore raw

Hi Vasily

Quoted 1 line · Vasily Khoruzhick

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

Quoted 182 lines · Vasily Khoruzhick
Quoted 180 lines

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.

---
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(-)
drivers/media/usb/gspca/sn9c2028.c +119 -2
index 39b6b2e..317b02c 100644
@@ -2,6 +2,7 @@
   * SN9C2028 library
   *
   * Copyright (C) 2009 Theodore Kilgore <[email protected]>
+ * Copyright (C) 2015 Vasily Khoruzhick <[email protected]>
   *
   * 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},
+               {{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 */
--

2.3.5

#4 lore raw

Hi Hans,

Quoted 2 lines · Hans de Goede

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

#5 lore raw
In reply to Vasily Khoruzhick

Em Fri, 24 Apr 2015 10:04:03 +0300
Vasily Khoruzhick <[email protected]> escreveu:

Quoted 5 lines

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.

Hans,

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

Quoted 11 lines

---
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(-)
drivers/media/usb/gspca/sn9c2028.c +0 -0
index 39b6b2e..317b02c 100644

drivers/media/usb/gspca/sn9c2028.c line 5

Quoted 4 lines
drivers/media/usb/gspca/sn9c2028.c +1 -0
@@ -2,6 +2,7 @@
  * SN9C2028 library
  *
  * Copyright (C) 2009 Theodore Kilgore <[email protected]>
+ * Copyright (C) 2015 Vasily Khoruzhick <[email protected]>

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.

Quoted 157 lines
drivers/media/usb/gspca/sn9c2028.c +118 -1
  *
  * 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},
+		{{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 */
#6 lore raw

Hi,

Quoted 7 lines · Mauro Carvalho Chehab

Em Fri, 24 Apr 2015 10:04:03 +0300
Vasily Khoruzhick <[email protected]> escreveu:

Quoted 4 lines

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.

Quoted 5 lines
Quoted 1 line

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

Quoted 178 lines
Quoted 12 lines

---
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(-)
drivers/media/usb/gspca/sn9c2028.c +0 -0
index 39b6b2e..317b02c 100644

drivers/media/usb/gspca/sn9c2028.c line 5

Quoted 4 lines
drivers/media/usb/gspca/sn9c2028.c +1 -0
@@ -2,6 +2,7 @@
   * SN9C2028 library
   *
   * Copyright (C) 2009 Theodore Kilgore <[email protected]>
+ * Copyright (C) 2015 Vasily Khoruzhick <[email protected]>

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.

Quoted 157 lines
drivers/media/usb/gspca/sn9c2028.c +118 -1
   *
   * 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},
+		{{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 */
#7 lore raw
In reply to Mauro Carvalho Chehab

Hi Mauro,

Quoted 15 lines · Mauro Carvalho Chehab

Em Fri, 24 Apr 2015 10:04:03 +0300
Vasily Khoruzhick <[email protected]> escreveu:

drivers/media/usb/gspca/sn9c2028.c line 5

Quoted 9 lines
drivers/media/usb/gspca/sn9c2028.c +1 -0
index 39b6b2e..317b02c 100644
@@ -2,6 +2,7 @@
  * SN9C2028 library
  *
  * Copyright (C) 2009 Theodore Kilgore <[email protected]>
+ * Copyright (C) 2015 Vasily Khoruzhick <[email protected]>

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