From patchwork Fri Apr 30 19:06:12 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarod Wilson X-Patchwork-Id: 96008 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o3UJ7gkB004945 for ; Fri, 30 Apr 2010 19:07:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759416Ab0D3TGX (ORCPT ); Fri, 30 Apr 2010 15:06:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1797 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934240Ab0D3TGR (ORCPT ); Fri, 30 Apr 2010 15:06:17 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o3UJ6DSO008194 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 30 Apr 2010 15:06:13 -0400 Received: from ihatethathostname.lab.bos.redhat.com (ihatethathostname.lab.bos.redhat.com [10.16.43.238]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o3UJ6CZU010817 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 30 Apr 2010 15:06:13 -0400 Received: from ihatethathostname.lab.bos.redhat.com (ihatethathostname.lab.bos.redhat.com [127.0.0.1]) by ihatethathostname.lab.bos.redhat.com (8.14.4/8.14.3) with ESMTP id o3UJ6CrW030339; Fri, 30 Apr 2010 15:06:12 -0400 Received: (from jarod@localhost) by ihatethathostname.lab.bos.redhat.com (8.14.4/8.14.4/Submit) id o3UJ6CvD030337; Fri, 30 Apr 2010 15:06:12 -0400 X-Authentication-Warning: ihatethathostname.lab.bos.redhat.com: jarod set sender to jarod@redhat.com using -f Date: Fri, 30 Apr 2010 15:06:12 -0400 From: Jarod Wilson To: linux-media@vger.kernel.org Cc: linux-input@vger.kernel.org, Dmitry Torokhov Subject: [PATCH v2] IR/imon: add proper auto-repeat support Message-ID: <20100430190611.GA30308@redhat.com> References: <20100428173700.GA14240@redhat.com> <20100428204112.GA6663@core.coreip.homeip.net> <20100428210058.GO15951@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20100428210058.GO15951@redhat.com> User-Agent: Mutt/1.5.20 (2009-12-10) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 30 Apr 2010 19:07:42 +0000 (UTC) diff --git a/drivers/media/IR/imon.c b/drivers/media/IR/imon.c index b65c31a..09d4e44 100644 --- a/drivers/media/IR/imon.c +++ b/drivers/media/IR/imon.c @@ -146,7 +146,6 @@ struct imon_context { }; #define TOUCH_TIMEOUT (HZ/30) -#define MCE_TIMEOUT_MS 200 /* vfd character device file operations */ static const struct file_operations vfd_fops = { @@ -1394,6 +1393,8 @@ static int imon_parse_press_type(struct imon_context *ictx, unsigned char *buf, u8 ktype) { int press_type = 0; + int rep_delay = ictx->idev->rep[REP_DELAY]; + int rep_period = ictx->idev->rep[REP_PERIOD]; /* key release of 0x02XXXXXX key */ if (ictx->kc == KEY_RESERVED && buf[0] == 0x02 && buf[3] == 0x00) @@ -1418,12 +1419,12 @@ static int imon_parse_press_type(struct imon_context *ictx, ictx->mce_toggle_bit = buf[2]; press_type = 1; mod_timer(&ictx->itimer, - jiffies + msecs_to_jiffies(MCE_TIMEOUT_MS)); + jiffies + msecs_to_jiffies(rep_delay)); /* repeat */ } else { press_type = 2; mod_timer(&ictx->itimer, - jiffies + msecs_to_jiffies(MCE_TIMEOUT_MS)); + jiffies + msecs_to_jiffies(rep_period)); } /* incoherent or irrelevant data */ @@ -1541,7 +1542,7 @@ static void imon_incoming_packet(struct imon_context *ictx, do_gettimeofday(&t); msec = tv2int(&t, &prev_time); prev_time = t; - if (msec < 200) + if (msec < idev->rep[REP_DELAY]) return; } @@ -1686,7 +1687,7 @@ static struct input_dev *imon_init_idev(struct imon_context *ictx) strlcat(ictx->phys_idev, "/input0", sizeof(ictx->phys_idev)); idev->phys = ictx->phys_idev; - idev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); + idev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP) | BIT_MASK(EV_REL); idev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_RIGHT);