Commit 08791e5cf62b6952ca32106aebb79b6066005de4

Authored by Dmitry Torokhov
1 parent 89c9b4805a

Input: ressurect EVIOCGREP and EVIOCSREP

While writing to an event device allows to set repeat rate for an
individual input device there is no way to retrieve current settings
so we need to ressurect EVIOCGREP. Also ressurect EVIOCSREP so we
have a symmetrical interface.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>

Showing 2 changed files with 23 additions and 0 deletions Side-by-side Diff

drivers/input/evdev.c
... ... @@ -403,6 +403,27 @@
403 403 case EVIOCGID:
404 404 if (copy_to_user(p, &dev->id, sizeof(struct input_id)))
405 405 return -EFAULT;
  406 + return 0;
  407 +
  408 + case EVIOCGREP:
  409 + if (!test_bit(EV_REP, dev->evbit))
  410 + return -ENOSYS;
  411 + if (put_user(dev->rep[REP_DELAY], ip))
  412 + return -EFAULT;
  413 + if (put_user(dev->rep[REP_PERIOD], ip + 1))
  414 + return -EFAULT;
  415 + return 0;
  416 +
  417 + case EVIOCSREP:
  418 + if (!test_bit(EV_REP, dev->evbit))
  419 + return -ENOSYS;
  420 + if (get_user(u, ip))
  421 + return -EFAULT;
  422 + if (get_user(v, ip + 1))
  423 + return -EFAULT;
  424 +
  425 + input_event(dev, EV_REP, REP_DELAY, u);
  426 + input_event(dev, EV_REP, REP_PERIOD, v);
406 427  
407 428 return 0;
408 429  
include/linux/input.h
... ... @@ -56,6 +56,8 @@
56 56  
57 57 #define EVIOCGVERSION _IOR('E', 0x01, int) /* get driver version */
58 58 #define EVIOCGID _IOR('E', 0x02, struct input_id) /* get device ID */
  59 +#define EVIOCGREP _IOR('E', 0x03, int[2]) /* get repeat settings */
  60 +#define EVIOCSREP _IOW('E', 0x03, int[2]) /* set repeat settings */
59 61 #define EVIOCGKEYCODE _IOR('E', 0x04, int[2]) /* get keycode */
60 62 #define EVIOCSKEYCODE _IOW('E', 0x04, int[2]) /* set keycode */
61 63