Skip to contentSkip to conversation

Allow EV_ABS to work in uinput.c

UINPUT Ian Campbell 3 participants 3 messages May 25, 2005 – May 31, 2005 Input drivers

lore
Share & tools
lore
#0 lore raw

Hi,

uinput_alloc_device() is supposed to return the number of bytes read, the value is returned to uinput_write() and from there to userspace. If EV_ABS is set then it returns the value from uinput_validate_absbits() instead, which is zero when everything is ok instead of the count.

%patch

drivers/input/misc/uinput.c +4 -2
Index: 2.6/drivers/input/misc/uinput.c
===================================================================
@@ -216,9 +216,11 @@
 	/* check if absmin/absmax/absfuzz/absflat are filled as
 	 * told in Documentation/input/input-programming.txt */
 	if (test_bit(EV_ABS, dev->evbit)) {
-		retval = uinput_validate_absbits(dev);
-		if (retval < 0)
+		int err = uinput_validate_absbits(dev);
+		if (err < 0) {
+			retval = err;
 			kfree(dev->name);
+		}
 	}
 
 exit:
Signature · 4 lines
Ian Campbell, Senior Design Engineer
                                        Web: http://www.arcom.com
Arcom, Clifton Road,                    Direct: +44 (0)1223 403 465
Cambridge CB1 7EA, United Kingdom       Phone:  +44 (0)1223 411 200
#1 lore raw
Quoted 6 lines

uinput_alloc_device() is supposed to return the number of bytes read, the value is returned to uinput_write() and from there to userspace. If EV_ABS is set then it returns the value from uinput_validate_absbits() instead, which is zero when everything is ok instead of the count.

Quoted 16 lines
drivers/input/misc/uinput.c +4 -2
@@ -216,9 +216,11 @@
 	/* check if absmin/absmax/absfuzz/absflat are filled as
 	 * told in Documentation/input/input-programming.txt */
 	if (test_bit(EV_ABS, dev->evbit)) {
-		retval = uinput_validate_absbits(dev);
-		if (retval < 0)
+		int err = uinput_validate_absbits(dev);
+		if (err < 0) {
+			retval = err;
 			kfree(dev->name);
+		}
 	}
 
 exit:
Signature · 1 line
Aristeu
#2 lore raw
Quoted 7 lines · Aristeu Sergio Rozanski Filho
Quoted 6 lines

uinput_alloc_device() is supposed to return the number of bytes read, the value is returned to uinput_write() and from there to userspace. If EV_ABS is set then it returns the value from uinput_validate_absbits() instead, which is zero when everything is ok instead of the count.

Thanks; added to my tree.

Quoted 21 lines
Quoted 16 lines
drivers/input/misc/uinput.c +4 -2
@@ -216,9 +216,11 @@
 	/* check if absmin/absmax/absfuzz/absflat are filled as
 	 * told in Documentation/input/input-programming.txt */
 	if (test_bit(EV_ABS, dev->evbit)) {
-		retval = uinput_validate_absbits(dev);
-		if (retval < 0)
+		int err = uinput_validate_absbits(dev);
+		if (err < 0) {
+			retval = err;
 			kfree(dev->name);
+		}
 	}
 
 exit:
Signature · 1 line
Aristeu
Signature · 2 lines
Vojtech Pavlik
SuSE Labs, SuSE CR