diff options
Diffstat (limited to 'include/linux/input.h')
| -rw-r--r-- | include/linux/input.h | 60 |
1 files changed, 57 insertions, 3 deletions
diff --git a/include/linux/input.h b/include/linux/input.h index 6fcc9101beeb..339d043ccb53 100644 --- a/include/linux/input.h +++ b/include/linux/input.h | |||
| @@ -691,9 +691,12 @@ struct input_absinfo { | |||
| 691 | #define ABS_TILT_X 0x1a | 691 | #define ABS_TILT_X 0x1a |
| 692 | #define ABS_TILT_Y 0x1b | 692 | #define ABS_TILT_Y 0x1b |
| 693 | #define ABS_TOOL_WIDTH 0x1c | 693 | #define ABS_TOOL_WIDTH 0x1c |
| 694 | |||
| 694 | #define ABS_VOLUME 0x20 | 695 | #define ABS_VOLUME 0x20 |
| 696 | |||
| 695 | #define ABS_MISC 0x28 | 697 | #define ABS_MISC 0x28 |
| 696 | 698 | ||
| 699 | #define ABS_MT_SLOT 0x2f /* MT slot being modified */ | ||
| 697 | #define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */ | 700 | #define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */ |
| 698 | #define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */ | 701 | #define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */ |
| 699 | #define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */ | 702 | #define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */ |
| @@ -706,6 +709,12 @@ struct input_absinfo { | |||
| 706 | #define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */ | 709 | #define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */ |
| 707 | #define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */ | 710 | #define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */ |
| 708 | 711 | ||
| 712 | #ifdef __KERNEL__ | ||
| 713 | /* Implementation details, userspace should not care about these */ | ||
| 714 | #define ABS_MT_FIRST ABS_MT_TOUCH_MAJOR | ||
| 715 | #define ABS_MT_LAST ABS_MT_PRESSURE | ||
| 716 | #endif | ||
| 717 | |||
| 709 | #define ABS_MAX 0x3f | 718 | #define ABS_MAX 0x3f |
| 710 | #define ABS_CNT (ABS_MAX+1) | 719 | #define ABS_CNT (ABS_MAX+1) |
| 711 | 720 | ||
| @@ -1048,6 +1057,14 @@ struct ff_effect { | |||
| 1048 | #include <linux/mod_devicetable.h> | 1057 | #include <linux/mod_devicetable.h> |
| 1049 | 1058 | ||
| 1050 | /** | 1059 | /** |
| 1060 | * struct input_mt_slot - represents the state of an input MT slot | ||
| 1061 | * @abs: holds current values of ABS_MT axes for this slot | ||
| 1062 | */ | ||
| 1063 | struct input_mt_slot { | ||
| 1064 | int abs[ABS_MT_LAST - ABS_MT_FIRST + 1]; | ||
| 1065 | }; | ||
| 1066 | |||
| 1067 | /** | ||
| 1051 | * struct input_dev - represents an input device | 1068 | * struct input_dev - represents an input device |
| 1052 | * @name: name of the device | 1069 | * @name: name of the device |
| 1053 | * @phys: physical path to the device in the system hierarchy | 1070 | * @phys: physical path to the device in the system hierarchy |
| @@ -1063,6 +1080,10 @@ struct ff_effect { | |||
| 1063 | * @sndbit: bitmap of sound effects supported by the device | 1080 | * @sndbit: bitmap of sound effects supported by the device |
| 1064 | * @ffbit: bitmap of force feedback effects supported by the device | 1081 | * @ffbit: bitmap of force feedback effects supported by the device |
| 1065 | * @swbit: bitmap of switches present on the device | 1082 | * @swbit: bitmap of switches present on the device |
| 1083 | * @hint_events_per_packet: average number of events generated by the | ||
| 1084 | * device in a packet (between EV_SYN/SYN_REPORT events). Used by | ||
| 1085 | * event handlers to estimate size of the buffer needed to hold | ||
| 1086 | * events. | ||
| 1066 | * @keycodemax: size of keycode table | 1087 | * @keycodemax: size of keycode table |
| 1067 | * @keycodesize: size of elements in keycode table | 1088 | * @keycodesize: size of elements in keycode table |
| 1068 | * @keycode: map of scancodes to keycodes for this device | 1089 | * @keycode: map of scancodes to keycodes for this device |
| @@ -1078,9 +1099,12 @@ struct ff_effect { | |||
| 1078 | * @repeat_key: stores key code of the last key pressed; used to implement | 1099 | * @repeat_key: stores key code of the last key pressed; used to implement |
| 1079 | * software autorepeat | 1100 | * software autorepeat |
| 1080 | * @timer: timer for software autorepeat | 1101 | * @timer: timer for software autorepeat |
| 1081 | * @sync: set to 1 when there were no new events since last EV_SYNC | ||
| 1082 | * @abs: current values for reports from absolute axes | 1102 | * @abs: current values for reports from absolute axes |
| 1083 | * @rep: current values for autorepeat parameters (delay, rate) | 1103 | * @rep: current values for autorepeat parameters (delay, rate) |
| 1104 | * @mt: pointer to array of struct input_mt_slot holding current values | ||
| 1105 | * of tracked contacts | ||
| 1106 | * @mtsize: number of MT slots the device uses | ||
| 1107 | * @slot: MT slot currently being transmitted | ||
| 1084 | * @key: reflects current state of device's keys/buttons | 1108 | * @key: reflects current state of device's keys/buttons |
| 1085 | * @led: reflects current state of device's LEDs | 1109 | * @led: reflects current state of device's LEDs |
| 1086 | * @snd: reflects current state of sound effects | 1110 | * @snd: reflects current state of sound effects |
| @@ -1119,6 +1143,7 @@ struct ff_effect { | |||
| 1119 | * last user closes the device | 1143 | * last user closes the device |
| 1120 | * @going_away: marks devices that are in a middle of unregistering and | 1144 | * @going_away: marks devices that are in a middle of unregistering and |
| 1121 | * causes input_open_device*() fail with -ENODEV. | 1145 | * causes input_open_device*() fail with -ENODEV. |
| 1146 | * @sync: set to %true when there were no new events since last EV_SYN | ||
| 1122 | * @dev: driver model's view of this device | 1147 | * @dev: driver model's view of this device |
| 1123 | * @h_list: list of input handles associated with the device. When | 1148 | * @h_list: list of input handles associated with the device. When |
| 1124 | * accessing the list dev->mutex must be held | 1149 | * accessing the list dev->mutex must be held |
| @@ -1140,6 +1165,8 @@ struct input_dev { | |||
| 1140 | unsigned long ffbit[BITS_TO_LONGS(FF_CNT)]; | 1165 | unsigned long ffbit[BITS_TO_LONGS(FF_CNT)]; |
| 1141 | unsigned long swbit[BITS_TO_LONGS(SW_CNT)]; | 1166 | unsigned long swbit[BITS_TO_LONGS(SW_CNT)]; |
| 1142 | 1167 | ||
| 1168 | unsigned int hint_events_per_packet; | ||
| 1169 | |||
| 1143 | unsigned int keycodemax; | 1170 | unsigned int keycodemax; |
| 1144 | unsigned int keycodesize; | 1171 | unsigned int keycodesize; |
| 1145 | void *keycode; | 1172 | void *keycode; |
| @@ -1153,11 +1180,13 @@ struct input_dev { | |||
| 1153 | unsigned int repeat_key; | 1180 | unsigned int repeat_key; |
| 1154 | struct timer_list timer; | 1181 | struct timer_list timer; |
| 1155 | 1182 | ||
| 1156 | int sync; | ||
| 1157 | |||
| 1158 | int abs[ABS_CNT]; | 1183 | int abs[ABS_CNT]; |
| 1159 | int rep[REP_MAX + 1]; | 1184 | int rep[REP_MAX + 1]; |
| 1160 | 1185 | ||
| 1186 | struct input_mt_slot *mt; | ||
| 1187 | int mtsize; | ||
| 1188 | int slot; | ||
| 1189 | |||
| 1161 | unsigned long key[BITS_TO_LONGS(KEY_CNT)]; | 1190 | unsigned long key[BITS_TO_LONGS(KEY_CNT)]; |
| 1162 | unsigned long led[BITS_TO_LONGS(LED_CNT)]; | 1191 | unsigned long led[BITS_TO_LONGS(LED_CNT)]; |
| 1163 | unsigned long snd[BITS_TO_LONGS(SND_CNT)]; | 1192 | unsigned long snd[BITS_TO_LONGS(SND_CNT)]; |
| @@ -1182,6 +1211,8 @@ struct input_dev { | |||
| 1182 | unsigned int users; | 1211 | unsigned int users; |
| 1183 | bool going_away; | 1212 | bool going_away; |
| 1184 | 1213 | ||
| 1214 | bool sync; | ||
| 1215 | |||
| 1185 | struct device dev; | 1216 | struct device dev; |
| 1186 | 1217 | ||
| 1187 | struct list_head h_list; | 1218 | struct list_head h_list; |
| @@ -1406,8 +1437,28 @@ static inline void input_mt_sync(struct input_dev *dev) | |||
| 1406 | input_event(dev, EV_SYN, SYN_MT_REPORT, 0); | 1437 | input_event(dev, EV_SYN, SYN_MT_REPORT, 0); |
| 1407 | } | 1438 | } |
| 1408 | 1439 | ||
| 1440 | static inline void input_mt_slot(struct input_dev *dev, int slot) | ||
| 1441 | { | ||
| 1442 | input_event(dev, EV_ABS, ABS_MT_SLOT, slot); | ||
| 1443 | } | ||
| 1444 | |||
| 1409 | void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code); | 1445 | void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code); |
| 1410 | 1446 | ||
| 1447 | /** | ||
| 1448 | * input_set_events_per_packet - tell handlers about the driver event rate | ||
| 1449 | * @dev: the input device used by the driver | ||
| 1450 | * @n_events: the average number of events between calls to input_sync() | ||
| 1451 | * | ||
| 1452 | * If the event rate sent from a device is unusually large, use this | ||
| 1453 | * function to set the expected event rate. This will allow handlers | ||
| 1454 | * to set up an appropriate buffer size for the event stream, in order | ||
| 1455 | * to minimize information loss. | ||
| 1456 | */ | ||
| 1457 | static inline void input_set_events_per_packet(struct input_dev *dev, int n_events) | ||
| 1458 | { | ||
| 1459 | dev->hint_events_per_packet = n_events; | ||
| 1460 | } | ||
| 1461 | |||
| 1411 | static inline void input_set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat) | 1462 | static inline void input_set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat) |
| 1412 | { | 1463 | { |
| 1413 | dev->absmin[axis] = min; | 1464 | dev->absmin[axis] = min; |
| @@ -1485,5 +1536,8 @@ int input_ff_erase(struct input_dev *dev, int effect_id, struct file *file); | |||
| 1485 | int input_ff_create_memless(struct input_dev *dev, void *data, | 1536 | int input_ff_create_memless(struct input_dev *dev, void *data, |
| 1486 | int (*play_effect)(struct input_dev *, void *, struct ff_effect *)); | 1537 | int (*play_effect)(struct input_dev *, void *, struct ff_effect *)); |
| 1487 | 1538 | ||
| 1539 | int input_mt_create_slots(struct input_dev *dev, unsigned int num_slots); | ||
| 1540 | void input_mt_destroy_slots(struct input_dev *dev); | ||
| 1541 | |||
| 1488 | #endif | 1542 | #endif |
| 1489 | #endif | 1543 | #endif |
