Skip to content

Commit 168ffc4

Browse files
mark1m4gregkh
authored andcommitted
USB: ati_remote.c: autorepeat fix
When HZ is set to 250 (new default) or 100, the time span during which repeated events from the device are ignored could be too small due to ms->jiffies rounding. This causes the auto repeat to kick in early making it impossible for the user to generate individual press/release events. Increate the timeout to compensate. Signed-off-by: Marko Macek <[email protected]> Cc: Dmitry Torokhov <[email protected]> Cc: Vojtech Pavlik <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 064e875 commit 168ffc4

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/usb/input/ati_remote.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,8 @@ static const char accel[] = { 1, 2, 4, 6, 9, 13, 20 };
152152
* events. The hardware generates 5 events for the first keypress
153153
* and we have to take this into account for an accurate repeat
154154
* behaviour.
155-
* (HZ / 20) == 50 ms and works well for me.
156155
*/
157-
#define FILTER_TIME (HZ / 20)
156+
#define FILTER_TIME 60 /* msec */
158157

159158
struct ati_remote {
160159
struct input_dev *idev;
@@ -467,7 +466,7 @@ static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs)
467466
/* Filter duplicate events which happen "too close" together. */
468467
if ((ati_remote->old_data[0] == data[1]) &&
469468
(ati_remote->old_data[1] == data[2]) &&
470-
time_before(jiffies, ati_remote->old_jiffies + FILTER_TIME)) {
469+
time_before(jiffies, ati_remote->old_jiffies + msecs_to_jiffies(FILTER_TIME))) {
471470
ati_remote->repeat_count++;
472471
} else {
473472
ati_remote->repeat_count = 0;

0 commit comments

Comments
 (0)