[patch] Input cleanups for 2.5.29 [1/2]

Vojtech Pavlik
2002-07-30T13:19:40Z

On Tue, Jul 30, 2002 at 12:29:18PM +0200, Vojtech Pavlik wrote:

You can import this changeset into BK by piping this whole message to:
'| bk receive [path to repository]' or apply the patch as usual.
'bk pull bk://linux-input.bkbits.net/linux-input' should work as well.

===================================================================

ChangeSet@1.528, 2002-07-30 15:02:05+02:00, bhards@bigpond.net.au
Change the EVIOC?ABS ioctls to use structs rather than arrays of ints.

===================================================================

drivers/input/evdev.c | 27 +++++++++++++++++----------
include/linux/input.h | 12 ++++++++++--
2 files changed, 27 insertions(+), 12 deletions(-)

===================================================================

diff -Nru a/drivers/input/evdev.c b/drivers/input/evdev.c
--- a/drivers/input/evdev.c Tue Jul 30 15:21:38 2002
+++ b/drivers/input/evdev.c Tue Jul 30 15:21:38 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,11 +379,14 @@

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.value = dev->abs[t];
+ abs.minimum = dev->absmin[t];
+ abs.maximum = dev->absmax[t];
+ abs.fuzz = dev->absfuzz[t];
+ abs.flat = dev->absflat[t];
+
+ if (copy_to_user((void *) arg, &abs, sizeof(struct input_absinfo)))
+ return -EFAULT;

return 0;
}
@@ -391,11 +395,14 @@

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;
+ if (copy_from_user(&abs, (void *) arg, sizeof(struct input_absinfo)))
+ return -EFAULT;
+
+ dev->abs[t] = abs.value;
+ dev->absmin[t] = abs.minimum;
+ dev->absmax[t] = abs.maximum;
+ dev->absfuzz[t] = abs.fuzz;
+ dev->absflat[t] = abs.flat;

return 0;
}
diff -Nru a/include/linux/input.h b/include/linux/input.h
--- a/include/linux/input.h Tue Jul 30 15:21:38 2002
+++ b/include/linux/input.h Tue Jul 30 15:21:38 2002
@@ -63,6 +63,14 @@
__u16 version;
};

+struct input_absinfo {
+ int 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 */

===================================================================

This BitKeeper patch contains the following changesets:
1.528
## Wrapped with gzip_uu ##

begin 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