Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 285695
b: refs/heads/master
c: ee186fd
h: refs/heads/master
i:
  285693: a1105d6
  285691: 4ef8690
  285687: f3dcdd3
  285679: 4f6ad44
  285663: 6d5abc6
  285631: 3abf507
  285567: c7b9c12
  285439: 3f73f14
  285183: 72c9568
  284671: f5eec5e
v: v3
  • Loading branch information
Hans de Goede authored and Mauro Carvalho Chehab committed Jan 6, 2012
1 parent 5334eda commit 6001b76
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0218d53a12a1b90d261b6f9cf0a4cee38d230916
refs/heads/master: ee186fd96a5f98f971316d26822b94c331d56a57
25 changes: 25 additions & 0 deletions trunk/drivers/media/video/gspca/t613.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

#define MODULE_NAME "t613"

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

Expand Down Expand Up @@ -57,6 +58,7 @@ struct sd {
u8 effect;

u8 sensor;
u8 button_pressed;
};
enum sensors {
SENSOR_OM6802,
Expand Down Expand Up @@ -1095,15 +1097,35 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
msleep(20);
reg_w(gspca_dev, 0x0309);
}
#if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE)
/* If the last button state is pressed, release it now! */
if (sd->button_pressed) {
input_report_key(gspca_dev->input_dev, KEY_CAMERA, 0);
input_sync(gspca_dev->input_dev);
sd->button_pressed = 0;
}
#endif
}

static void sd_pkt_scan(struct gspca_dev *gspca_dev,
u8 *data, /* isoc packet */
int len) /* iso packet length */
{
struct sd *sd = (struct sd *) gspca_dev;
int pkt_type;

if (data[0] == 0x5a) {
#if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE)
if (len > 20) {
u8 state = (data[20] & 0x80) ? 1 : 0;
if (sd->button_pressed != state) {
input_report_key(gspca_dev->input_dev,
KEY_CAMERA, state);
input_sync(gspca_dev->input_dev);
sd->button_pressed = state;
}
}
#endif
/* Control Packet, after this came the header again,
* but extra bytes came in the packet before this,
* sometimes an EOF arrives, sometimes not... */
Expand Down Expand Up @@ -1410,6 +1432,9 @@ static const struct sd_desc sd_desc = {
.stopN = sd_stopN,
.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 6001b76

Please sign in to comment.