diff options
Diffstat (limited to 'include/linux/input.h')
-rw-r--r-- | include/linux/input.h | 106 |
1 files changed, 54 insertions, 52 deletions
diff --git a/include/linux/input.h b/include/linux/input.h index b0e612dda0cf..ce1a756c4c30 100644 --- a/include/linux/input.h +++ b/include/linux/input.h | |||
@@ -12,8 +12,6 @@ | |||
12 | #ifdef __KERNEL__ | 12 | #ifdef __KERNEL__ |
13 | #include <linux/time.h> | 13 | #include <linux/time.h> |
14 | #include <linux/list.h> | 14 | #include <linux/list.h> |
15 | #include <linux/device.h> | ||
16 | #include <linux/mod_devicetable.h> | ||
17 | #else | 15 | #else |
18 | #include <sys/time.h> | 16 | #include <sys/time.h> |
19 | #include <sys/ioctl.h> | 17 | #include <sys/ioctl.h> |
@@ -58,6 +56,8 @@ struct input_absinfo { | |||
58 | 56 | ||
59 | #define EVIOCGVERSION _IOR('E', 0x01, int) /* get driver version */ | 57 | #define EVIOCGVERSION _IOR('E', 0x01, int) /* get driver version */ |
60 | #define EVIOCGID _IOR('E', 0x02, struct input_id) /* get device ID */ | 58 | #define EVIOCGID _IOR('E', 0x02, struct input_id) /* get device ID */ |
59 | #define EVIOCGREP _IOR('E', 0x03, int[2]) /* get repeat settings */ | ||
60 | #define EVIOCSREP _IOW('E', 0x03, int[2]) /* set repeat settings */ | ||
61 | #define EVIOCGKEYCODE _IOR('E', 0x04, int[2]) /* get keycode */ | 61 | #define EVIOCGKEYCODE _IOR('E', 0x04, int[2]) /* get keycode */ |
62 | #define EVIOCSKEYCODE _IOW('E', 0x04, int[2]) /* set keycode */ | 62 | #define EVIOCSKEYCODE _IOW('E', 0x04, int[2]) /* set keycode */ |
63 | 63 | ||
@@ -345,6 +345,8 @@ struct input_absinfo { | |||
345 | #define KEY_SAVE 234 | 345 | #define KEY_SAVE 234 |
346 | #define KEY_DOCUMENTS 235 | 346 | #define KEY_DOCUMENTS 235 |
347 | 347 | ||
348 | #define KEY_BATTERY 236 | ||
349 | |||
348 | #define KEY_UNKNOWN 240 | 350 | #define KEY_UNKNOWN 240 |
349 | 351 | ||
350 | #define BTN_MISC 0x100 | 352 | #define BTN_MISC 0x100 |
@@ -577,15 +579,10 @@ struct input_absinfo { | |||
577 | * Switch events | 579 | * Switch events |
578 | */ | 580 | */ |
579 | 581 | ||
580 | #define SW_0 0x00 | 582 | #define SW_LID 0x00 /* set = lid shut */ |
581 | #define SW_1 0x01 | 583 | #define SW_TABLET_MODE 0x01 /* set = tablet mode */ |
582 | #define SW_2 0x02 | 584 | #define SW_HEADPHONE_INSERT 0x02 /* set = inserted */ |
583 | #define SW_3 0x03 | 585 | #define SW_MAX 0x0f |
584 | #define SW_4 0x04 | ||
585 | #define SW_5 0x05 | ||
586 | #define SW_6 0x06 | ||
587 | #define SW_7 0x07 | ||
588 | #define SW_MAX 0x0f | ||
589 | 586 | ||
590 | /* | 587 | /* |
591 | * Misc events | 588 | * Misc events |
@@ -805,52 +802,16 @@ struct ff_effect { | |||
805 | 802 | ||
806 | #define FF_MAX 0x7f | 803 | #define FF_MAX 0x7f |
807 | 804 | ||
808 | struct input_device_id { | ||
809 | |||
810 | kernel_ulong_t flags; | ||
811 | |||
812 | struct input_id id; | ||
813 | |||
814 | kernel_ulong_t evbit[EV_MAX/BITS_PER_LONG+1]; | ||
815 | kernel_ulong_t keybit[KEY_MAX/BITS_PER_LONG+1]; | ||
816 | kernel_ulong_t relbit[REL_MAX/BITS_PER_LONG+1]; | ||
817 | kernel_ulong_t absbit[ABS_MAX/BITS_PER_LONG+1]; | ||
818 | kernel_ulong_t mscbit[MSC_MAX/BITS_PER_LONG+1]; | ||
819 | kernel_ulong_t ledbit[LED_MAX/BITS_PER_LONG+1]; | ||
820 | kernel_ulong_t sndbit[SND_MAX/BITS_PER_LONG+1]; | ||
821 | kernel_ulong_t ffbit[FF_MAX/BITS_PER_LONG+1]; | ||
822 | kernel_ulong_t swbit[SW_MAX/BITS_PER_LONG+1]; | ||
823 | |||
824 | kernel_ulong_t driver_info; | ||
825 | }; | ||
826 | |||
827 | /* | ||
828 | * Structure for hotplug & device<->driver matching. | ||
829 | */ | ||
830 | |||
831 | #define INPUT_DEVICE_ID_MATCH_BUS 1 | ||
832 | #define INPUT_DEVICE_ID_MATCH_VENDOR 2 | ||
833 | #define INPUT_DEVICE_ID_MATCH_PRODUCT 4 | ||
834 | #define INPUT_DEVICE_ID_MATCH_VERSION 8 | ||
835 | |||
836 | #define INPUT_DEVICE_ID_MATCH_EVBIT 0x010 | ||
837 | #define INPUT_DEVICE_ID_MATCH_KEYBIT 0x020 | ||
838 | #define INPUT_DEVICE_ID_MATCH_RELBIT 0x040 | ||
839 | #define INPUT_DEVICE_ID_MATCH_ABSBIT 0x080 | ||
840 | #define INPUT_DEVICE_ID_MATCH_MSCIT 0x100 | ||
841 | #define INPUT_DEVICE_ID_MATCH_LEDBIT 0x200 | ||
842 | #define INPUT_DEVICE_ID_MATCH_SNDBIT 0x400 | ||
843 | #define INPUT_DEVICE_ID_MATCH_FFBIT 0x800 | ||
844 | #define INPUT_DEVICE_ID_MATCH_SWBIT 0x1000 | ||
845 | |||
846 | #ifdef __KERNEL__ | 805 | #ifdef __KERNEL__ |
847 | 806 | ||
848 | /* | 807 | /* |
849 | * In-kernel definitions. | 808 | * In-kernel definitions. |
850 | */ | 809 | */ |
851 | 810 | ||
811 | #include <linux/device.h> | ||
852 | #include <linux/fs.h> | 812 | #include <linux/fs.h> |
853 | #include <linux/timer.h> | 813 | #include <linux/timer.h> |
814 | #include <linux/mod_devicetable.h> | ||
854 | 815 | ||
855 | #define NBITS(x) (((x)/BITS_PER_LONG)+1) | 816 | #define NBITS(x) (((x)/BITS_PER_LONG)+1) |
856 | #define BIT(x) (1UL<<((x)%BITS_PER_LONG)) | 817 | #define BIT(x) (1UL<<((x)%BITS_PER_LONG)) |
@@ -951,9 +912,49 @@ struct input_dev { | |||
951 | }; | 912 | }; |
952 | #define to_input_dev(d) container_of(d, struct input_dev, cdev) | 913 | #define to_input_dev(d) container_of(d, struct input_dev, cdev) |
953 | 914 | ||
954 | #define INPUT_DEVICE_ID_MATCH_DEVICE\ | 915 | /* |
916 | * Verify that we are in sync with input_device_id mod_devicetable.h #defines | ||
917 | */ | ||
918 | |||
919 | #if EV_MAX != INPUT_DEVICE_ID_EV_MAX | ||
920 | #error "EV_MAX and INPUT_DEVICE_ID_EV_MAX do not match" | ||
921 | #endif | ||
922 | |||
923 | #if KEY_MAX != INPUT_DEVICE_ID_KEY_MAX | ||
924 | #error "KEY_MAX and INPUT_DEVICE_ID_KEY_MAX do not match" | ||
925 | #endif | ||
926 | |||
927 | #if REL_MAX != INPUT_DEVICE_ID_REL_MAX | ||
928 | #error "REL_MAX and INPUT_DEVICE_ID_REL_MAX do not match" | ||
929 | #endif | ||
930 | |||
931 | #if ABS_MAX != INPUT_DEVICE_ID_ABS_MAX | ||
932 | #error "ABS_MAX and INPUT_DEVICE_ID_ABS_MAX do not match" | ||
933 | #endif | ||
934 | |||
935 | #if MSC_MAX != INPUT_DEVICE_ID_MSC_MAX | ||
936 | #error "MSC_MAX and INPUT_DEVICE_ID_MSC_MAX do not match" | ||
937 | #endif | ||
938 | |||
939 | #if LED_MAX != INPUT_DEVICE_ID_LED_MAX | ||
940 | #error "LED_MAX and INPUT_DEVICE_ID_LED_MAX do not match" | ||
941 | #endif | ||
942 | |||
943 | #if SND_MAX != INPUT_DEVICE_ID_SND_MAX | ||
944 | #error "SND_MAX and INPUT_DEVICE_ID_SND_MAX do not match" | ||
945 | #endif | ||
946 | |||
947 | #if FF_MAX != INPUT_DEVICE_ID_FF_MAX | ||
948 | #error "FF_MAX and INPUT_DEVICE_ID_FF_MAX do not match" | ||
949 | #endif | ||
950 | |||
951 | #if SW_MAX != INPUT_DEVICE_ID_SW_MAX | ||
952 | #error "SW_MAX and INPUT_DEVICE_ID_SW_MAX do not match" | ||
953 | #endif | ||
954 | |||
955 | #define INPUT_DEVICE_ID_MATCH_DEVICE \ | ||
955 | (INPUT_DEVICE_ID_MATCH_BUS | INPUT_DEVICE_ID_MATCH_VENDOR | INPUT_DEVICE_ID_MATCH_PRODUCT) | 956 | (INPUT_DEVICE_ID_MATCH_BUS | INPUT_DEVICE_ID_MATCH_VENDOR | INPUT_DEVICE_ID_MATCH_PRODUCT) |
956 | #define INPUT_DEVICE_ID_MATCH_DEVICE_AND_VERSION\ | 957 | #define INPUT_DEVICE_ID_MATCH_DEVICE_AND_VERSION \ |
957 | (INPUT_DEVICE_ID_MATCH_DEVICE | INPUT_DEVICE_ID_MATCH_VERSION) | 958 | (INPUT_DEVICE_ID_MATCH_DEVICE | INPUT_DEVICE_ID_MATCH_VERSION) |
958 | 959 | ||
959 | struct input_handle; | 960 | struct input_handle; |
@@ -1016,7 +1017,8 @@ static inline void input_put_device(struct input_dev *dev) | |||
1016 | 1017 | ||
1017 | static inline void input_free_device(struct input_dev *dev) | 1018 | static inline void input_free_device(struct input_dev *dev) |
1018 | { | 1019 | { |
1019 | input_put_device(dev); | 1020 | if (dev) |
1021 | input_put_device(dev); | ||
1020 | } | 1022 | } |
1021 | 1023 | ||
1022 | int input_register_device(struct input_dev *); | 1024 | int input_register_device(struct input_dev *); |