Commit 2b271cdb authored by Brad Hards's avatar Brad Hards Committed by Vojtech Pavlik

Change the EVIOC?ABS ioctls to use structs rather than arrays of ints.

parent 75eb18b7
......@@ -233,6 +233,7 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
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 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
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 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
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;
}
......
......@@ -63,6 +63,14 @@ struct input_id {
__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 @@ struct input_id {
#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 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment