The patch number 14367 was added via Douglas Schilling Landgraf 
<dougsl...@redhat.com>
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
        Linux Media Mailing List <linux-me...@vger.kernel.org>

------

From: Theodore Kilgore  <kilg...@banach.math.auburn.edu>
gspca_mr97310a: Simplify sensor detection


Simplify sensor detection a bit (share more of the code between cif and vga
cameras). Also remove an unnecessary write from zero_the_pointer().

Priority: normal

Signed-off-by: Theodore Kilgore <kilg...@banach.math.auburn.edu>
Signed-off-by: Hans de Goede <hdego...@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mche...@redhat.com>
Signed-off-by: Douglas Schilling Landgraf <dougsl...@redhat.com>


---

 linux/drivers/media/video/gspca/mr97310a.c |   23 +++++++++------------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff -r cb0b02f2241a -r 113cfa4ade94 linux/drivers/media/video/gspca/mr97310a.c
--- a/linux/drivers/media/video/gspca/mr97310a.c        Wed Mar 03 19:50:36 
2010 -0300
+++ b/linux/drivers/media/video/gspca/mr97310a.c        Wed Mar 03 19:53:28 
2010 -0300
@@ -327,7 +327,6 @@
        if (err_code < 0)
                return err_code;
 
-       err_code = mr_write(gspca_dev, 1);
        data[0] = 0x19;
        data[1] = 0x51;
        err_code = mr_write(gspca_dev, 2);
@@ -460,12 +459,14 @@
        if (err_code < 0)
                return err_code;
 
+       /* Now, the query for sensor type. */
+       err_code = cam_get_response16(gspca_dev, 0x07, 1);
+       if (err_code < 0)
+               return err_code;
+
        if (id->idProduct == 0x0110 || id->idProduct == 0x010e) {
                sd->cam_type = CAM_TYPE_CIF;
                cam->nmodes--;
-               err_code = cam_get_response16(gspca_dev, 0x06, 1);
-               if (err_code < 0)
-                       return err_code;
                /*
                 * All but one of the known CIF cameras share the same USB ID,
                 * but two different init routines are in use, and the control
@@ -473,7 +474,7 @@
                 * of the two known varieties is connected!
                 *
                 * A list of known CIF cameras follows. They all report either
-                * 0002 for type 0 or 0003 for type 1.
+                * 0200 for type 0 or 0300 for type 1.
                 * If you have another to report, please do
                 *
                 * Name         sd->sensor_type         reported by
@@ -487,7 +488,7 @@
                 * Philips dig. keych.  1               T. Kilgore
                 * Trust s...@m 100     1               A. Jacobs
                 */
-               switch (gspca_dev->usb_buf[1]) {
+               switch (gspca_dev->usb_buf[0]) {
                case 2:
                        sd->sensor_type = 0;
                        break;
@@ -504,13 +505,9 @@
        } else {
                sd->cam_type = CAM_TYPE_VGA;
 
-               err_code = cam_get_response16(gspca_dev, 0x07, 1);
-               if (err_code < 0)
-                       return err_code;
-
                /*
-                * Here is a table of the responses to the previous command
-                * from the known MR97310A VGA cameras.
+                * Here is a table of the responses to the query for sensor
+                * type, from the known MR97310A VGA cameras.
                 *
                 * Name                 gspca_dev->usb_buf[]    sd->sensor_type
                 *                              sd->do_lcd_stop
@@ -560,7 +557,7 @@
                PDEBUG(D_PROBE, "MR97310A VGA camera detected, sensor: %d",
                       sd->sensor_type);
        }
-       /* Stop streaming as we've started it to probe the sensor type. */
+       /* Stop streaming as we've started it only to probe the sensor type. */
        sd_stopN(gspca_dev);
 
        if (force_sensor_type != -1) {


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/113cfa4ade940b1f9a1cf94ea33b78bf38a5c90d

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to