Commit 0de95509 authored by Karl Pickett's avatar Karl Pickett Committed by Dmitry Torokhov

Input: ati_remote - make button repeat sensitivity configurable

ati_remote causes repeats after only .23 seconds with my remote and
makes it hard to use comfortably. Make a precise way of setting the
repeat delay time in milliseconds and default it to 500ms.  The old
behavior can be had by setting repeat_delay = 0.
Signed-off-by: default avatarKarl Pickett <karl.pickett@gmail.com>
Signed-off-by: default avatarVincent Vanackere <vincent.vanackere@gmail.com>
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent b7fd4a0a
...@@ -120,6 +120,7 @@ ...@@ -120,6 +120,7 @@
* behaviour. * behaviour.
*/ */
#define FILTER_TIME 60 /* msec */ #define FILTER_TIME 60 /* msec */
#define REPEAT_DELAY 500 /* msec */
static unsigned long channel_mask; static unsigned long channel_mask;
module_param(channel_mask, ulong, 0644); module_param(channel_mask, ulong, 0644);
...@@ -133,6 +134,10 @@ static int repeat_filter = FILTER_TIME; ...@@ -133,6 +134,10 @@ static int repeat_filter = FILTER_TIME;
module_param(repeat_filter, int, 0644); module_param(repeat_filter, int, 0644);
MODULE_PARM_DESC(repeat_filter, "Repeat filter time, default = 60 msec"); 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) #define dbginfo(dev, format, arg...) do { if (debug) dev_info(dev , format , ## arg); } while (0)
#undef err #undef err
#define err(format, arg...) printk(KERN_ERR format , ## arg) #define err(format, arg...) printk(KERN_ERR format , ## arg)
...@@ -174,6 +179,8 @@ struct ati_remote { ...@@ -174,6 +179,8 @@ struct ati_remote {
unsigned char old_data[2]; /* Detect duplicate events */ unsigned char old_data[2]; /* Detect duplicate events */
unsigned long old_jiffies; unsigned long old_jiffies;
unsigned long acc_jiffies; /* handle acceleration */ unsigned long acc_jiffies; /* handle acceleration */
unsigned long first_jiffies;
unsigned int repeat_count; unsigned int repeat_count;
char name[NAME_BUFSIZE]; char name[NAME_BUFSIZE];
...@@ -501,21 +508,31 @@ static void ati_remote_input_report(struct urb *urb) ...@@ -501,21 +508,31 @@ static void ati_remote_input_report(struct urb *urb)
} }
if (ati_remote_tbl[index].kind == KIND_FILTERED) { if (ati_remote_tbl[index].kind == KIND_FILTERED) {
unsigned long now = jiffies;
/* Filter duplicate events which happen "too close" together. */ /* Filter duplicate events which happen "too close" together. */
if (ati_remote->old_data[0] == data[1] && if (ati_remote->old_data[0] == data[1] &&
ati_remote->old_data[1] == data[2] && 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++; ati_remote->repeat_count++;
} else { } else {
ati_remote->repeat_count = 0; ati_remote->repeat_count = 0;
ati_remote->first_jiffies = now;
} }
ati_remote->old_data[0] = data[1]; ati_remote->old_data[0] = data[1];
ati_remote->old_data[1] = data[2]; 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 && 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; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment