aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorEdwin Huffstutler <edwinh@computer.org>2006-08-04 22:53:02 -0400
committerDmitry Torokhov <dtor@insightbb.com>2006-08-04 22:53:02 -0400
commitc669869710abd1ba47f25569ccc478c42f62a888 (patch)
treee79778b045fff23104719e3a83a0278b7579d8a3 /drivers/usb
parent3d0f0fa0cb554541e10cb8cb84104e4b10828468 (diff)
Input: ati_remote - make filter time a module parameter
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/input/ati_remote.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/drivers/usb/input/ati_remote.c b/drivers/usb/input/ati_remote.c
index df198cf76f52..b00232cdd392 100644
--- a/drivers/usb/input/ati_remote.c
+++ b/drivers/usb/input/ati_remote.c
@@ -111,6 +111,16 @@
111#define NAME_BUFSIZE 80 /* size of product name, path buffers */ 111#define NAME_BUFSIZE 80 /* size of product name, path buffers */
112#define DATA_BUFSIZE 63 /* size of URB data buffers */ 112#define DATA_BUFSIZE 63 /* size of URB data buffers */
113 113
114/*
115 * Duplicate event filtering time.
116 * Sequential, identical KIND_FILTERED inputs with less than
117 * FILTER_TIME milliseconds between them are considered as repeat
118 * events. The hardware generates 5 events for the first keypress
119 * and we have to take this into account for an accurate repeat
120 * behaviour.
121 */
122#define FILTER_TIME 60 /* msec */
123
114static unsigned long channel_mask; 124static unsigned long channel_mask;
115module_param(channel_mask, ulong, 0444); 125module_param(channel_mask, ulong, 0444);
116MODULE_PARM_DESC(channel_mask, "Bitmask of remote control channels to ignore"); 126MODULE_PARM_DESC(channel_mask, "Bitmask of remote control channels to ignore");
@@ -119,6 +129,10 @@ static int debug;
119module_param(debug, int, 0444); 129module_param(debug, int, 0444);
120MODULE_PARM_DESC(debug, "Enable extra debug messages and information"); 130MODULE_PARM_DESC(debug, "Enable extra debug messages and information");
121 131
132static int repeat_filter = FILTER_TIME;
133module_param(repeat_filter, int, 0644);
134MODULE_PARM_DESC(repeat_filter, "Repeat filter time, default = 60 msec");
135
122#define dbginfo(dev, format, arg...) do { if (debug) dev_info(dev , format , ## arg); } while (0) 136#define dbginfo(dev, format, arg...) do { if (debug) dev_info(dev , format , ## arg); } while (0)
123#undef err 137#undef err
124#define err(format, arg...) printk(KERN_ERR format , ## arg) 138#define err(format, arg...) printk(KERN_ERR format , ## arg)
@@ -146,15 +160,6 @@ static char init2[] = { 0x01, 0x00, 0x20, 0x14, 0x20, 0x20, 0x20 };
146/* Acceleration curve for directional control pad */ 160/* Acceleration curve for directional control pad */
147static const char accel[] = { 1, 2, 4, 6, 9, 13, 20 }; 161static const char accel[] = { 1, 2, 4, 6, 9, 13, 20 };
148 162
149/* Duplicate event filtering time.
150 * Sequential, identical KIND_FILTERED inputs with less than
151 * FILTER_TIME jiffies between them are considered as repeat
152 * events. The hardware generates 5 events for the first keypress
153 * and we have to take this into account for an accurate repeat
154 * behaviour.
155 */
156#define FILTER_TIME 60 /* msec */
157
158struct ati_remote { 163struct ati_remote {
159 struct input_dev *idev; 164 struct input_dev *idev;
160 struct usb_device *udev; 165 struct usb_device *udev;
@@ -464,9 +469,9 @@ static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs)
464 469
465 if (ati_remote_tbl[index].kind == KIND_FILTERED) { 470 if (ati_remote_tbl[index].kind == KIND_FILTERED) {
466 /* Filter duplicate events which happen "too close" together. */ 471 /* Filter duplicate events which happen "too close" together. */
467 if ((ati_remote->old_data[0] == data[1]) && 472 if (ati_remote->old_data[0] == data[1] &&
468 (ati_remote->old_data[1] == data[2]) && 473 ati_remote->old_data[1] == data[2] &&
469 time_before(jiffies, ati_remote->old_jiffies + msecs_to_jiffies(FILTER_TIME))) { 474 time_before(jiffies, ati_remote->old_jiffies + msecs_to_jiffies(repeat_filter))) {
470 ati_remote->repeat_count++; 475 ati_remote->repeat_count++;
471 } else { 476 } else {
472 ati_remote->repeat_count = 0; 477 ati_remote->repeat_count = 0;
@@ -476,8 +481,8 @@ static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs)
476 ati_remote->old_data[1] = data[2]; 481 ati_remote->old_data[1] = data[2];
477 ati_remote->old_jiffies = jiffies; 482 ati_remote->old_jiffies = jiffies;
478 483
479 if ((ati_remote->repeat_count > 0) 484 if (ati_remote->repeat_count > 0 &&
480 && (ati_remote->repeat_count < 5)) 485 ati_remote->repeat_count < 5)
481 return; 486 return;
482 487
483 488