aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/input.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/input.h')
-rw-r--r--include/linux/input.h75
1 files changed, 54 insertions, 21 deletions
diff --git a/include/linux/input.h b/include/linux/input.h
index 51af441f3a21..c4e9d91ec979 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -47,6 +47,25 @@ struct input_id {
47 __u16 version; 47 __u16 version;
48}; 48};
49 49
50/**
51 * struct input_absinfo - used by EVIOCGABS/EVIOCSABS ioctls
52 * @value: latest reported value for the axis.
53 * @minimum: specifies minimum value for the axis.
54 * @maximum: specifies maximum value for the axis.
55 * @fuzz: specifies fuzz value that is used to filter noise from
56 * the event stream.
57 * @flat: values that are within this value will be discarded by
58 * joydev interface and reported as 0 instead.
59 * @resolution: specifies resolution for the values reported for
60 * the axis.
61 *
62 * Note that input core does not clamp reported values to the
63 * [minimum, maximum] limits, such task is left to userspace.
64 *
65 * Resolution for main axes (ABS_X, ABS_Y, ABS_Z) is reported in
66 * units per millimeter (units/mm), resolution for rotational axes
67 * (ABS_RX, ABS_RY, ABS_RZ) is reported in units per radian.
68 */
50struct input_absinfo { 69struct input_absinfo {
51 __s32 value; 70 __s32 value;
52 __s32 minimum; 71 __s32 minimum;
@@ -85,12 +104,15 @@ struct input_keymap_entry {
85#define EVIOCGREP _IOR('E', 0x03, unsigned int[2]) /* get repeat settings */ 104#define EVIOCGREP _IOR('E', 0x03, unsigned int[2]) /* get repeat settings */
86#define EVIOCSREP _IOW('E', 0x03, unsigned int[2]) /* set repeat settings */ 105#define EVIOCSREP _IOW('E', 0x03, unsigned int[2]) /* set repeat settings */
87 106
88#define EVIOCGKEYCODE _IOR('E', 0x04, struct input_keymap_entry) /* get keycode */ 107#define EVIOCGKEYCODE _IOR('E', 0x04, unsigned int[2]) /* get keycode */
89#define EVIOCSKEYCODE _IOW('E', 0x04, struct input_keymap_entry) /* set keycode */ 108#define EVIOCGKEYCODE_V2 _IOR('E', 0x04, struct input_keymap_entry)
109#define EVIOCSKEYCODE _IOW('E', 0x04, unsigned int[2]) /* set keycode */
110#define EVIOCSKEYCODE_V2 _IOW('E', 0x04, struct input_keymap_entry)
90 111
91#define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */ 112#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 */ 113#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 */ 114#define EVIOCGUNIQ(len) _IOC(_IOC_READ, 'E', 0x08, len) /* get unique identifier */
115#define EVIOCGPROP(len) _IOC(_IOC_READ, 'E', 0x09, len) /* get device properties */
94 116
95#define EVIOCGKEY(len) _IOC(_IOC_READ, 'E', 0x18, len) /* get global key state */ 117#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 */ 118#define EVIOCGLED(len) _IOC(_IOC_READ, 'E', 0x19, len) /* get all LEDs */
@@ -108,6 +130,18 @@ struct input_keymap_entry {
108#define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */ 130#define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */
109 131
110/* 132/*
133 * Device properties and quirks
134 */
135
136#define INPUT_PROP_POINTER 0x00 /* needs a pointer */
137#define INPUT_PROP_DIRECT 0x01 /* direct input devices */
138#define INPUT_PROP_BUTTONPAD 0x02 /* has button(s) under pad */
139#define INPUT_PROP_SEMI_MT 0x03 /* touch rectangle only */
140
141#define INPUT_PROP_MAX 0x1f
142#define INPUT_PROP_CNT (INPUT_PROP_MAX + 1)
143
144/*
111 * Event types 145 * Event types
112 */ 146 */
113 147
@@ -569,6 +603,8 @@ struct input_keymap_entry {
569#define KEY_FRAMEFORWARD 0x1b5 603#define KEY_FRAMEFORWARD 0x1b5
570#define KEY_CONTEXT_MENU 0x1b6 /* GenDesc - system context menu */ 604#define KEY_CONTEXT_MENU 0x1b6 /* GenDesc - system context menu */
571#define KEY_MEDIA_REPEAT 0x1b7 /* Consumer - transport control */ 605#define KEY_MEDIA_REPEAT 0x1b7 /* Consumer - transport control */
606#define KEY_10CHANNELSUP 0x1b8 /* 10 channels up (10+) */
607#define KEY_10CHANNELSDOWN 0x1b9 /* 10 channels down (10-) */
572 608
573#define KEY_DEL_EOL 0x1c0 609#define KEY_DEL_EOL 0x1c0
574#define KEY_DEL_EOS 0x1c1 610#define KEY_DEL_EOS 0x1c1
@@ -624,6 +660,10 @@ struct input_keymap_entry {
624#define KEY_CAMERA_FOCUS 0x210 660#define KEY_CAMERA_FOCUS 0x210
625#define KEY_WPS_BUTTON 0x211 /* WiFi Protected Setup key */ 661#define KEY_WPS_BUTTON 0x211 /* WiFi Protected Setup key */
626 662
663#define KEY_TOUCHPAD_TOGGLE 0x212 /* Request switch touchpad on or off */
664#define KEY_TOUCHPAD_ON 0x213
665#define KEY_TOUCHPAD_OFF 0x214
666
627#define BTN_TRIGGER_HAPPY 0x2c0 667#define BTN_TRIGGER_HAPPY 0x2c0
628#define BTN_TRIGGER_HAPPY1 0x2c0 668#define BTN_TRIGGER_HAPPY1 0x2c0
629#define BTN_TRIGGER_HAPPY2 0x2c1 669#define BTN_TRIGGER_HAPPY2 0x2c1
@@ -733,11 +773,12 @@ struct input_keymap_entry {
733#define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */ 773#define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */
734#define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */ 774#define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */
735#define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */ 775#define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */
776#define ABS_MT_DISTANCE 0x3b /* Contact hover distance */
736 777
737#ifdef __KERNEL__ 778#ifdef __KERNEL__
738/* Implementation details, userspace should not care about these */ 779/* Implementation details, userspace should not care about these */
739#define ABS_MT_FIRST ABS_MT_TOUCH_MAJOR 780#define ABS_MT_FIRST ABS_MT_TOUCH_MAJOR
740#define ABS_MT_LAST ABS_MT_PRESSURE 781#define ABS_MT_LAST ABS_MT_DISTANCE
741#endif 782#endif
742 783
743#define ABS_MAX 0x3f 784#define ABS_MAX 0x3f
@@ -848,6 +889,7 @@ struct input_keymap_entry {
848 */ 889 */
849#define MT_TOOL_FINGER 0 890#define MT_TOOL_FINGER 0
850#define MT_TOOL_PEN 1 891#define MT_TOOL_PEN 1
892#define MT_TOOL_MAX 1
851 893
852/* 894/*
853 * Values describing the status of a force-feedback effect 895 * Values describing the status of a force-feedback effect
@@ -1083,19 +1125,12 @@ struct ff_effect {
1083#include <linux/mod_devicetable.h> 1125#include <linux/mod_devicetable.h>
1084 1126
1085/** 1127/**
1086 * struct input_mt_slot - represents the state of an input MT slot
1087 * @abs: holds current values of ABS_MT axes for this slot
1088 */
1089struct input_mt_slot {
1090 int abs[ABS_MT_LAST - ABS_MT_FIRST + 1];
1091};
1092
1093/**
1094 * struct input_dev - represents an input device 1128 * struct input_dev - represents an input device
1095 * @name: name of the device 1129 * @name: name of the device
1096 * @phys: physical path to the device in the system hierarchy 1130 * @phys: physical path to the device in the system hierarchy
1097 * @uniq: unique identification code for the device (if device has it) 1131 * @uniq: unique identification code for the device (if device has it)
1098 * @id: id of the device (struct input_id) 1132 * @id: id of the device (struct input_id)
1133 * @propbit: bitmap of device properties and quirks
1099 * @evbit: bitmap of types of events supported by the device (EV_KEY, 1134 * @evbit: bitmap of types of events supported by the device (EV_KEY,
1100 * EV_REL, etc.) 1135 * EV_REL, etc.)
1101 * @keybit: bitmap of keys/buttons this device has 1136 * @keybit: bitmap of keys/buttons this device has
@@ -1130,7 +1165,8 @@ struct input_mt_slot {
1130 * of tracked contacts 1165 * of tracked contacts
1131 * @mtsize: number of MT slots the device uses 1166 * @mtsize: number of MT slots the device uses
1132 * @slot: MT slot currently being transmitted 1167 * @slot: MT slot currently being transmitted
1133 * @absinfo: array of &struct absinfo elements holding information 1168 * @trkid: stores MT tracking ID for the current contact
1169 * @absinfo: array of &struct input_absinfo elements holding information
1134 * about absolute axes (current value, min, max, flat, fuzz, 1170 * about absolute axes (current value, min, max, flat, fuzz,
1135 * resolution) 1171 * resolution)
1136 * @key: reflects current state of device's keys/buttons 1172 * @key: reflects current state of device's keys/buttons
@@ -1178,6 +1214,8 @@ struct input_dev {
1178 const char *uniq; 1214 const char *uniq;
1179 struct input_id id; 1215 struct input_id id;
1180 1216
1217 unsigned long propbit[BITS_TO_LONGS(INPUT_PROP_CNT)];
1218
1181 unsigned long evbit[BITS_TO_LONGS(EV_CNT)]; 1219 unsigned long evbit[BITS_TO_LONGS(EV_CNT)];
1182 unsigned long keybit[BITS_TO_LONGS(KEY_CNT)]; 1220 unsigned long keybit[BITS_TO_LONGS(KEY_CNT)];
1183 unsigned long relbit[BITS_TO_LONGS(REL_CNT)]; 1221 unsigned long relbit[BITS_TO_LONGS(REL_CNT)];
@@ -1214,6 +1252,7 @@ struct input_dev {
1214 struct input_mt_slot *mt; 1252 struct input_mt_slot *mt;
1215 int mtsize; 1253 int mtsize;
1216 int slot; 1254 int slot;
1255 int trkid;
1217 1256
1218 struct input_absinfo *absinfo; 1257 struct input_absinfo *absinfo;
1219 1258
@@ -1406,6 +1445,8 @@ static inline void input_set_drvdata(struct input_dev *dev, void *data)
1406int __must_check input_register_device(struct input_dev *); 1445int __must_check input_register_device(struct input_dev *);
1407void input_unregister_device(struct input_dev *); 1446void input_unregister_device(struct input_dev *);
1408 1447
1448void input_reset_device(struct input_dev *);
1449
1409int __must_check input_register_handler(struct input_handler *); 1450int __must_check input_register_handler(struct input_handler *);
1410void input_unregister_handler(struct input_handler *); 1451void input_unregister_handler(struct input_handler *);
1411 1452
@@ -1421,7 +1462,7 @@ void input_release_device(struct input_handle *);
1421int input_open_device(struct input_handle *); 1462int input_open_device(struct input_handle *);
1422void input_close_device(struct input_handle *); 1463void input_close_device(struct input_handle *);
1423 1464
1424int input_flush_device(struct input_handle* handle, struct file* file); 1465int input_flush_device(struct input_handle *handle, struct file *file);
1425 1466
1426void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value); 1467void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value);
1427void input_inject_event(struct input_handle *handle, unsigned int type, unsigned int code, int value); 1468void input_inject_event(struct input_handle *handle, unsigned int type, unsigned int code, int value);
@@ -1461,11 +1502,6 @@ static inline void input_mt_sync(struct input_dev *dev)
1461 input_event(dev, EV_SYN, SYN_MT_REPORT, 0); 1502 input_event(dev, EV_SYN, SYN_MT_REPORT, 0);
1462} 1503}
1463 1504
1464static inline void input_mt_slot(struct input_dev *dev, int slot)
1465{
1466 input_event(dev, EV_ABS, ABS_MT_SLOT, slot);
1467}
1468
1469void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code); 1505void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code);
1470 1506
1471/** 1507/**
@@ -1578,8 +1614,5 @@ int input_ff_erase(struct input_dev *dev, int effect_id, struct file *file);
1578int input_ff_create_memless(struct input_dev *dev, void *data, 1614int input_ff_create_memless(struct input_dev *dev, void *data,
1579 int (*play_effect)(struct input_dev *, void *, struct ff_effect *)); 1615 int (*play_effect)(struct input_dev *, void *, struct ff_effect *));
1580 1616
1581int input_mt_create_slots(struct input_dev *dev, unsigned int num_slots);
1582void input_mt_destroy_slots(struct input_dev *dev);
1583
1584#endif 1617#endif
1585#endif 1618#endif