aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/IR
diff options
context:
space:
mode:
authorJarod Wilson <jarod@redhat.com>2010-04-30 15:06:12 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-05-19 11:58:27 -0400
commitdb190fc13af8e2e5e9d717c16b07342ea8bf9174 (patch)
treeb74b37ffc6d8dad216674e4a8a13d900e90c4462 /drivers/media/IR
parent666a9ed8971657ea7dcf0bd9df17195db4dddf29 (diff)
V4L/DVB: IR/imon: add proper auto-repeat support
Simplified from version 1, in that hacks heisted from ati_remote2.c aren't actually necessary, the real fix for too many repeats was from setting too long a timer release value (200ms) on repeats in mce mode -- this patch drops the release timeout to 33ms, matching the input subsystem default input_dev->rep[REP_PERIOD]. Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/IR')
-rw-r--r--drivers/media/IR/imon.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/media/IR/imon.c b/drivers/media/IR/imon.c
index f5fb08fba637..27743eb0916d 100644
--- a/drivers/media/IR/imon.c
+++ b/drivers/media/IR/imon.c
@@ -146,7 +146,6 @@ struct imon_context {
146}; 146};
147 147
148#define TOUCH_TIMEOUT (HZ/30) 148#define TOUCH_TIMEOUT (HZ/30)
149#define MCE_TIMEOUT_MS 200
150 149
151/* vfd character device file operations */ 150/* vfd character device file operations */
152static const struct file_operations vfd_fops = { 151static const struct file_operations vfd_fops = {
@@ -1392,6 +1391,8 @@ static int imon_parse_press_type(struct imon_context *ictx,
1392 unsigned char *buf, u8 ktype) 1391 unsigned char *buf, u8 ktype)
1393{ 1392{
1394 int press_type = 0; 1393 int press_type = 0;
1394 int rep_delay = ictx->idev->rep[REP_DELAY];
1395 int rep_period = ictx->idev->rep[REP_PERIOD];
1395 1396
1396 /* key release of 0x02XXXXXX key */ 1397 /* key release of 0x02XXXXXX key */
1397 if (ictx->kc == KEY_RESERVED && buf[0] == 0x02 && buf[3] == 0x00) 1398 if (ictx->kc == KEY_RESERVED && buf[0] == 0x02 && buf[3] == 0x00)
@@ -1416,12 +1417,12 @@ static int imon_parse_press_type(struct imon_context *ictx,
1416 ictx->mce_toggle_bit = buf[2]; 1417 ictx->mce_toggle_bit = buf[2];
1417 press_type = 1; 1418 press_type = 1;
1418 mod_timer(&ictx->itimer, 1419 mod_timer(&ictx->itimer,
1419 jiffies + msecs_to_jiffies(MCE_TIMEOUT_MS)); 1420 jiffies + msecs_to_jiffies(rep_delay));
1420 /* repeat */ 1421 /* repeat */
1421 } else { 1422 } else {
1422 press_type = 2; 1423 press_type = 2;
1423 mod_timer(&ictx->itimer, 1424 mod_timer(&ictx->itimer,
1424 jiffies + msecs_to_jiffies(MCE_TIMEOUT_MS)); 1425 jiffies + msecs_to_jiffies(rep_period));
1425 } 1426 }
1426 1427
1427 /* incoherent or irrelevant data */ 1428 /* incoherent or irrelevant data */
@@ -1539,7 +1540,7 @@ static void imon_incoming_packet(struct imon_context *ictx,
1539 do_gettimeofday(&t); 1540 do_gettimeofday(&t);
1540 msec = tv2int(&t, &prev_time); 1541 msec = tv2int(&t, &prev_time);
1541 prev_time = t; 1542 prev_time = t;
1542 if (msec < 200) 1543 if (msec < idev->rep[REP_DELAY])
1543 return; 1544 return;
1544 } 1545 }
1545 1546
@@ -1684,7 +1685,7 @@ static struct input_dev *imon_init_idev(struct imon_context *ictx)
1684 strlcat(ictx->phys_idev, "/input0", sizeof(ictx->phys_idev)); 1685 strlcat(ictx->phys_idev, "/input0", sizeof(ictx->phys_idev));
1685 idev->phys = ictx->phys_idev; 1686 idev->phys = ictx->phys_idev;
1686 1687
1687 idev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); 1688 idev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP) | BIT_MASK(EV_REL);
1688 1689
1689 idev->keybit[BIT_WORD(BTN_MOUSE)] = 1690 idev->keybit[BIT_WORD(BTN_MOUSE)] =
1690 BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_RIGHT); 1691 BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_RIGHT);