Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 242079
b: refs/heads/master
c: c2f644a
h: refs/heads/master
i:
  242077: b9ae1e6
  242075: 597d915
  242071: 0bc89d1
  242063: b96163f
  242047: e999827
v: v3
  • Loading branch information
Hans de Goede authored and Mauro Carvalho Chehab committed Mar 22, 2011
1 parent a592a33 commit f2a99d2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c05df8b32ab4b8103f8c20cbd3ab7191be613b68
refs/heads/master: c2f644aeeba3a5178767e757e93151959f037db1
31 changes: 26 additions & 5 deletions trunk/drivers/media/video/gspca/cpia1.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#define MODULE_NAME "cpia1"

#include <linux/input.h>
#include "gspca.h"

MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>");
Expand Down Expand Up @@ -653,10 +654,15 @@ static int do_command(struct gspca_dev *gspca_dev, u16 command,
break;

case CPIA_COMMAND_ReadMCPorts:
if (!sd->params.qx3.qx3_detected)
break;
/* test button press */
sd->params.qx3.button = ((gspca_dev->usb_buf[1] & 0x02) == 0);
a = ((gspca_dev->usb_buf[1] & 0x02) == 0);
if (a != sd->params.qx3.button) {
#if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE)
input_report_key(gspca_dev->input_dev, KEY_CAMERA, a);
input_sync(gspca_dev->input_dev);
#endif
sd->params.qx3.button = a;
}
if (sd->params.qx3.button) {
/* button pressed - unlock the latch */
do_command(gspca_dev, CPIA_COMMAND_WriteMCPort,
Expand Down Expand Up @@ -1738,6 +1744,8 @@ static int sd_start(struct gspca_dev *gspca_dev)

static void sd_stopN(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;

command_pause(gspca_dev);

/* save camera state for later open (developers guide ch 3.5.3) */
Expand All @@ -1748,6 +1756,17 @@ static void sd_stopN(struct gspca_dev *gspca_dev)

/* Update the camera status */
do_command(gspca_dev, CPIA_COMMAND_GetCameraStatus, 0, 0, 0, 0);

#if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE)
/* If the last button state is pressed, release it now! */
if (sd->params.qx3.button) {
/* The camera latch will hold the pressed state until we reset
the latch, so we do not reset sd->params.qx3.button now, to
avoid a false keypress being reported the next sd_start */
input_report_key(gspca_dev->input_dev, KEY_CAMERA, 0);
input_sync(gspca_dev->input_dev);
}
#endif
}

/* this function is called at probe and resume time */
Expand Down Expand Up @@ -1852,8 +1871,7 @@ static void sd_dq_callback(struct gspca_dev *gspca_dev)

/* Update our knowledge of the camera state */
do_command(gspca_dev, CPIA_COMMAND_GetExposure, 0, 0, 0, 0);
if (sd->params.qx3.qx3_detected)
do_command(gspca_dev, CPIA_COMMAND_ReadMCPorts, 0, 0, 0, 0);
do_command(gspca_dev, CPIA_COMMAND_ReadMCPorts, 0, 0, 0, 0);
}

static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val)
Expand Down Expand Up @@ -2085,6 +2103,9 @@ static const struct sd_desc sd_desc = {
.dq_callback = sd_dq_callback,
.pkt_scan = sd_pkt_scan,
.querymenu = sd_querymenu,
#if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE)
.other_input = 1,
#endif
};

/* -- module initialisation -- */
Expand Down

0 comments on commit f2a99d2

Please sign in to comment.