Allow driver to initialize its own values for input_dev->rep[REP_DELAY]
and input_dev->rep[REP_PERIOD], but also use the software autorepeat
functionality from input.c.
For example, a HID driver could do:
static void xyz_input_configured(struct hid_device *hid,
struct hid_input *hidinput)
{
hidinput->input->rep[REP_DELAY] = 400;
hidinput->input->rep[REP_PERIOD] = 100;
hidinput->input->softrepeat = true;
}
static struct hid_driver xyz_driver = {
.input_configured = xyz_input_configured,
}
Signed-off-by: Petri Gynther <[email protected]>
---
drivers/input/input.c | 9 +++++++--
include/linux/input.h | 1 +
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 5391abd..a6f65c7 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -2106,13 +2106,18 @@ int input_register_device(struct input_dev *dev)
/*
* If delay and period are pre-set by the driver, then autorepeating
- * is handled by the driver itself and we don't do it in input.c.
+ * is handled by the driver itself and we don't do it in input.c
+ * unless the driver also requests softrepeat.
*/
if (!dev->rep[REP_DELAY] && !dev->rep[REP_PERIOD]) {
- dev->timer.data = (long) dev;
+ dev->softrepeat = true;
+ dev->timer.data = (unsigned long) dev;
dev->timer.function = input_repeat_key;
dev->rep[REP_DELAY] = 250;
dev->rep[REP_PERIOD] = 33;
+ } else if (dev->softrepeat) {
+ dev->timer.data = (unsigned long) dev;
+ dev->timer.function = input_repeat_key;
}
if (!dev->getkeycode)
diff --git a/include/linux/input.h b/include/linux/input.h
index 82ce323..2535948 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -150,6 +150,7 @@ struct input_dev {
struct ff_device *ff;
+ bool softrepeat;
unsigned int repeat_key;
struct timer_list timer;
--
2.6.0.rc2.230.g3dd15c0
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html