Commit a718d79c authored by Peter Hutterer's avatar Peter Hutterer Committed by Dmitry Torokhov

Input: uinput - allow for 0/0 min/max on absolute axes.

Some devices provide absolute axes with min/max of 0/0 (e.g. wacom's
ABS_MISC axis). Current uinput restrictions do not allow duplication of
these devices and require hacks in userspace to work around this.

If the kernel accepts physical devices with a min/max of 0/0, uinput
shouldn't disallow the same range.
Signed-off-by: default avatarPeter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent 170531ba
...@@ -302,10 +302,14 @@ static int uinput_validate_absbits(struct input_dev *dev) ...@@ -302,10 +302,14 @@ static int uinput_validate_absbits(struct input_dev *dev)
int retval = 0; int retval = 0;
for (cnt = 0; cnt < ABS_CNT; cnt++) { for (cnt = 0; cnt < ABS_CNT; cnt++) {
int min, max;
if (!test_bit(cnt, dev->absbit)) if (!test_bit(cnt, dev->absbit))
continue; continue;
if (input_abs_get_max(dev, cnt) <= input_abs_get_min(dev, cnt)) { min = input_abs_get_min(dev, cnt);
max = input_abs_get_max(dev, cnt);
if ((min != 0 || max != 0) && max <= min) {
printk(KERN_DEBUG printk(KERN_DEBUG
"%s: invalid abs[%02x] min:%d max:%d\n", "%s: invalid abs[%02x] min:%d max:%d\n",
UINPUT_NAME, cnt, UINPUT_NAME, cnt,
......
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