diff options
Diffstat (limited to 'include/linux/input.h')
| -rw-r--r-- | include/linux/input.h | 188 |
1 files changed, 154 insertions, 34 deletions
diff --git a/include/linux/input.h b/include/linux/input.h index 735ceaf1bc2d..896a92227bc4 100644 --- a/include/linux/input.h +++ b/include/linux/input.h | |||
| @@ -58,10 +58,10 @@ struct input_absinfo { | |||
| 58 | 58 | ||
| 59 | #define EVIOCGVERSION _IOR('E', 0x01, int) /* get driver version */ | 59 | #define EVIOCGVERSION _IOR('E', 0x01, int) /* get driver version */ |
| 60 | #define EVIOCGID _IOR('E', 0x02, struct input_id) /* get device ID */ | 60 | #define EVIOCGID _IOR('E', 0x02, struct input_id) /* get device ID */ |
| 61 | #define EVIOCGREP _IOR('E', 0x03, int[2]) /* get repeat settings */ | 61 | #define EVIOCGREP _IOR('E', 0x03, unsigned int[2]) /* get repeat settings */ |
| 62 | #define EVIOCSREP _IOW('E', 0x03, int[2]) /* set repeat settings */ | 62 | #define EVIOCSREP _IOW('E', 0x03, unsigned int[2]) /* set repeat settings */ |
| 63 | #define EVIOCGKEYCODE _IOR('E', 0x04, int[2]) /* get keycode */ | 63 | #define EVIOCGKEYCODE _IOR('E', 0x04, unsigned int[2]) /* get keycode */ |
| 64 | #define EVIOCSKEYCODE _IOW('E', 0x04, int[2]) /* set keycode */ | 64 | #define EVIOCSKEYCODE _IOW('E', 0x04, unsigned int[2]) /* set keycode */ |
| 65 | 65 | ||
| 66 | #define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */ | 66 | #define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */ |
| 67 | #define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len) /* get physical location */ | 67 | #define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len) /* get physical location */ |
| @@ -376,8 +376,9 @@ struct input_absinfo { | |||
| 376 | #define KEY_DISPLAY_OFF 245 /* display device to off state */ | 376 | #define KEY_DISPLAY_OFF 245 /* display device to off state */ |
| 377 | 377 | ||
| 378 | #define KEY_WIMAX 246 | 378 | #define KEY_WIMAX 246 |
| 379 | #define KEY_RFKILL 247 /* Key that controls all radios */ | ||
| 379 | 380 | ||
| 380 | /* Range 248 - 255 is reserved for special needs of AT keyboard driver */ | 381 | /* Code 255 is reserved for special needs of AT keyboard driver */ |
| 381 | 382 | ||
| 382 | #define BTN_MISC 0x100 | 383 | #define BTN_MISC 0x100 |
| 383 | #define BTN_0 0x100 | 384 | #define BTN_0 0x100 |
| @@ -596,6 +597,49 @@ struct input_absinfo { | |||
| 596 | #define KEY_NUMERIC_POUND 0x20b | 597 | #define KEY_NUMERIC_POUND 0x20b |
| 597 | 598 | ||
| 598 | #define KEY_CAMERA_FOCUS 0x210 | 599 | #define KEY_CAMERA_FOCUS 0x210 |
| 600 | #define KEY_WPS_BUTTON 0x211 /* WiFi Protected Setup key */ | ||
| 601 | |||
| 602 | #define BTN_TRIGGER_HAPPY 0x2c0 | ||
| 603 | #define BTN_TRIGGER_HAPPY1 0x2c0 | ||
| 604 | #define BTN_TRIGGER_HAPPY2 0x2c1 | ||
| 605 | #define BTN_TRIGGER_HAPPY3 0x2c2 | ||
| 606 | #define BTN_TRIGGER_HAPPY4 0x2c3 | ||
| 607 | #define BTN_TRIGGER_HAPPY5 0x2c4 | ||
| 608 | #define BTN_TRIGGER_HAPPY6 0x2c5 | ||
| 609 | #define BTN_TRIGGER_HAPPY7 0x2c6 | ||
| 610 | #define BTN_TRIGGER_HAPPY8 0x2c7 | ||
| 611 | #define BTN_TRIGGER_HAPPY9 0x2c8 | ||
| 612 | #define BTN_TRIGGER_HAPPY10 0x2c9 | ||
| 613 | #define BTN_TRIGGER_HAPPY11 0x2ca | ||
| 614 | #define BTN_TRIGGER_HAPPY12 0x2cb | ||
| 615 | #define BTN_TRIGGER_HAPPY13 0x2cc | ||
| 616 | #define BTN_TRIGGER_HAPPY14 0x2cd | ||
| 617 | #define BTN_TRIGGER_HAPPY15 0x2ce | ||
| 618 | #define BTN_TRIGGER_HAPPY16 0x2cf | ||
| 619 | #define BTN_TRIGGER_HAPPY17 0x2d0 | ||
| 620 | #define BTN_TRIGGER_HAPPY18 0x2d1 | ||
| 621 | #define BTN_TRIGGER_HAPPY19 0x2d2 | ||
| 622 | #define BTN_TRIGGER_HAPPY20 0x2d3 | ||
| 623 | #define BTN_TRIGGER_HAPPY21 0x2d4 | ||
| 624 | #define BTN_TRIGGER_HAPPY22 0x2d5 | ||
| 625 | #define BTN_TRIGGER_HAPPY23 0x2d6 | ||
| 626 | #define BTN_TRIGGER_HAPPY24 0x2d7 | ||
| 627 | #define BTN_TRIGGER_HAPPY25 0x2d8 | ||
| 628 | #define BTN_TRIGGER_HAPPY26 0x2d9 | ||
| 629 | #define BTN_TRIGGER_HAPPY27 0x2da | ||
| 630 | #define BTN_TRIGGER_HAPPY28 0x2db | ||
| 631 | #define BTN_TRIGGER_HAPPY29 0x2dc | ||
| 632 | #define BTN_TRIGGER_HAPPY30 0x2dd | ||
| 633 | #define BTN_TRIGGER_HAPPY31 0x2de | ||
| 634 | #define BTN_TRIGGER_HAPPY32 0x2df | ||
| 635 | #define BTN_TRIGGER_HAPPY33 0x2e0 | ||
| 636 | #define BTN_TRIGGER_HAPPY34 0x2e1 | ||
| 637 | #define BTN_TRIGGER_HAPPY35 0x2e2 | ||
| 638 | #define BTN_TRIGGER_HAPPY36 0x2e3 | ||
| 639 | #define BTN_TRIGGER_HAPPY37 0x2e4 | ||
| 640 | #define BTN_TRIGGER_HAPPY38 0x2e5 | ||
| 641 | #define BTN_TRIGGER_HAPPY39 0x2e6 | ||
| 642 | #define BTN_TRIGGER_HAPPY40 0x2e7 | ||
| 599 | 643 | ||
| 600 | /* We avoid low common keys in module aliases so they don't get huge. */ | 644 | /* We avoid low common keys in module aliases so they don't get huge. */ |
| 601 | #define KEY_MIN_INTERESTING KEY_MUTE | 645 | #define KEY_MIN_INTERESTING KEY_MUTE |
| @@ -647,9 +691,12 @@ struct input_absinfo { | |||
| 647 | #define ABS_TILT_X 0x1a | 691 | #define ABS_TILT_X 0x1a |
| 648 | #define ABS_TILT_Y 0x1b | 692 | #define ABS_TILT_Y 0x1b |
| 649 | #define ABS_TOOL_WIDTH 0x1c | 693 | #define ABS_TOOL_WIDTH 0x1c |
| 694 | |||
| 650 | #define ABS_VOLUME 0x20 | 695 | #define ABS_VOLUME 0x20 |
| 696 | |||
| 651 | #define ABS_MISC 0x28 | 697 | #define ABS_MISC 0x28 |
| 652 | 698 | ||
| 699 | #define ABS_MT_SLOT 0x2f /* MT slot being modified */ | ||
| 653 | #define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */ | 700 | #define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */ |
| 654 | #define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */ | 701 | #define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */ |
| 655 | #define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */ | 702 | #define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */ |
| @@ -662,6 +709,12 @@ struct input_absinfo { | |||
| 662 | #define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */ | 709 | #define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */ |
| 663 | #define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */ | 710 | #define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */ |
| 664 | 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 | |||
| 665 | #define ABS_MAX 0x3f | 718 | #define ABS_MAX 0x3f |
| 666 | #define ABS_CNT (ABS_MAX+1) | 719 | #define ABS_CNT (ABS_MAX+1) |
| 667 | 720 | ||
| @@ -723,6 +776,7 @@ struct input_absinfo { | |||
| 723 | #define REP_DELAY 0x00 | 776 | #define REP_DELAY 0x00 |
| 724 | #define REP_PERIOD 0x01 | 777 | #define REP_PERIOD 0x01 |
| 725 | #define REP_MAX 0x01 | 778 | #define REP_MAX 0x01 |
| 779 | #define REP_CNT (REP_MAX+1) | ||
| 726 | 780 | ||
| 727 | /* | 781 | /* |
| 728 | * Sounds | 782 | * Sounds |
| @@ -762,6 +816,7 @@ struct input_absinfo { | |||
| 762 | #define BUS_HOST 0x19 | 816 | #define BUS_HOST 0x19 |
| 763 | #define BUS_GSC 0x1A | 817 | #define BUS_GSC 0x1A |
| 764 | #define BUS_ATARI 0x1B | 818 | #define BUS_ATARI 0x1B |
| 819 | #define BUS_SPI 0x1C | ||
| 765 | 820 | ||
| 766 | /* | 821 | /* |
| 767 | * MT_TOOL types | 822 | * MT_TOOL types |
| @@ -1003,6 +1058,14 @@ struct ff_effect { | |||
| 1003 | #include <linux/mod_devicetable.h> | 1058 | #include <linux/mod_devicetable.h> |
| 1004 | 1059 | ||
| 1005 | /** | 1060 | /** |
| 1061 | * struct input_mt_slot - represents the state of an input MT slot | ||
| 1062 | * @abs: holds current values of ABS_MT axes for this slot | ||
| 1063 | */ | ||
| 1064 | struct input_mt_slot { | ||
| 1065 | int abs[ABS_MT_LAST - ABS_MT_FIRST + 1]; | ||
| 1066 | }; | ||
| 1067 | |||
| 1068 | /** | ||
| 1006 | * struct input_dev - represents an input device | 1069 | * struct input_dev - represents an input device |
| 1007 | * @name: name of the device | 1070 | * @name: name of the device |
| 1008 | * @phys: physical path to the device in the system hierarchy | 1071 | * @phys: physical path to the device in the system hierarchy |
| @@ -1018,6 +1081,10 @@ struct ff_effect { | |||
| 1018 | * @sndbit: bitmap of sound effects supported by the device | 1081 | * @sndbit: bitmap of sound effects supported by the device |
| 1019 | * @ffbit: bitmap of force feedback effects supported by the device | 1082 | * @ffbit: bitmap of force feedback effects supported by the device |
| 1020 | * @swbit: bitmap of switches present on the device | 1083 | * @swbit: bitmap of switches present on the device |
| 1084 | * @hint_events_per_packet: average number of events generated by the | ||
| 1085 | * device in a packet (between EV_SYN/SYN_REPORT events). Used by | ||
| 1086 | * event handlers to estimate size of the buffer needed to hold | ||
| 1087 | * events. | ||
| 1021 | * @keycodemax: size of keycode table | 1088 | * @keycodemax: size of keycode table |
| 1022 | * @keycodesize: size of elements in keycode table | 1089 | * @keycodesize: size of elements in keycode table |
| 1023 | * @keycode: map of scancodes to keycodes for this device | 1090 | * @keycode: map of scancodes to keycodes for this device |
| @@ -1033,18 +1100,18 @@ struct ff_effect { | |||
| 1033 | * @repeat_key: stores key code of the last key pressed; used to implement | 1100 | * @repeat_key: stores key code of the last key pressed; used to implement |
| 1034 | * software autorepeat | 1101 | * software autorepeat |
| 1035 | * @timer: timer for software autorepeat | 1102 | * @timer: timer for software autorepeat |
| 1036 | * @sync: set to 1 when there were no new events since last EV_SYNC | ||
| 1037 | * @abs: current values for reports from absolute axes | ||
| 1038 | * @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 | ||
| 1108 | * @absinfo: array of &struct absinfo elements holding information | ||
| 1109 | * about absolute axes (current value, min, max, flat, fuzz, | ||
| 1110 | * resolution) | ||
| 1039 | * @key: reflects current state of device's keys/buttons | 1111 | * @key: reflects current state of device's keys/buttons |
| 1040 | * @led: reflects current state of device's LEDs | 1112 | * @led: reflects current state of device's LEDs |
| 1041 | * @snd: reflects current state of sound effects | 1113 | * @snd: reflects current state of sound effects |
| 1042 | * @sw: reflects current state of device's switches | 1114 | * @sw: reflects current state of device's switches |
| 1043 | * @absmax: maximum values for events coming from absolute axes | ||
| 1044 | * @absmin: minimum values for events coming from absolute axes | ||
| 1045 | * @absfuzz: describes noisiness for axes | ||
| 1046 | * @absflat: size of the center flat position (used by joydev) | ||
| 1047 | * @absres: resolution used for events coming form absolute axes | ||
| 1048 | * @open: this method is called when the very first user calls | 1115 | * @open: this method is called when the very first user calls |
| 1049 | * input_open_device(). The driver must prepare the device | 1116 | * input_open_device(). The driver must prepare the device |
| 1050 | * to start generating events (start polling thread, | 1117 | * to start generating events (start polling thread, |
| @@ -1074,6 +1141,7 @@ struct ff_effect { | |||
| 1074 | * last user closes the device | 1141 | * last user closes the device |
| 1075 | * @going_away: marks devices that are in a middle of unregistering and | 1142 | * @going_away: marks devices that are in a middle of unregistering and |
| 1076 | * causes input_open_device*() fail with -ENODEV. | 1143 | * causes input_open_device*() fail with -ENODEV. |
| 1144 | * @sync: set to %true when there were no new events since last EV_SYN | ||
| 1077 | * @dev: driver model's view of this device | 1145 | * @dev: driver model's view of this device |
| 1078 | * @h_list: list of input handles associated with the device. When | 1146 | * @h_list: list of input handles associated with the device. When |
| 1079 | * accessing the list dev->mutex must be held | 1147 | * accessing the list dev->mutex must be held |
| @@ -1095,33 +1163,34 @@ struct input_dev { | |||
| 1095 | unsigned long ffbit[BITS_TO_LONGS(FF_CNT)]; | 1163 | unsigned long ffbit[BITS_TO_LONGS(FF_CNT)]; |
| 1096 | unsigned long swbit[BITS_TO_LONGS(SW_CNT)]; | 1164 | unsigned long swbit[BITS_TO_LONGS(SW_CNT)]; |
| 1097 | 1165 | ||
| 1166 | unsigned int hint_events_per_packet; | ||
| 1167 | |||
| 1098 | unsigned int keycodemax; | 1168 | unsigned int keycodemax; |
| 1099 | unsigned int keycodesize; | 1169 | unsigned int keycodesize; |
| 1100 | void *keycode; | 1170 | void *keycode; |
| 1101 | int (*setkeycode)(struct input_dev *dev, int scancode, int keycode); | 1171 | int (*setkeycode)(struct input_dev *dev, |
| 1102 | int (*getkeycode)(struct input_dev *dev, int scancode, int *keycode); | 1172 | unsigned int scancode, unsigned int keycode); |
| 1173 | int (*getkeycode)(struct input_dev *dev, | ||
| 1174 | unsigned int scancode, unsigned int *keycode); | ||
| 1103 | 1175 | ||
| 1104 | struct ff_device *ff; | 1176 | struct ff_device *ff; |
| 1105 | 1177 | ||
| 1106 | unsigned int repeat_key; | 1178 | unsigned int repeat_key; |
| 1107 | struct timer_list timer; | 1179 | struct timer_list timer; |
| 1108 | 1180 | ||
| 1109 | int sync; | 1181 | int rep[REP_CNT]; |
| 1182 | |||
| 1183 | struct input_mt_slot *mt; | ||
| 1184 | int mtsize; | ||
| 1185 | int slot; | ||
| 1110 | 1186 | ||
| 1111 | int abs[ABS_MAX + 1]; | 1187 | struct input_absinfo *absinfo; |
| 1112 | int rep[REP_MAX + 1]; | ||
| 1113 | 1188 | ||
| 1114 | unsigned long key[BITS_TO_LONGS(KEY_CNT)]; | 1189 | unsigned long key[BITS_TO_LONGS(KEY_CNT)]; |
| 1115 | unsigned long led[BITS_TO_LONGS(LED_CNT)]; | 1190 | unsigned long led[BITS_TO_LONGS(LED_CNT)]; |
| 1116 | unsigned long snd[BITS_TO_LONGS(SND_CNT)]; | 1191 | unsigned long snd[BITS_TO_LONGS(SND_CNT)]; |
| 1117 | unsigned long sw[BITS_TO_LONGS(SW_CNT)]; | 1192 | unsigned long sw[BITS_TO_LONGS(SW_CNT)]; |
| 1118 | 1193 | ||
| 1119 | int absmax[ABS_MAX + 1]; | ||
| 1120 | int absmin[ABS_MAX + 1]; | ||
| 1121 | int absfuzz[ABS_MAX + 1]; | ||
| 1122 | int absflat[ABS_MAX + 1]; | ||
| 1123 | int absres[ABS_MAX + 1]; | ||
| 1124 | |||
| 1125 | int (*open)(struct input_dev *dev); | 1194 | int (*open)(struct input_dev *dev); |
| 1126 | void (*close)(struct input_dev *dev); | 1195 | void (*close)(struct input_dev *dev); |
| 1127 | int (*flush)(struct input_dev *dev, struct file *file); | 1196 | int (*flush)(struct input_dev *dev, struct file *file); |
| @@ -1135,6 +1204,8 @@ struct input_dev { | |||
| 1135 | unsigned int users; | 1204 | unsigned int users; |
| 1136 | bool going_away; | 1205 | bool going_away; |
| 1137 | 1206 | ||
| 1207 | bool sync; | ||
| 1208 | |||
| 1138 | struct device dev; | 1209 | struct device dev; |
| 1139 | 1210 | ||
| 1140 | struct list_head h_list; | 1211 | struct list_head h_list; |
| @@ -1199,6 +1270,10 @@ struct input_handle; | |||
| 1199 | * @event: event handler. This method is being called by input core with | 1270 | * @event: event handler. This method is being called by input core with |
| 1200 | * interrupts disabled and dev->event_lock spinlock held and so | 1271 | * interrupts disabled and dev->event_lock spinlock held and so |
| 1201 | * it may not sleep | 1272 | * it may not sleep |
| 1273 | * @filter: similar to @event; separates normal event handlers from | ||
| 1274 | * "filters". | ||
| 1275 | * @match: called after comparing device's id with handler's id_table | ||
| 1276 | * to perform fine-grained matching between device and handler | ||
| 1202 | * @connect: called when attaching a handler to an input device | 1277 | * @connect: called when attaching a handler to an input device |
| 1203 | * @disconnect: disconnects a handler from input device | 1278 | * @disconnect: disconnects a handler from input device |
| 1204 | * @start: starts handler for given handle. This function is called by | 1279 | * @start: starts handler for given handle. This function is called by |
| @@ -1210,8 +1285,6 @@ struct input_handle; | |||
| 1210 | * @name: name of the handler, to be shown in /proc/bus/input/handlers | 1285 | * @name: name of the handler, to be shown in /proc/bus/input/handlers |
| 1211 | * @id_table: pointer to a table of input_device_ids this driver can | 1286 | * @id_table: pointer to a table of input_device_ids this driver can |
| 1212 | * handle | 1287 | * handle |
| 1213 | * @blacklist: pointer to a table of input_device_ids this driver should | ||
| 1214 | * ignore even if they match @id_table | ||
| 1215 | * @h_list: list of input handles associated with the handler | 1288 | * @h_list: list of input handles associated with the handler |
| 1216 | * @node: for placing the driver onto input_handler_list | 1289 | * @node: for placing the driver onto input_handler_list |
| 1217 | * | 1290 | * |
| @@ -1220,6 +1293,11 @@ struct input_handle; | |||
| 1220 | * same time. All of them will get their copy of input event generated by | 1293 | * same time. All of them will get their copy of input event generated by |
| 1221 | * the device. | 1294 | * the device. |
| 1222 | * | 1295 | * |
| 1296 | * The very same structure is used to implement input filters. Input core | ||
| 1297 | * allows filters to run first and will not pass event to regular handlers | ||
| 1298 | * if any of the filters indicate that the event should be filtered (by | ||
| 1299 | * returning %true from their filter() method). | ||
| 1300 | * | ||
| 1223 | * Note that input core serializes calls to connect() and disconnect() | 1301 | * Note that input core serializes calls to connect() and disconnect() |
| 1224 | * methods. | 1302 | * methods. |
| 1225 | */ | 1303 | */ |
| @@ -1228,6 +1306,8 @@ struct input_handler { | |||
| 1228 | void *private; | 1306 | void *private; |
| 1229 | 1307 | ||
| 1230 | void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value); | 1308 | void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value); |
| 1309 | bool (*filter)(struct input_handle *handle, unsigned int type, unsigned int code, int value); | ||
| 1310 | bool (*match)(struct input_handler *handler, struct input_dev *dev); | ||
| 1231 | int (*connect)(struct input_handler *handler, struct input_dev *dev, const struct input_device_id *id); | 1311 | int (*connect)(struct input_handler *handler, struct input_dev *dev, const struct input_device_id *id); |
| 1232 | void (*disconnect)(struct input_handle *handle); | 1312 | void (*disconnect)(struct input_handle *handle); |
| 1233 | void (*start)(struct input_handle *handle); | 1313 | void (*start)(struct input_handle *handle); |
| @@ -1237,7 +1317,6 @@ struct input_handler { | |||
| 1237 | const char *name; | 1317 | const char *name; |
| 1238 | 1318 | ||
| 1239 | const struct input_device_id *id_table; | 1319 | const struct input_device_id *id_table; |
| 1240 | const struct input_device_id *blacklist; | ||
| 1241 | 1320 | ||
| 1242 | struct list_head h_list; | 1321 | struct list_head h_list; |
| 1243 | struct list_head node; | 1322 | struct list_head node; |
| @@ -1351,20 +1430,58 @@ static inline void input_mt_sync(struct input_dev *dev) | |||
| 1351 | input_event(dev, EV_SYN, SYN_MT_REPORT, 0); | 1430 | input_event(dev, EV_SYN, SYN_MT_REPORT, 0); |
| 1352 | } | 1431 | } |
| 1353 | 1432 | ||
| 1433 | static inline void input_mt_slot(struct input_dev *dev, int slot) | ||
| 1434 | { | ||
| 1435 | input_event(dev, EV_ABS, ABS_MT_SLOT, slot); | ||
| 1436 | } | ||
| 1437 | |||
| 1354 | void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code); | 1438 | void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code); |
| 1355 | 1439 | ||
| 1356 | static inline void input_set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat) | 1440 | /** |
| 1441 | * input_set_events_per_packet - tell handlers about the driver event rate | ||
| 1442 | * @dev: the input device used by the driver | ||
| 1443 | * @n_events: the average number of events between calls to input_sync() | ||
| 1444 | * | ||
| 1445 | * If the event rate sent from a device is unusually large, use this | ||
| 1446 | * function to set the expected event rate. This will allow handlers | ||
| 1447 | * to set up an appropriate buffer size for the event stream, in order | ||
| 1448 | * to minimize information loss. | ||
| 1449 | */ | ||
| 1450 | static inline void input_set_events_per_packet(struct input_dev *dev, int n_events) | ||
| 1357 | { | 1451 | { |
| 1358 | dev->absmin[axis] = min; | 1452 | dev->hint_events_per_packet = n_events; |
| 1359 | dev->absmax[axis] = max; | 1453 | } |
| 1360 | dev->absfuzz[axis] = fuzz; | ||
| 1361 | dev->absflat[axis] = flat; | ||
| 1362 | 1454 | ||
| 1363 | dev->absbit[BIT_WORD(axis)] |= BIT_MASK(axis); | 1455 | void input_alloc_absinfo(struct input_dev *dev); |
| 1456 | void input_set_abs_params(struct input_dev *dev, unsigned int axis, | ||
| 1457 | int min, int max, int fuzz, int flat); | ||
| 1458 | |||
| 1459 | #define INPUT_GENERATE_ABS_ACCESSORS(_suffix, _item) \ | ||
| 1460 | static inline int input_abs_get_##_suffix(struct input_dev *dev, \ | ||
| 1461 | unsigned int axis) \ | ||
| 1462 | { \ | ||
| 1463 | return dev->absinfo ? dev->absinfo[axis]._item : 0; \ | ||
| 1464 | } \ | ||
| 1465 | \ | ||
| 1466 | static inline void input_abs_set_##_suffix(struct input_dev *dev, \ | ||
| 1467 | unsigned int axis, int val) \ | ||
| 1468 | { \ | ||
| 1469 | input_alloc_absinfo(dev); \ | ||
| 1470 | if (dev->absinfo) \ | ||
| 1471 | dev->absinfo[axis]._item = val; \ | ||
| 1364 | } | 1472 | } |
| 1365 | 1473 | ||
| 1366 | int input_get_keycode(struct input_dev *dev, int scancode, int *keycode); | 1474 | INPUT_GENERATE_ABS_ACCESSORS(val, value) |
| 1367 | int input_set_keycode(struct input_dev *dev, int scancode, int keycode); | 1475 | INPUT_GENERATE_ABS_ACCESSORS(min, minimum) |
| 1476 | INPUT_GENERATE_ABS_ACCESSORS(max, maximum) | ||
| 1477 | INPUT_GENERATE_ABS_ACCESSORS(fuzz, fuzz) | ||
| 1478 | INPUT_GENERATE_ABS_ACCESSORS(flat, flat) | ||
| 1479 | INPUT_GENERATE_ABS_ACCESSORS(res, resolution) | ||
| 1480 | |||
| 1481 | int input_get_keycode(struct input_dev *dev, | ||
| 1482 | unsigned int scancode, unsigned int *keycode); | ||
| 1483 | int input_set_keycode(struct input_dev *dev, | ||
| 1484 | unsigned int scancode, unsigned int keycode); | ||
| 1368 | 1485 | ||
| 1369 | extern struct class input_class; | 1486 | extern struct class input_class; |
| 1370 | 1487 | ||
| @@ -1428,5 +1545,8 @@ int input_ff_erase(struct input_dev *dev, int effect_id, struct file *file); | |||
| 1428 | int input_ff_create_memless(struct input_dev *dev, void *data, | 1545 | int input_ff_create_memless(struct input_dev *dev, void *data, |
| 1429 | int (*play_effect)(struct input_dev *, void *, struct ff_effect *)); | 1546 | int (*play_effect)(struct input_dev *, void *, struct ff_effect *)); |
| 1430 | 1547 | ||
| 1548 | int input_mt_create_slots(struct input_dev *dev, unsigned int num_slots); | ||
| 1549 | void input_mt_destroy_slots(struct input_dev *dev); | ||
| 1550 | |||
| 1431 | #endif | 1551 | #endif |
| 1432 | #endif | 1552 | #endif |
