Commit db288fe4 authored by Glenn Burkhardt's avatar Glenn Burkhardt Committed by Vojtech Pavlik

input: Properly recompute initial values upon recalibration in joydev.

parent 963be119
......@@ -290,7 +290,7 @@ static int joydev_ioctl(struct inode *inode, struct file *file, unsigned int cmd
struct joydev_list *list = file->private_data;
struct joydev *joydev = list->joydev;
struct input_dev *dev = joydev->handle.dev;
int i;
int i, j;
if (!joydev->exist) return -ENODEV;
......@@ -324,8 +324,14 @@ static int joydev_ioctl(struct inode *inode, struct file *file, unsigned int cmd
case JSIOCGBUTTONS:
return put_user(joydev->nkey, (__u8 *) arg);
case JSIOCSCORR:
return copy_from_user(joydev->corr, (struct js_corr *) arg,
sizeof(struct js_corr) * joydev->nabs) ? -EFAULT : 0;
if (copy_from_user(joydev->corr, (struct js_corr *)arg,
sizeof(struct js_corr) * joydev->nabs))
return -EFAULT;
for (i = 0; i < joydev->nabs; i++) {
j = joydev->abspam[i];
joydev->abs[i] = joydev_correct(dev->abs[j], joydev->corr + i);
}
return 0;
case JSIOCGCORR:
return copy_to_user((struct js_corr *) arg, joydev->corr,
sizeof(struct js_corr) * joydev->nabs) ? -EFAULT : 0;
......@@ -426,6 +432,7 @@ static struct input_handle *joydev_connect(struct input_handler *handler, struct
j = joydev->abspam[i];
if (dev->absmax[j] == dev->absmin[j]) {
joydev->corr[i].type = JS_CORR_NONE;
joydev->abs[i] = dev->abs[j];
continue;
}
joydev->corr[i].type = JS_CORR_BROKEN;
......
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