From: "Vincent Vanackere" <vincent.vanackere@gmail.com>
To: "Karl Pickett" <karl.pickett@gmail.com>
Cc: Eric.Piel@tremplin-utc.net, linux-kernel@vger.kernel.org,
inux-input@atrey.karlin.mff.cuni.cz
Subject: Re: [PATCH] Make ati_remote button repeat sensitivity soft-configurable
Date: Wed, 4 Apr 2007 22:52:55 +0200 [thread overview]
Message-ID: <65258a580704041352q664f5da2xeaeec1a82819d9ef@mail.gmail.com> (raw)
In-Reply-To: <f9be06770704040821h6d96e703hf405335fa73f289b@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 647 bytes --]
On 4/4/07, Karl Pickett <karl.pickett@gmail.com> wrote:
> Would this be more acceptable? I haven't compiled or tested yet..but
> you can see what I'm trying to do.. make the delay time based instead
> of implementation/count based...
Well, I was going to submit a similar patch so I'd say that's the
right approach ;-)
(I just think the check on repeat_count < 5 must be kept as is
prevents the user to get the spurious events even if repeat_delay is
set too low).
I'm attaching a very small adaptation of your patch (re-added the
repeat_count check and a small comment, compile & run-time tested).
Works fine for me...
Best regards,
Vincent
[-- Attachment #2: atiremote.diff --]
[-- Type: text/x-patch, Size: 2220 bytes --]
--- drivers/usb/input/ati_remote.c.orig 2007-04-04 22:05:10.000000000 +0200
+++ drivers/usb/input/ati_remote.c 2007-04-04 22:35:59.000000000 +0200
@@ -120,6 +120,7 @@
* behaviour.
*/
#define FILTER_TIME 60 /* msec */
+#define REPEAT_DELAY 500 /* msec */
static unsigned long channel_mask;
module_param(channel_mask, ulong, 0644);
@@ -133,6 +134,10 @@
module_param(repeat_filter, int, 0644);
MODULE_PARM_DESC(repeat_filter, "Repeat filter time, default = 60 msec");
+static int repeat_delay = REPEAT_DELAY;
+module_param(repeat_delay, int, 0644);
+MODULE_PARM_DESC(repeat_delay, "Delay before sending repeats, default = 500 msec");
+
#define dbginfo(dev, format, arg...) do { if (debug) dev_info(dev , format , ## arg); } while (0)
#undef err
#define err(format, arg...) printk(KERN_ERR format , ## arg)
@@ -174,6 +179,8 @@
unsigned char old_data[2]; /* Detect duplicate events */
unsigned long old_jiffies;
unsigned long acc_jiffies; /* handle acceleration */
+ unsigned long first_jiffies;
+
unsigned int repeat_count;
char name[NAME_BUFSIZE];
@@ -501,21 +508,31 @@
}
if (ati_remote_tbl[index].kind == KIND_FILTERED) {
+ unsigned long now = jiffies;
+
/* Filter duplicate events which happen "too close" together. */
if (ati_remote->old_data[0] == data[1] &&
ati_remote->old_data[1] == data[2] &&
- time_before(jiffies, ati_remote->old_jiffies + msecs_to_jiffies(repeat_filter))) {
+ time_before(now, ati_remote->old_jiffies +
+ msecs_to_jiffies(repeat_filter))) {
ati_remote->repeat_count++;
} else {
ati_remote->repeat_count = 0;
+ ati_remote->first_jiffies = now;
}
ati_remote->old_data[0] = data[1];
ati_remote->old_data[1] = data[2];
- ati_remote->old_jiffies = jiffies;
+ ati_remote->old_jiffies = now;
+ /* Ensure we skip at least the 4 first duplicate events (generated
+ * by a single keypress), and continue skipping until repeat_delay
+ * msecs have passed
+ */
if (ati_remote->repeat_count > 0 &&
- ati_remote->repeat_count < 5)
+ (ati_remote->repeat_count < 5 ||
+ time_before(now, ati_remote->first_jiffies +
+ msecs_to_jiffies(repeat_delay))))
return;
next prev parent reply other threads:[~2007-04-04 20:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-04 0:34 Karl Pickett
2007-04-04 2:51 ` Dmitry Torokhov
2007-04-04 7:46 ` Éric Piel
2007-04-04 8:45 ` Vincent Vanackere
2007-04-04 13:37 ` Karl Pickett
2007-04-04 15:21 ` Karl Pickett
2007-04-04 20:52 ` Vincent Vanackere [this message]
2007-04-04 21:04 ` Éric Piel
2007-04-04 21:16 ` Vincent Vanackere
2007-04-04 21:58 ` Karl Pickett
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=65258a580704041352q664f5da2xeaeec1a82819d9ef@mail.gmail.com \
--to=vincent.vanackere@gmail.com \
--cc=Eric.Piel@tremplin-utc.net \
--cc=inux-input@atrey.karlin.mff.cuni.cz \
--cc=karl.pickett@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®