@@ -20,6 +20,8 @@
* Author: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org>
*
* Changes/Revisions:
+ * 0.4 12/07/2013 (Peter Hutterer <peter.hutterer@redhat.com>)
+ * - update uinput_user_dev struct to allow abs resolution
* 0.3 09/04/2006 (Anssi Hannula <anssi.hannula@gmail.com>)
* - updated ff support for the changes in kernel interface
* - added MODULE_VERSION
@@ -364,9 +366,9 @@ static int uinput_setup_device(struct uinput_device *udev,
struct input_dev *dev;
int i;
int retval;
+ size_t size;
- if (count != sizeof(struct uinput_user_dev))
- return -EINVAL;
+ size = min_t(size_t, count, sizeof(struct uinput_user_dev));
if (!udev->dev) {
retval = uinput_allocate_device(udev);
@@ -376,9 +378,13 @@ static int uinput_setup_device(struct uinput_device *udev,
dev = udev->dev;
- user_dev = memdup_user(buffer, sizeof(struct uinput_user_dev));
- if (IS_ERR(user_dev))
- return PTR_ERR(user_dev);
+ user_dev = kzalloc(sizeof(struct uinput_user_dev), GFP_KERNEL);
+ if (!user_dev)
+ return -ENOMEM;
+ if (copy_from_user(user_dev, buffer, size)) {
+ retval = -EFAULT;
+ goto exit;
+ }
udev->ff_effects_max = user_dev->ff_effects_max;
@@ -406,6 +412,7 @@ static int uinput_setup_device(struct uinput_device *udev,
input_abs_set_min(dev, i, user_dev->absmin[i]);
input_abs_set_fuzz(dev, i, user_dev->absfuzz[i]);
input_abs_set_flat(dev, i, user_dev->absflat[i]);
+ input_abs_set_res(dev, i, user_dev->absres[i]);
}
/* check if absmin/absmax/absfuzz/absflat are filled as
@@ -20,6 +20,8 @@
* Author: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org>
*
* Changes/Revisions:
+ * 0.4 12/07/2013 (Peter Hutterer <peter.hutterer@redhat.com>)
+ * - update uinput_user_dev struct to allow abs resolution
* 0.3 24/05/2006 (Anssi Hannula <anssi.hannulagmail.com>)
* - update ff support for the changes in kernel interface
* - add UINPUT_VERSION
@@ -20,6 +20,8 @@
* Author: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org>
*
* Changes/Revisions:
+ * 0.4 12/07/2013 (Peter Hutterer <peter.hutterer@redhat.com>)
+ * - update uinput_user_dev struct to allow abs resolution
* 0.3 24/05/2006 (Anssi Hannula <anssi.hannulagmail.com>)
* - update ff support for the changes in kernel interface
* - add UINPUT_VERSION
@@ -133,5 +135,6 @@ struct uinput_user_dev {
__s32 absmin[ABS_CNT];
__s32 absfuzz[ABS_CNT];
__s32 absflat[ABS_CNT];
+ __s32 absres[ABS_CNT];
};
#endif /* _UAPI__UINPUT_H_ */