aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2010-12-18 14:51:13 -0500
committerHenrik Rydberg <rydberg@euromail.se>2010-12-20 03:37:33 -0500
commit85b7720039fc000b561c20fe2aaa3b54cddae4a7 (patch)
tree8fee2c82e215b87699ad6615239752af50ac9310 /include/linux
parent4dd295a73e80b55c3fec25555bf0a5d253023740 (diff)
Input: introduce device properties
Today, userspace sets up an input device based on the data it emits. This is not always enough; a tablet and a touchscreen may emit exactly the same data, for instance, but the former should be set up with a pointer whereas the latter does not need to. Recently, a new type of touchpad has emerged where the buttons are under the pad, which changes logic without changing the emitted data. This patch introduces a new ioctl, EVIOCGPROP, which enables user access to a set of device properties useful during setup. The properties are given as a bitmap in the same fashion as the event types, and are also made available via sysfs, uevent and /proc/bus/input/devices. Acked-by: Ping Cheng <pingc@wacom.com> Acked-by: Chase Douglas <chase.douglas@canonical.com> Acked-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/input.h16
-rw-r--r--include/linux/uinput.h1
2 files changed, 17 insertions, 0 deletions
diff --git a/include/linux/input.h b/include/linux/input.h
index b3a1e02080c0..8d9c76cd3c43 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -91,6 +91,7 @@ struct input_keymap_entry {
91#define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */ 91#define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */
92#define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len) /* get physical location */ 92#define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len) /* get physical location */
93#define EVIOCGUNIQ(len) _IOC(_IOC_READ, 'E', 0x08, len) /* get unique identifier */ 93#define EVIOCGUNIQ(len) _IOC(_IOC_READ, 'E', 0x08, len) /* get unique identifier */
94#define EVIOCGPROP(len) _IOC(_IOC_READ, 'E', 0x09, len) /* get device properties */
94 95
95#define EVIOCGKEY(len) _IOC(_IOC_READ, 'E', 0x18, len) /* get global key state */ 96#define EVIOCGKEY(len) _IOC(_IOC_READ, 'E', 0x18, len) /* get global key state */
96#define EVIOCGLED(len) _IOC(_IOC_READ, 'E', 0x19, len) /* get all LEDs */ 97#define EVIOCGLED(len) _IOC(_IOC_READ, 'E', 0x19, len) /* get all LEDs */
@@ -108,6 +109,18 @@ struct input_keymap_entry {
108#define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */ 109#define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */
109 110
110/* 111/*
112 * Device properties and quirks
113 */
114
115#define INPUT_PROP_POINTER 0x00 /* needs a pointer */
116#define INPUT_PROP_DIRECT 0x01 /* direct input devices */
117#define INPUT_PROP_BUTTONPAD 0x02 /* has button(s) under pad */
118#define INPUT_PROP_SEMI_MT 0x03 /* touch rectangle only */
119
120#define INPUT_PROP_MAX 0x1f
121#define INPUT_PROP_CNT (INPUT_PROP_MAX + 1)
122
123/*
111 * Event types 124 * Event types
112 */ 125 */
113 126
@@ -1090,6 +1103,7 @@ struct ff_effect {
1090 * @phys: physical path to the device in the system hierarchy 1103 * @phys: physical path to the device in the system hierarchy
1091 * @uniq: unique identification code for the device (if device has it) 1104 * @uniq: unique identification code for the device (if device has it)
1092 * @id: id of the device (struct input_id) 1105 * @id: id of the device (struct input_id)
1106 * @propbit: bitmap of device properties and quirks
1093 * @evbit: bitmap of types of events supported by the device (EV_KEY, 1107 * @evbit: bitmap of types of events supported by the device (EV_KEY,
1094 * EV_REL, etc.) 1108 * EV_REL, etc.)
1095 * @keybit: bitmap of keys/buttons this device has 1109 * @keybit: bitmap of keys/buttons this device has
@@ -1173,6 +1187,8 @@ struct input_dev {
1173 const char *uniq; 1187 const char *uniq;
1174 struct input_id id; 1188 struct input_id id;
1175 1189
1190 unsigned long propbit[BITS_TO_LONGS(INPUT_PROP_CNT)];
1191
1176 unsigned long evbit[BITS_TO_LONGS(EV_CNT)]; 1192 unsigned long evbit[BITS_TO_LONGS(EV_CNT)];
1177 unsigned long keybit[BITS_TO_LONGS(KEY_CNT)]; 1193 unsigned long keybit[BITS_TO_LONGS(KEY_CNT)];
1178 unsigned long relbit[BITS_TO_LONGS(REL_CNT)]; 1194 unsigned long relbit[BITS_TO_LONGS(REL_CNT)];
diff --git a/include/linux/uinput.h b/include/linux/uinput.h
index 05f7fed2b173..d28c726ede4f 100644
--- a/include/linux/uinput.h
+++ b/include/linux/uinput.h
@@ -104,6 +104,7 @@ struct uinput_ff_erase {
104#define UI_SET_FFBIT _IOW(UINPUT_IOCTL_BASE, 107, int) 104#define UI_SET_FFBIT _IOW(UINPUT_IOCTL_BASE, 107, int)
105#define UI_SET_PHYS _IOW(UINPUT_IOCTL_BASE, 108, char*) 105#define UI_SET_PHYS _IOW(UINPUT_IOCTL_BASE, 108, char*)
106#define UI_SET_SWBIT _IOW(UINPUT_IOCTL_BASE, 109, int) 106#define UI_SET_SWBIT _IOW(UINPUT_IOCTL_BASE, 109, int)
107#define UI_SET_PROPBIT _IOW(UINPUT_IOCTL_BASE, 110, int)
107 108
108#define UI_BEGIN_FF_UPLOAD _IOWR(UINPUT_IOCTL_BASE, 200, struct uinput_ff_upload) 109#define UI_BEGIN_FF_UPLOAD _IOWR(UINPUT_IOCTL_BASE, 200, struct uinput_ff_upload)
109#define UI_END_FF_UPLOAD _IOW(UINPUT_IOCTL_BASE, 201, struct uinput_ff_upload) 110#define UI_END_FF_UPLOAD _IOW(UINPUT_IOCTL_BASE, 201, struct uinput_ff_upload)