Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 168ffc44 authored by Marko Macek's avatar Marko Macek Committed by Greg Kroah-Hartman
Browse files

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: default avatarMarko Macek <Marko.Macek@gmx.net>
Cc: Dmitry Torokhov <dtor_core@ameritech.net>
Cc: Vojtech Pavlik <vojtech@suse.cz>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 064e875a
Loading
Loading
Loading
Loading
+2 −3
Original line number Original line Diff line number Diff line
@@ -152,9 +152,8 @@ static const char accel[] = { 1, 2, 4, 6, 9, 13, 20 };
 * events. The hardware generates 5 events for the first keypress
 * events. The hardware generates 5 events for the first keypress
 * and we have to take this into account for an accurate repeat
 * and we have to take this into account for an accurate repeat
 * behaviour.
 * behaviour.
 * (HZ / 20) == 50 ms and works well for me.
 */
 */
#define FILTER_TIME (HZ / 20)
#define FILTER_TIME 60 /* msec */


struct ati_remote {
struct ati_remote {
	struct input_dev *idev;
	struct input_dev *idev;
@@ -467,7 +466,7 @@ static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs)
		/* 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 + FILTER_TIME)) {
			time_before(jiffies, ati_remote->old_jiffies + msecs_to_jiffies(FILTER_TIME))) {
			ati_remote->repeat_count++;
			ati_remote->repeat_count++;
		} else {
		} else {
			ati_remote->repeat_count = 0;
			ati_remote->repeat_count = 0;