Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 323414
b: refs/heads/master
c: 352ac4b
h: refs/heads/master
v: v3
  • Loading branch information
Henrik Rydberg committed Sep 19, 2012
1 parent 2068bea commit 32ed2f2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0672120a2ee7c533dfec6db7c3e43450f439e5ff
refs/heads/master: 352ac4bd018005cfa6f844433a98aa0b724fa8db
46 changes: 25 additions & 21 deletions trunk/drivers/input/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,22 @@ static int input_defuzz_abs_event(int value, int old_val, int fuzz)
return value;
}

static void input_start_autorepeat(struct input_dev *dev, int code)
{
if (test_bit(EV_REP, dev->evbit) &&
dev->rep[REP_PERIOD] && dev->rep[REP_DELAY] &&
dev->timer.data) {
dev->repeat_key = code;
mod_timer(&dev->timer,
jiffies + msecs_to_jiffies(dev->rep[REP_DELAY]));
}
}

static void input_stop_autorepeat(struct input_dev *dev)
{
del_timer(&dev->timer);
}

/*
* Pass event first through all filters and then, if event has not been
* filtered out, through all open handles. This function is called with
Expand Down Expand Up @@ -105,6 +121,15 @@ static void input_pass_event(struct input_dev *dev,
}

rcu_read_unlock();

/* trigger auto repeat for key events */
if (type == EV_KEY && value != 2) {
if (value)
input_start_autorepeat(dev, code);
else
input_stop_autorepeat(dev);
}

}

/*
Expand Down Expand Up @@ -142,22 +167,6 @@ static void input_repeat_key(unsigned long data)
spin_unlock_irqrestore(&dev->event_lock, flags);
}

static void input_start_autorepeat(struct input_dev *dev, int code)
{
if (test_bit(EV_REP, dev->evbit) &&
dev->rep[REP_PERIOD] && dev->rep[REP_DELAY] &&
dev->timer.data) {
dev->repeat_key = code;
mod_timer(&dev->timer,
jiffies + msecs_to_jiffies(dev->rep[REP_DELAY]));
}
}

static void input_stop_autorepeat(struct input_dev *dev)
{
del_timer(&dev->timer);
}

#define INPUT_IGNORE_EVENT 0
#define INPUT_PASS_TO_HANDLERS 1
#define INPUT_PASS_TO_DEVICE 2
Expand Down Expand Up @@ -252,11 +261,6 @@ static void input_handle_event(struct input_dev *dev,

__change_bit(code, dev->key);
disposition = INPUT_PASS_TO_HANDLERS;

if (value)
input_start_autorepeat(dev, code);
else
input_stop_autorepeat(dev);
}
}
break;
Expand Down

0 comments on commit 32ed2f2

Please sign in to comment.