From patchwork Wed Dec 15 19:20:07 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Henrik Rydberg X-Patchwork-Id: 414161 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 oBFJKcPr019079 for ; Wed, 15 Dec 2010 19:20:58 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755014Ab0LOTU5 (ORCPT ); Wed, 15 Dec 2010 14:20:57 -0500 Received: from ch-smtp01.sth.basefarm.net ([80.76.149.212]:51441 "EHLO ch-smtp01.sth.basefarm.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754998Ab0LOTU5 (ORCPT ); Wed, 15 Dec 2010 14:20:57 -0500 Received: from c83-248-200-95.bredband.comhem.se ([83.248.200.95]:45846 helo=polaris) by ch-smtp01.sth.basefarm.net with smtp (Exim 4.72) (envelope-from ) id 1PSwtX-0004As-4g; Wed, 15 Dec 2010 20:20:15 +0100 Received: by polaris (sSMTP sendmail emulation); Wed, 15 Dec 2010 20:20:09 +0100 From: "Henrik Rydberg" To: Dmitry Torokhov Cc: Jiri Kosina , Ping Cheng , Chris Bagwell , Chase Douglas , Peter Hutterer , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Henrik Rydberg Subject: [RFC v2] input: Introduce device information ioctl Date: Wed, 15 Dec 2010 20:20:07 +0100 Message-Id: <1292440807-18502-1-git-send-email-rydberg@euromail.se> X-Mailer: git-send-email 1.7.2.3 X-Originating-IP: 83.248.200.95 X-Scan-Result: No virus found in message 1PSwtX-0004As-4g. X-Scan-Signature: ch-smtp01.sth.basefarm.net 1PSwtX-0004As-4g 4a85cd8c737ef249a26d3916dc126a31 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Wed, 15 Dec 2010 19:21:13 +0000 (UTC) diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index e3f7fc6..0cd97e8 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c @@ -677,6 +677,10 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd, #define EVIOC_MASK_SIZE(nr) ((nr) & ~(_IOC_SIZEMASK << _IOC_SIZESHIFT)) switch (EVIOC_MASK_SIZE(cmd)) { + case EVIOCGPROP(0): + return bits_to_user(dev->propbit, INPUT_PROP_MAX, + size, p, compat_mode); + case EVIOCGKEY(0): return bits_to_user(dev->key, KEY_MAX, size, p, compat_mode); diff --git a/drivers/input/input.c b/drivers/input/input.c index 37708d1..ac751ce 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -1409,6 +1409,7 @@ INPUT_DEV_CAP_ATTR(LED, led); INPUT_DEV_CAP_ATTR(SND, snd); INPUT_DEV_CAP_ATTR(FF, ff); INPUT_DEV_CAP_ATTR(SW, sw); +INPUT_DEV_CAP_ATTR(INPUT_PROP, prop); static struct attribute *input_dev_caps_attrs[] = { &dev_attr_ev.attr, @@ -1420,6 +1421,7 @@ static struct attribute *input_dev_caps_attrs[] = { &dev_attr_snd.attr, &dev_attr_ff.attr, &dev_attr_sw.attr, + &dev_attr_prop.attr, NULL }; diff --git a/include/linux/input.h b/include/linux/input.h index b3a1e02..53d6364 100644 --- a/include/linux/input.h +++ b/include/linux/input.h @@ -91,6 +91,7 @@ struct input_keymap_entry { #define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */ #define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len) /* get physical location */ #define EVIOCGUNIQ(len) _IOC(_IOC_READ, 'E', 0x08, len) /* get unique identifier */ +#define EVIOCGPROP(len) _IOC(_IOC_READ, 'E', 0x09, len) /* get device properties */ #define EVIOCGKEY(len) _IOC(_IOC_READ, 'E', 0x18, len) /* get global key state */ #define EVIOCGLED(len) _IOC(_IOC_READ, 'E', 0x19, len) /* get all LEDs */ @@ -108,6 +109,18 @@ struct input_keymap_entry { #define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */ /* + * Device properties and quirks + */ + +#define INPUT_PROP_POINTER 0x00 /* needs a pointer */ +#define INPUT_PROP_DIRECT 0x01 /* direct object manipulation */ +#define INPUT_PROP_BUTTONPAD 0x02 /* has button(s) under pad */ +#define INPUT_PROP_SEMI_MT 0x03 /* touch rectangle only */ + +#define INPUT_PROP_MAX 0x1f +#define INPUT_PROP_CNT (INPUT_PROP_MAX + 1) + +/* * Event types */ @@ -1090,6 +1103,7 @@ struct ff_effect { * @phys: physical path to the device in the system hierarchy * @uniq: unique identification code for the device (if device has it) * @id: id of the device (struct input_id) + * @propbit: bitmap of device properties and quirks * @evbit: bitmap of types of events supported by the device (EV_KEY, * EV_REL, etc.) * @keybit: bitmap of keys/buttons this device has @@ -1173,6 +1187,8 @@ struct input_dev { const char *uniq; struct input_id id; + unsigned long propbit[BITS_TO_LONGS(INPUT_PROP_CNT)]; + unsigned long evbit[BITS_TO_LONGS(EV_CNT)]; unsigned long keybit[BITS_TO_LONGS(KEY_CNT)]; unsigned long relbit[BITS_TO_LONGS(REL_CNT)];