Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 193079
b: refs/heads/master
c: 96c1f99
h: refs/heads/master
i:
  193077: 12e89aa
  193075: 7819b56
  193071: 9d53dfa
v: v3
  • Loading branch information
David Härdeman authored and Mauro Carvalho Chehab committed May 19, 2010
1 parent 6e2fa11 commit 290cb17
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 40 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: 5a143b12ebbd37154cb06699a757e9c5845c5e19
refs/heads/master: 96c1f99621a73c58f97d7ca615b2fe936abda555
47 changes: 9 additions & 38 deletions trunk/drivers/media/video/cx231xx/cx231xx-input.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,14 @@ struct cx231xx_ir_poll_result {
struct cx231xx_IR {
struct cx231xx *dev;
struct input_dev *input;
struct ir_input_state ir;
char name[32];
char phys[32];

/* poll external decoder */
int polling;
struct work_struct work;
struct timer_list timer;
unsigned int last_toggle:1;
unsigned int last_readcount;
unsigned int repeat_interval;

int (*get_key) (struct cx231xx_IR *, struct cx231xx_ir_poll_result *);
};
Expand All @@ -83,7 +80,6 @@ struct cx231xx_IR {
static void cx231xx_ir_handle_key(struct cx231xx_IR *ir)
{
int result;
int do_sendkey = 0;
struct cx231xx_ir_poll_result poll_result;

/* read the registers containing the IR status */
Expand All @@ -97,44 +93,23 @@ static void cx231xx_ir_handle_key(struct cx231xx_IR *ir)
poll_result.toggle_bit, poll_result.read_count,
ir->last_readcount, poll_result.rc_data[0]);

if (ir->dev->chip_id == CHIP_ID_EM2874) {
if (poll_result.read_count > 0 &&
poll_result.read_count != ir->last_readcount)
ir_keydown(ir->input,
poll_result.rc_data[0],
poll_result.toggle_bit);

if (ir->dev->chip_id == CHIP_ID_EM2874)
/* The em2874 clears the readcount field every time the
register is read. The em2860/2880 datasheet says that it
is supposed to clear the readcount, but it doesn't. So with
the em2874, we are looking for a non-zero read count as
opposed to a readcount that is incrementing */
ir->last_readcount = 0;
}

if (poll_result.read_count == 0) {
/* The button has not been pressed since the last read */
} else if (ir->last_toggle != poll_result.toggle_bit) {
/* A button has been pressed */
dprintk("button has been pressed\n");
ir->last_toggle = poll_result.toggle_bit;
ir->repeat_interval = 0;
do_sendkey = 1;
} else if (poll_result.toggle_bit == ir->last_toggle &&
poll_result.read_count > 0 &&
poll_result.read_count != ir->last_readcount) {
/* The button is still being held down */
dprintk("button being held down\n");

/* Debouncer for first keypress */
if (ir->repeat_interval++ > 9) {
/* Start repeating after 1 second */
do_sendkey = 1;
}
}
else
ir->last_readcount = poll_result.read_count;

if (do_sendkey) {
dprintk("sending keypress\n");
ir_input_keydown(ir->input, &ir->ir, poll_result.rc_data[0]);
ir_input_nokey(ir->input, &ir->ir);
}

ir->last_readcount = poll_result.read_count;
return;
}

static void ir_timer(unsigned long data)
Expand Down Expand Up @@ -200,10 +175,6 @@ int cx231xx_ir_init(struct cx231xx *dev)
usb_make_path(dev->udev, ir->phys, sizeof(ir->phys));
strlcat(ir->phys, "/input0", sizeof(ir->phys));

err = ir_input_init(input_dev, &ir->ir, IR_TYPE_OTHER);
if (err < 0)
goto err_out_free;

input_dev->name = ir->name;
input_dev->phys = ir->phys;
input_dev->id.bustype = BUS_USB;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/media/video/cx231xx/cx231xx.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#include <media/videobuf-vmalloc.h>
#include <media/v4l2-device.h>
#include <media/ir-kbd-i2c.h>
#include <media/ir-core.h>
#if defined(CONFIG_VIDEO_CX231XX_DVB) || \
defined(CONFIG_VIDEO_CX231XX_DVB_MODULE)
#include <media/videobuf-dvb.h>
Expand Down

0 comments on commit 290cb17

Please sign in to comment.