From patchwork Thu Mar 31 05:05:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hutterer X-Patchwork-Id: 678471 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2V55Gl0029379 for ; Thu, 31 Mar 2011 05:05:16 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752013Ab1CaFFP (ORCPT ); Thu, 31 Mar 2011 01:05:15 -0400 Received: from leo.clearchain.com ([199.73.29.74]:23712 "EHLO mail.clearchain.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752723Ab1CaFFN (ORCPT ); Thu, 31 Mar 2011 01:05:13 -0400 Received: from leo.clearchain.com (localhost [127.0.0.1]) by mail.clearchain.com (8.14.4/8.14.4) with ESMTP id p2V559hs075525 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 31 Mar 2011 15:35:09 +1030 (CST) (envelope-from peter.hutterer@who-t.net) Received: (from whot@localhost) by leo.clearchain.com (8.14.4/8.14.4/Submit) id p2V558bb075524; Thu, 31 Mar 2011 15:35:08 +1030 (CST) (envelope-from peter.hutterer@who-t.net) X-Authentication-Warning: leo.clearchain.com: whot set sender to peter.hutterer@who-t.net using -f Date: Thu, 31 Mar 2011 15:05:03 +1000 From: Peter Hutterer To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] uinput: Allow for 0/0 min/max on absolute axes. Message-ID: <20110331050503.GA9318@barra.bne.redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 31 Mar 2011 05:05:16 +0000 (UTC) X-Greylist: Sender is SPF-compliant, not delayed by milter-greylist-4.0.1 (mail.clearchain.com [127.0.0.1]); Thu, 31 Mar 2011 15:35:09 +1030 (CST) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org 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,