diff options
Diffstat (limited to 'include/linux/input.h')
-rw-r--r-- | include/linux/input.h | 99 |
1 files changed, 84 insertions, 15 deletions
diff --git a/include/linux/input.h b/include/linux/input.h index c2b1a7d244d9..7ed2251b33f1 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 |
@@ -595,6 +596,51 @@ struct input_absinfo { | |||
595 | #define KEY_NUMERIC_STAR 0x20a | 596 | #define KEY_NUMERIC_STAR 0x20a |
596 | #define KEY_NUMERIC_POUND 0x20b | 597 | #define KEY_NUMERIC_POUND 0x20b |
597 | 598 | ||
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 | ||
643 | |||
598 | /* 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. */ |
599 | #define KEY_MIN_INTERESTING KEY_MUTE | 645 | #define KEY_MIN_INTERESTING KEY_MUTE |
600 | #define KEY_MAX 0x2ff | 646 | #define KEY_MAX 0x2ff |
@@ -658,6 +704,7 @@ struct input_absinfo { | |||
658 | #define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */ | 704 | #define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */ |
659 | #define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */ | 705 | #define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */ |
660 | #define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */ | 706 | #define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */ |
707 | #define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */ | ||
661 | 708 | ||
662 | #define ABS_MAX 0x3f | 709 | #define ABS_MAX 0x3f |
663 | #define ABS_CNT (ABS_MAX+1) | 710 | #define ABS_CNT (ABS_MAX+1) |
@@ -677,6 +724,9 @@ struct input_absinfo { | |||
677 | #define SW_LINEOUT_INSERT 0x06 /* set = inserted */ | 724 | #define SW_LINEOUT_INSERT 0x06 /* set = inserted */ |
678 | #define SW_JACK_PHYSICAL_INSERT 0x07 /* set = mechanical switch set */ | 725 | #define SW_JACK_PHYSICAL_INSERT 0x07 /* set = mechanical switch set */ |
679 | #define SW_VIDEOOUT_INSERT 0x08 /* set = inserted */ | 726 | #define SW_VIDEOOUT_INSERT 0x08 /* set = inserted */ |
727 | #define SW_CAMERA_LENS_COVER 0x09 /* set = lens covered */ | ||
728 | #define SW_KEYPAD_SLIDE 0x0a /* set = keypad slide out */ | ||
729 | #define SW_FRONT_PROXIMITY 0x0b /* set = front proximity sensor active */ | ||
680 | #define SW_MAX 0x0f | 730 | #define SW_MAX 0x0f |
681 | #define SW_CNT (SW_MAX+1) | 731 | #define SW_CNT (SW_MAX+1) |
682 | 732 | ||
@@ -890,7 +940,7 @@ struct ff_periodic_effect { | |||
890 | struct ff_envelope envelope; | 940 | struct ff_envelope envelope; |
891 | 941 | ||
892 | __u32 custom_len; | 942 | __u32 custom_len; |
893 | __s16 *custom_data; | 943 | __s16 __user *custom_data; |
894 | }; | 944 | }; |
895 | 945 | ||
896 | /** | 946 | /** |
@@ -1016,9 +1066,12 @@ struct ff_effect { | |||
1016 | * @keycodesize: size of elements in keycode table | 1066 | * @keycodesize: size of elements in keycode table |
1017 | * @keycode: map of scancodes to keycodes for this device | 1067 | * @keycode: map of scancodes to keycodes for this device |
1018 | * @setkeycode: optional method to alter current keymap, used to implement | 1068 | * @setkeycode: optional method to alter current keymap, used to implement |
1019 | * sparse keymaps. If not supplied default mechanism will be used | 1069 | * sparse keymaps. If not supplied default mechanism will be used. |
1070 | * The method is being called while holding event_lock and thus must | ||
1071 | * not sleep | ||
1020 | * @getkeycode: optional method to retrieve current keymap. If not supplied | 1072 | * @getkeycode: optional method to retrieve current keymap. If not supplied |
1021 | * default mechanism will be used | 1073 | * default mechanism will be used. The method is being called while |
1074 | * holding event_lock and thus must not sleep | ||
1022 | * @ff: force feedback structure associated with the device if device | 1075 | * @ff: force feedback structure associated with the device if device |
1023 | * supports force feedback effects | 1076 | * supports force feedback effects |
1024 | * @repeat_key: stores key code of the last key pressed; used to implement | 1077 | * @repeat_key: stores key code of the last key pressed; used to implement |
@@ -1035,6 +1088,7 @@ struct ff_effect { | |||
1035 | * @absmin: minimum values for events coming from absolute axes | 1088 | * @absmin: minimum values for events coming from absolute axes |
1036 | * @absfuzz: describes noisiness for axes | 1089 | * @absfuzz: describes noisiness for axes |
1037 | * @absflat: size of the center flat position (used by joydev) | 1090 | * @absflat: size of the center flat position (used by joydev) |
1091 | * @absres: resolution used for events coming form absolute axes | ||
1038 | * @open: this method is called when the very first user calls | 1092 | * @open: this method is called when the very first user calls |
1039 | * input_open_device(). The driver must prepare the device | 1093 | * input_open_device(). The driver must prepare the device |
1040 | * to start generating events (start polling thread, | 1094 | * to start generating events (start polling thread, |
@@ -1088,8 +1142,10 @@ struct input_dev { | |||
1088 | unsigned int keycodemax; | 1142 | unsigned int keycodemax; |
1089 | unsigned int keycodesize; | 1143 | unsigned int keycodesize; |
1090 | void *keycode; | 1144 | void *keycode; |
1091 | int (*setkeycode)(struct input_dev *dev, int scancode, int keycode); | 1145 | int (*setkeycode)(struct input_dev *dev, |
1092 | int (*getkeycode)(struct input_dev *dev, int scancode, int *keycode); | 1146 | unsigned int scancode, unsigned int keycode); |
1147 | int (*getkeycode)(struct input_dev *dev, | ||
1148 | unsigned int scancode, unsigned int *keycode); | ||
1093 | 1149 | ||
1094 | struct ff_device *ff; | 1150 | struct ff_device *ff; |
1095 | 1151 | ||
@@ -1189,6 +1245,10 @@ struct input_handle; | |||
1189 | * @event: event handler. This method is being called by input core with | 1245 | * @event: event handler. This method is being called by input core with |
1190 | * interrupts disabled and dev->event_lock spinlock held and so | 1246 | * interrupts disabled and dev->event_lock spinlock held and so |
1191 | * it may not sleep | 1247 | * it may not sleep |
1248 | * @filter: similar to @event; separates normal event handlers from | ||
1249 | * "filters". | ||
1250 | * @match: called after comparing device's id with handler's id_table | ||
1251 | * to perform fine-grained matching between device and handler | ||
1192 | * @connect: called when attaching a handler to an input device | 1252 | * @connect: called when attaching a handler to an input device |
1193 | * @disconnect: disconnects a handler from input device | 1253 | * @disconnect: disconnects a handler from input device |
1194 | * @start: starts handler for given handle. This function is called by | 1254 | * @start: starts handler for given handle. This function is called by |
@@ -1200,8 +1260,6 @@ struct input_handle; | |||
1200 | * @name: name of the handler, to be shown in /proc/bus/input/handlers | 1260 | * @name: name of the handler, to be shown in /proc/bus/input/handlers |
1201 | * @id_table: pointer to a table of input_device_ids this driver can | 1261 | * @id_table: pointer to a table of input_device_ids this driver can |
1202 | * handle | 1262 | * handle |
1203 | * @blacklist: pointer to a table of input_device_ids this driver should | ||
1204 | * ignore even if they match @id_table | ||
1205 | * @h_list: list of input handles associated with the handler | 1263 | * @h_list: list of input handles associated with the handler |
1206 | * @node: for placing the driver onto input_handler_list | 1264 | * @node: for placing the driver onto input_handler_list |
1207 | * | 1265 | * |
@@ -1210,6 +1268,11 @@ struct input_handle; | |||
1210 | * same time. All of them will get their copy of input event generated by | 1268 | * same time. All of them will get their copy of input event generated by |
1211 | * the device. | 1269 | * the device. |
1212 | * | 1270 | * |
1271 | * The very same structure is used to implement input filters. Input core | ||
1272 | * allows filters to run first and will not pass event to regular handlers | ||
1273 | * if any of the filters indicate that the event should be filtered (by | ||
1274 | * returning %true from their filter() method). | ||
1275 | * | ||
1213 | * Note that input core serializes calls to connect() and disconnect() | 1276 | * Note that input core serializes calls to connect() and disconnect() |
1214 | * methods. | 1277 | * methods. |
1215 | */ | 1278 | */ |
@@ -1218,6 +1281,8 @@ struct input_handler { | |||
1218 | void *private; | 1281 | void *private; |
1219 | 1282 | ||
1220 | void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value); | 1283 | void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value); |
1284 | bool (*filter)(struct input_handle *handle, unsigned int type, unsigned int code, int value); | ||
1285 | bool (*match)(struct input_handler *handler, struct input_dev *dev); | ||
1221 | int (*connect)(struct input_handler *handler, struct input_dev *dev, const struct input_device_id *id); | 1286 | int (*connect)(struct input_handler *handler, struct input_dev *dev, const struct input_device_id *id); |
1222 | void (*disconnect)(struct input_handle *handle); | 1287 | void (*disconnect)(struct input_handle *handle); |
1223 | void (*start)(struct input_handle *handle); | 1288 | void (*start)(struct input_handle *handle); |
@@ -1227,7 +1292,6 @@ struct input_handler { | |||
1227 | const char *name; | 1292 | const char *name; |
1228 | 1293 | ||
1229 | const struct input_device_id *id_table; | 1294 | const struct input_device_id *id_table; |
1230 | const struct input_device_id *blacklist; | ||
1231 | 1295 | ||
1232 | struct list_head h_list; | 1296 | struct list_head h_list; |
1233 | struct list_head node; | 1297 | struct list_head node; |
@@ -1289,6 +1353,9 @@ void input_unregister_device(struct input_dev *); | |||
1289 | int __must_check input_register_handler(struct input_handler *); | 1353 | int __must_check input_register_handler(struct input_handler *); |
1290 | void input_unregister_handler(struct input_handler *); | 1354 | void input_unregister_handler(struct input_handler *); |
1291 | 1355 | ||
1356 | int input_handler_for_each_handle(struct input_handler *, void *data, | ||
1357 | int (*fn)(struct input_handle *, void *)); | ||
1358 | |||
1292 | int input_register_handle(struct input_handle *); | 1359 | int input_register_handle(struct input_handle *); |
1293 | void input_unregister_handle(struct input_handle *); | 1360 | void input_unregister_handle(struct input_handle *); |
1294 | 1361 | ||
@@ -1350,8 +1417,10 @@ static inline void input_set_abs_params(struct input_dev *dev, int axis, int min | |||
1350 | dev->absbit[BIT_WORD(axis)] |= BIT_MASK(axis); | 1417 | dev->absbit[BIT_WORD(axis)] |= BIT_MASK(axis); |
1351 | } | 1418 | } |
1352 | 1419 | ||
1353 | int input_get_keycode(struct input_dev *dev, int scancode, int *keycode); | 1420 | int input_get_keycode(struct input_dev *dev, |
1354 | int input_set_keycode(struct input_dev *dev, int scancode, int keycode); | 1421 | unsigned int scancode, unsigned int *keycode); |
1422 | int input_set_keycode(struct input_dev *dev, | ||
1423 | unsigned int scancode, unsigned int keycode); | ||
1355 | 1424 | ||
1356 | extern struct class input_class; | 1425 | extern struct class input_class; |
1357 | 1426 | ||