diff mbox

uinput: Allow for 0/0 min/max on absolute axes.

Message ID 20110331050503.GA9318@barra.bne.redhat.com (mailing list archive)
State Accepted
Commit a718d79cc0e0c2f0aa82ba2c54383a18f15b7738
Headers show

Commit Message

Peter Hutterer March 31, 2011, 5:05 a.m. UTC
None
diff mbox

Patch

diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c
index b941078..d7cc037 100644
--- a/drivers/input/misc/uinput.c
+++ b/drivers/input/misc/uinput.c
@@ -301,10 +301,14 @@  static int uinput_validate_absbits(struct input_dev *dev)
 	int retval = 0;
 
 	for (cnt = 0; cnt < ABS_CNT; cnt++) {
+		int min, max;
 		if (!test_bit(cnt, dev->absbit))
 			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
 				"%s: invalid abs[%02x] min:%d max:%d\n",
 				UINPUT_NAME, cnt,