Re: [PATCH 001/001] INPUT: new ioctl's to retrieve values of EV_REP and EV_SND event codes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 26, 2006 at 01:06:38AM -0400, Dmitry Torokhov wrote:

> > Yes. And EVIOCSREP should just generate the events needed to notify the
> > drivers to do the change.
> > 
> 
> What do you gius think about the patch below?

It looks fine to me.

> -- 
> Dmitry
> 
> Signed-off-by: Dmitry Torokhov <[email protected]>
> ---
> 
>  drivers/input/evdev.c |   21 +++++++++++++++++++++
>  include/linux/input.h |    2 ++
>  2 files changed, 23 insertions(+)
> 
> Index: work/drivers/input/evdev.c
> ===================================================================
> --- work.orig/drivers/input/evdev.c
> +++ work/drivers/input/evdev.c
> @@ -403,6 +403,27 @@ static long evdev_ioctl_handler(struct f
>  		case EVIOCGID:
>  			if (copy_to_user(p, &dev->id, sizeof(struct input_id)))
>  				return -EFAULT;
> +			return 0;
> +
> +		case EVIOCGREP:
> +			if (!test_bit(EV_REP, dev->evbit))
> +				return -ENOSYS;
> +			if (put_user(dev->rep[REP_DELAY], ip))
> +				return -EFAULT;
> +			if (put_user(dev->rep[REP_PERIOD], ip + 1))
> +				return -EFAULT;
> +			return 0;
> +
> +		case EVIOCSREP:
> +			if (!test_bit(EV_REP, dev->evbit))
> +				return -ENOSYS;
> +			if (get_user(u, ip))
> +				return -EFAULT;
> +			if (get_user(v, ip + 1))
> +				return -EFAULT;
> +
> +			input_event(dev, EV_REP, REP_DELAY, u);
> +			input_event(dev, EV_REP, REP_PERIOD, v);
>  
>  			return 0;
>  
> Index: work/include/linux/input.h
> ===================================================================
> --- work.orig/include/linux/input.h
> +++ work/include/linux/input.h
> @@ -56,6 +56,8 @@ struct input_absinfo {
>  
>  #define EVIOCGVERSION		_IOR('E', 0x01, int)			/* get driver version */
>  #define EVIOCGID		_IOR('E', 0x02, struct input_id)	/* get device ID */
> +#define EVIOCGREP		_IOR('E', 0x03, int[2])			/* get repeat settings */
> +#define EVIOCSREP		_IOW('E', 0x03, int[2])			/* get repeat settings */
>  #define EVIOCGKEYCODE		_IOR('E', 0x04, int[2])			/* get keycode */
>  #define EVIOCSKEYCODE		_IOW('E', 0x04, int[2])			/* set keycode */
>  
> 
> 

-- 
Vojtech Pavlik
Director SuSE Labs
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux