From: Brad Hards <bhards@bigpond.net.au>
To: Vojtech Pavlik <vojtech@suse.cz>
Cc: linux-kernel@vger.kernel.org, linuxconsole-dev@lists.sourceforge.net
Subject: Re: [cset] Add the EVIOCSABS ioctl for X people.
Date: Sun, 28 Jul 2002 17:32:53 +1000 [thread overview]
Message-ID: <200207281732.53842.bhards@bigpond.net.au> (raw)
In-Reply-To: <20020725170850.A24176@ucw.cz>
[-- Attachment #1: Type: text/plain, Size: 1088 bytes --]
On Fri, 26 Jul 2002 01:08, Vojtech Pavlik wrote:
> On Fri, Jul 26, 2002 at 12:47:20AM +1000, Brad Hards wrote:
> No problem. Send me a patch that does it for both the EVIOSGABS and
> EVIOCSABS and I'll take it. You can either just do it in evdev.c, or
> change every driver to use the struct.
I am just doing the evdev.c (ie the ABI) at this stage. I may look at the
internal representation later.
Patch against 2.5.29. Looks OK?
> > I could live with curr, min and max instead of *_value, but it
> > would be nicer if it was a bit more descriptive.
>
> You can make it current, minimum, and maximum, if you wish. I'm a
> minimalist when it comes to naming, and I don't really think "_value" is
> bringing much information here. All of them are values after all.
"current" is a bad idea. I used curr_value.
Also, it is nice if you can retain the attributions (so I can get some
ego satisfaction, and so people know who to blame). This is generally
done by maintainers - any chance you can do this too?
Brad
--
http://conf.linux.org.au. 22-25Jan2003. Perth, Australia. Birds in Black.
[-- Attachment #2: absinfo-2.5.29.patch --]
[-- Type: text/x-diff, Size: 3119 bytes --]
diff -Naur -X dontdiff -x Config.in linux-2.5.29/drivers/input/evdev.c linux-2.5.29-eventabs/drivers/input/evdev.c
--- linux-2.5.29/drivers/input/evdev.c Sat Jul 27 12:58:41 2002
+++ linux-2.5.29-eventabs/drivers/input/evdev.c Sun Jul 28 17:29:00 2002
@@ -233,6 +233,7 @@
struct evdev_list *list = file->private_data;
struct evdev *evdev = list->evdev;
struct input_dev *dev = evdev->handle.dev;
+ struct input_absinfo abs;
int t, u;
if (!evdev->exist) return -ENODEV;
@@ -378,26 +379,19 @@
int t = _IOC_NR(cmd) & ABS_MAX;
- if (put_user(dev->abs[t], ((int *) arg) + 0)) return -EFAULT;
- if (put_user(dev->absmin[t], ((int *) arg) + 1)) return -EFAULT;
- if (put_user(dev->absmax[t], ((int *) arg) + 2)) return -EFAULT;
- if (put_user(dev->absfuzz[t], ((int *) arg) + 3)) return -EFAULT;
- if (put_user(dev->absflat[t], ((int *) arg) + 4)) return -EFAULT;
+ abs.curr_value = dev->abs[t];
+ abs.minimum = dev->absmin[t];
+ abs.maximum = dev->absmax[t];
+ abs.fuzz = dev->absfuzz[t];
+ abs.flat = dev->absflat[t];
+ return copy_to_user((void *) arg, &abs, sizeof(struct input_absinfo));
- return 0;
}
if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCSABS(0))) {
- int t = _IOC_NR(cmd) & ABS_MAX;
-
- if (get_user(dev->abs[t], ((int *) arg) + 0)) return -EFAULT;
- if (get_user(dev->absmin[t], ((int *) arg) + 1)) return -EFAULT;
- if (get_user(dev->absmax[t], ((int *) arg) + 2)) return -EFAULT;
- if (get_user(dev->absfuzz[t], ((int *) arg) + 3)) return -EFAULT;
- if (get_user(dev->absflat[t], ((int *) arg) + 4)) return -EFAULT;
-
- return 0;
+ return copy_from_user(&abs, (void *) arg, sizeof(struct input_absinfo));
+
}
}
return -EINVAL;
diff -Naur -X dontdiff -x Config.in linux-2.5.29/include/linux/input.h linux-2.5.29-eventabs/include/linux/input.h
--- linux-2.5.29/include/linux/input.h Sat Jul 27 12:58:37 2002
+++ linux-2.5.29-eventabs/include/linux/input.h Sun Jul 28 17:25:40 2002
@@ -63,6 +63,14 @@
__u16 version;
};
+struct input_absinfo {
+ int curr_value;
+ int minimum;
+ int maximum;
+ int fuzz;
+ int flat;
+};
+
#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 */
@@ -79,8 +87,8 @@
#define EVIOCGSND(len) _IOC(_IOC_READ, 'E', 0x1a, len) /* get all sounds status */
#define EVIOCGBIT(ev,len) _IOC(_IOC_READ, 'E', 0x20 + ev, len) /* get event bits */
-#define EVIOCGABS(abs) _IOR('E', 0x40 + abs, int[5]) /* get abs value/limits */
-#define EVIOCSABS(abs) _IOW('E', 0xc0 + abs, int[5]) /* set abs value/limits */
+#define EVIOCGABS(abs) _IOR('E', 0x40 + abs, struct input_absinfo) /* get abs value/limits */
+#define EVIOCSABS(abs) _IOW('E', 0xc0 + abs, struct input_absinfo) /* set abs value/limits */
#define EVIOCSFF _IOC(_IOC_WRITE, 'E', 0x80, sizeof(struct ff_effect)) /* send a force effect to a force feedback device */
#define EVIOCRMFF _IOW('E', 0x81, int) /* Erase a force effect */
next prev parent reply other threads:[~2002-07-28 7:35 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20020725083716.A20717@ucw.cz>
2002-07-25 12:00 ` [cset] Add a input_sync() a method to tell which events belong together Vojtech Pavlik
2002-07-25 12:03 ` Vojtech Pavlik
2002-07-25 12:25 ` [cset] Move ps2serkbd.c functionality into atkbd.c, kill ps2serkbd.c Vojtech Pavlik
2002-07-25 14:11 ` [cset] Fix mouse wheel direction in psmouse.c Vojtech Pavlik
2002-07-25 14:38 ` [cset] Add the EVIOCSABS ioctl for X people Vojtech Pavlik
2002-07-25 14:47 ` Brad Hards
2002-07-25 15:08 ` Vojtech Pavlik
2002-07-28 7:32 ` Brad Hards [this message]
2002-07-28 8:08 ` Vojtech Pavlik
2002-07-28 8:29 ` Brad Hards
2002-07-28 8:39 ` Vojtech Pavlik
2002-07-28 8:51 ` Russell King
2002-07-28 9:12 ` Brad Hards
2002-07-25 15:12 ` Larry McVoy
2002-07-25 15:23 ` Vojtech Pavlik
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=200207281732.53842.bhards@bigpond.net.au \
--to=bhards@bigpond.net.au \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxconsole-dev@lists.sourceforge.net \
--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
all inboxes | Powered by JetHome®