The patch number 14389 was added via Douglas Schilling Landgraf 
<[email protected]>
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 <[email protected]>

------

From: Hans de Goede  <[email protected]>
gspca_ov519: Add support for the button on ov518 based cams


Due to hardware limitations this only works while the camera is
streaming.

Priority: normal

Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
Signed-off-by: Douglas Schilling Landgraf <[email protected]>


---

 linux/drivers/media/video/gspca/ov519.c |   54 ++++++++++++------------
 1 file changed, 29 insertions(+), 25 deletions(-)

diff -r 72e2596d964e -r 335fb88c2820 linux/drivers/media/video/gspca/ov519.c
--- a/linux/drivers/media/video/gspca/ov519.c   Thu Mar 04 02:45:31 2010 -0300
+++ b/linux/drivers/media/video/gspca/ov519.c   Thu Mar 04 02:46:58 2010 -0300
@@ -2706,6 +2706,11 @@
        sd->snapshot_needs_reset = 0;
 
        switch (sd->bridge) {
+       case BRIDGE_OV518:
+       case BRIDGE_OV518PLUS:
+               reg_w(sd, R51x_SYS_SNAP, 0x02); /* Reset */
+               reg_w(sd, R51x_SYS_SNAP, 0x01); /* Enable */
+               break;
        case BRIDGE_OV519:
                reg_w(sd, R51x_SYS_RESET, 0x40);
                reg_w(sd, R51x_SYS_RESET, 0x00);
@@ -3996,6 +4001,28 @@
                w9968cf_stop0(sd);
 }
 
+static void ov51x_handle_button(struct gspca_dev *gspca_dev, u8 state)
+{
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       if (sd->snapshot_pressed != state) {
+#ifdef CONFIG_INPUT
+               input_report_key(gspca_dev->input_dev, KEY_CAMERA, state);
+               input_sync(gspca_dev->input_dev);
+#endif
+               if (state)
+                       sd->snapshot_needs_reset = 1;
+
+               sd->snapshot_pressed = state;
+       } else {
+               /* On the ov519 we need to reset the button state multiple
+                  times, as resetting does not work as long as the button
+                  stays pressed */
+               if (sd->bridge == BRIDGE_OV519 && state)
+                       sd->snapshot_needs_reset = 1;
+       }
+}
+
 static void ov511_pkt_scan(struct gspca_dev *gspca_dev,
                        u8 *in,                 /* isoc packet */
                        int len)                /* iso packet length */
@@ -4054,6 +4081,7 @@
        /* A false positive here is likely, until OVT gives me
         * the definitive SOF/EOF format */
        if ((!(data[0] | data[1] | data[2] | data[3] | data[5])) && data[6]) {
+               ov51x_handle_button(gspca_dev, (data[6] >> 1) & 1);
                gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0);
                gspca_frame_add(gspca_dev, FIRST_PACKET, NULL, 0);
                sd->packet_nr = 0;
@@ -4082,30 +4110,6 @@
        gspca_frame_add(gspca_dev, INTER_PACKET, data, len);
 }
 
-static void ov519_handle_button(struct gspca_dev *gspca_dev, u8 state)
-{
-       struct sd *sd = (struct sd *) gspca_dev;
-
-       /* This should never happen, but better to check */
-       if (state != 0 && state != 1)
-               return;
-
-       /* We may need to reset the button state multiple times, as resetting
-          does not work as long as the button stays pressed, so always set
-          snapshot_needs_reset (instead of only on a state change to 1). */
-       if (state)
-               sd->snapshot_needs_reset = 1;
-
-       if (sd->snapshot_pressed != state) {
-#ifdef CONFIG_INPUT
-               input_report_key(gspca_dev->input_dev, KEY_CAMERA, state);
-               input_sync(gspca_dev->input_dev);
-#endif
-
-               sd->snapshot_pressed = state;
-       }
-}
-
 static void ov519_pkt_scan(struct gspca_dev *gspca_dev,
                        u8 *data,                       /* isoc packet */
                        int len)                        /* iso packet length */
@@ -4139,7 +4143,7 @@
                                gspca_dev->last_packet_type = DISCARD_PACKET;
                        return;
                case 0x51:              /* end of frame */
-                       ov519_handle_button(gspca_dev, data[11]);
+                       ov51x_handle_button(gspca_dev, data[11] & 1);
                        if (data[9] != 0)
                                gspca_dev->last_packet_type = DISCARD_PACKET;
                        gspca_frame_add(gspca_dev, LAST_PACKET,


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/335fb88c2820906d924c34bdea33a1abbb1ead67

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to