aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/input/evdev.c4
-rw-r--r--drivers/input/input.c19
-rw-r--r--drivers/input/misc/uinput.c4
-rw-r--r--include/linux/input.h16
-rw-r--r--include/linux/uinput.h1
5 files changed, 44 insertions, 0 deletions
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index e3f7fc6f9565..0cd97e8f0c9a 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,
677#define EVIOC_MASK_SIZE(nr) ((nr) & ~(_IOC_SIZEMASK << _IOC_SIZESHIFT)) 677#define EVIOC_MASK_SIZE(nr) ((nr) & ~(_IOC_SIZEMASK << _IOC_SIZESHIFT))
678 switch (EVIOC_MASK_SIZE(cmd)) { 678 switch (EVIOC_MASK_SIZE(cmd)) {
679 679
680 case EVIOCGPROP(0):
681 return bits_to_user(dev->propbit, INPUT_PROP_MAX,
682 size, p, compat_mode);
683
680 case EVIOCGKEY(0): 684 case EVIOCGKEY(0):
681 return bits_to_user(dev->key, KEY_MAX, size, p, compat_mode); 685 return bits_to_user(dev->key, KEY_MAX, size, p, compat_mode);
682 686
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 37708d1d86ec..9ea713f4192b 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -1095,6 +1095,8 @@ static int input_devices_seq_show(struct seq_file *seq, void *v)
1095 seq_printf(seq, "%s ", handle->name); 1095 seq_printf(seq, "%s ", handle->name);
1096 seq_putc(seq, '\n'); 1096 seq_putc(seq, '\n');
1097 1097
1098 input_seq_print_bitmap(seq, "PROP", dev->propbit, INPUT_PROP_MAX);
1099
1098 input_seq_print_bitmap(seq, "EV", dev->evbit, EV_MAX); 1100 input_seq_print_bitmap(seq, "EV", dev->evbit, EV_MAX);
1099 if (test_bit(EV_KEY, dev->evbit)) 1101 if (test_bit(EV_KEY, dev->evbit))
1100 input_seq_print_bitmap(seq, "KEY", dev->keybit, KEY_MAX); 1102 input_seq_print_bitmap(seq, "KEY", dev->keybit, KEY_MAX);
@@ -1318,11 +1320,26 @@ static ssize_t input_dev_show_modalias(struct device *dev,
1318} 1320}
1319static DEVICE_ATTR(modalias, S_IRUGO, input_dev_show_modalias, NULL); 1321static DEVICE_ATTR(modalias, S_IRUGO, input_dev_show_modalias, NULL);
1320 1322
1323static int input_print_bitmap(char *buf, int buf_size, unsigned long *bitmap,
1324 int max, int add_cr);
1325
1326static ssize_t input_dev_show_properties(struct device *dev,
1327 struct device_attribute *attr,
1328 char *buf)
1329{
1330 struct input_dev *input_dev = to_input_dev(dev);
1331 int len = input_print_bitmap(buf, PAGE_SIZE, input_dev->propbit,
1332 INPUT_PROP_MAX, true);
1333 return min_t(int, len, PAGE_SIZE);
1334}
1335static DEVICE_ATTR(properties, S_IRUGO, input_dev_show_properties, NULL);
1336
1321static struct attribute *input_dev_attrs[] = { 1337static struct attribute *input_dev_attrs[] = {
1322 &dev_attr_name.attr, 1338 &dev_attr_name.attr,
1323 &dev_attr_phys.attr, 1339 &dev_attr_phys.attr,
1324 &dev_attr_uniq.attr, 1340 &dev_attr_uniq.attr,
1325 &dev_attr_modalias.attr, 1341 &dev_attr_modalias.attr,
1342 &dev_attr_properties.attr,
1326 NULL 1343 NULL
1327}; 1344};
1328 1345
@@ -1522,6 +1539,8 @@ static int input_dev_uevent(struct device *device, struct kobj_uevent_env *env)
1522 if (dev->uniq) 1539 if (dev->uniq)
1523 INPUT_ADD_HOTPLUG_VAR("UNIQ=\"%s\"", dev->uniq); 1540 INPUT_ADD_HOTPLUG_VAR("UNIQ=\"%s\"", dev->uniq);
1524 1541
1542 INPUT_ADD_HOTPLUG_BM_VAR("PROP=", dev->propbit, INPUT_PROP_MAX);
1543
1525 INPUT_ADD_HOTPLUG_BM_VAR("EV=", dev->evbit, EV_MAX); 1544 INPUT_ADD_HOTPLUG_BM_VAR("EV=", dev->evbit, EV_MAX);
1526 if (test_bit(EV_KEY, dev->evbit)) 1545 if (test_bit(EV_KEY, dev->evbit))
1527 INPUT_ADD_HOTPLUG_BM_VAR("KEY=", dev->keybit, KEY_MAX); 1546 INPUT_ADD_HOTPLUG_BM_VAR("KEY=", dev->keybit, KEY_MAX);
diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c
index bea89722c4e9..82542a1c1098 100644
--- a/drivers/input/misc/uinput.c
+++ b/drivers/input/misc/uinput.c
@@ -680,6 +680,10 @@ static long uinput_ioctl_handler(struct file *file, unsigned int cmd,
680 retval = uinput_set_bit(arg, swbit, SW_MAX); 680 retval = uinput_set_bit(arg, swbit, SW_MAX);
681 break; 681 break;
682 682
683 case UI_SET_PROPBIT:
684 retval = uinput_set_bit(arg, propbit, INPUT_PROP_MAX);
685 break;
686
683 case UI_SET_PHYS: 687 case UI_SET_PHYS:
684 if (udev->state == UIST_CREATED) { 688 if (udev->state == UIST_CREATED) {
685 retval = -EINVAL; 689 retval = -EINVAL;
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)