public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dtor_core@ameritech.net>
To: Vojtech Pavlik <vojtech@suse.cz>
Cc: bjd <bjdouma@xs4all.nl>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 001/001] INPUT: new ioctl's to retrieve values of EV_REP and EV_SND event codes
Date: Wed, 26 Apr 2006 01:06:38 -0400	[thread overview]
Message-ID: <200604260106.38480.dtor_core@ameritech.net> (raw)
In-Reply-To: <20060425152600.GA30398@suse.cz>

On Tuesday 25 April 2006 11:26, Vojtech Pavlik wrote:
> On Tue, Apr 25, 2006 at 11:23:02AM -0400, Dmitry Torokhov wrote:
> > On 4/25/06, Vojtech Pavlik <vojtech@suse.cz> wrote:
> > > On Tue, Apr 25, 2006 at 09:19:42AM -0400, Dmitry Torokhov wrote:
> > > > On 4/24/06, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:
> > > > > On 4/24/06, Vojtech Pavlik <vojtech@suse.cz> wrote:
> > > > > > On Mon, Apr 24, 2006 at 10:31:39AM -0400, Dmitry Torokhov wrote:
> > > > > > >
> > > > > > > Vojtech, could you remind me why EVIOC{G|S}REP were removed? Some
> > > > > > > people want to have ability to separate keyboards (via grabbing); they
> > > > > > > also might want to control repeat rate independently. Shoudl we
> > > > > > > reinstate these ioctls?
> > > > > >
> > > > > > I believe they were replaced by the ability to send EV_REP style events
> > > > > > to the device, setting the repeat rate.
> > > > > >
> > > > >
> > > > > Argh, why am I always forgetting about ability to write events into devices?
> > > >
> > > > Thinking about it some more - writing to the event device is an
> > > > elegant way to set repeat rate but how do you retrieve current repeat
> > > > rate for a given device?
> > >
> > > You can't. And that's likely a problem that needs fixing.
> > >
> > 
> > So do you agree that we need to ressurect EVIOCGREP (and EVIOCSREP
> > just to complement the interface)?
>  
> 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?

-- 
Dmitry

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

 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 */
 

  reply	other threads:[~2006-04-26  5:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-22 20:48 [PATCH 001/001] INPUT: new ioctl's to retrieve values of EV_REP and EV_SND event codes bjd
2006-04-24 14:31 ` Dmitry Torokhov
2006-04-24 14:57   ` Vojtech Pavlik
2006-04-24 15:03     ` Dmitry Torokhov
2006-04-25 13:19       ` Dmitry Torokhov
2006-04-25 15:16         ` Vojtech Pavlik
2006-04-25 15:23           ` Dmitry Torokhov
2006-04-25 15:26             ` Vojtech Pavlik
2006-04-26  5:06               ` Dmitry Torokhov [this message]
2006-04-26  9:38                 ` Vojtech Pavlik
2006-04-26 10:43                 ` bjdouma
2006-04-26 14:24                   ` Dmitry Torokhov
2006-04-26 19:09                     ` bjdouma
2006-04-28 17:03                       ` Dmitry Torokhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200604260106.38480.dtor_core@ameritech.net \
    --to=dtor_core@ameritech.net \
    --cc=bjdouma@xs4all.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vojtech@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox