diff options
Diffstat (limited to 'include/linux/input.h')
-rw-r--r-- | include/linux/input.h | 109 |
1 files changed, 57 insertions, 52 deletions
diff --git a/include/linux/input.h b/include/linux/input.h index b0e612dda0cf..50e338d2ffda 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 | ||
@@ -577,15 +577,15 @@ struct input_absinfo { | |||
577 | * Switch events | 577 | * Switch events |
578 | */ | 578 | */ |
579 | 579 | ||
580 | #define SW_0 0x00 | 580 | #define SW_0 0x00 |
581 | #define SW_1 0x01 | 581 | #define SW_1 0x01 |
582 | #define SW_2 0x02 | 582 | #define SW_2 0x02 |
583 | #define SW_3 0x03 | 583 | #define SW_3 0x03 |
584 | #define SW_4 0x04 | 584 | #define SW_4 0x04 |
585 | #define SW_5 0x05 | 585 | #define SW_5 0x05 |
586 | #define SW_6 0x06 | 586 | #define SW_6 0x06 |
587 | #define SW_7 0x07 | 587 | #define SW_7 0x07 |
588 | #define SW_MAX 0x0f | 588 | #define SW_MAX 0x0f |
589 | 589 | ||
590 | /* | 590 | /* |
591 | * Misc events | 591 | * Misc events |
@@ -805,52 +805,16 @@ struct ff_effect { | |||
805 | 805 | ||
806 | #define FF_MAX 0x7f | 806 | #define FF_MAX 0x7f |
807 | 807 | ||
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__ | 808 | #ifdef __KERNEL__ |
847 | 809 | ||
848 | /* | 810 | /* |
849 | * In-kernel definitions. | 811 | * In-kernel definitions. |
850 | */ | 812 | */ |
851 | 813 | ||
814 | #include <linux/device.h> | ||
852 | #include <linux/fs.h> | 815 | #include <linux/fs.h> |
853 | #include <linux/timer.h> | 816 | #include <linux/timer.h> |
817 | #include <linux/mod_devicetable.h> | ||
854 | 818 | ||
855 | #define NBITS(x) (((x)/BITS_PER_LONG)+1) | 819 | #define NBITS(x) (((x)/BITS_PER_LONG)+1) |
856 | #define BIT(x) (1UL<<((x)%BITS_PER_LONG)) | 820 | #define BIT(x) (1UL<<((x)%BITS_PER_LONG)) |
@@ -951,9 +915,49 @@ struct input_dev { | |||
951 | }; | 915 | }; |
952 | #define to_input_dev(d) container_of(d, struct input_dev, cdev) | 916 | #define to_input_dev(d) container_of(d, struct input_dev, cdev) |
953 | 917 | ||
954 | #define INPUT_DEVICE_ID_MATCH_DEVICE\ | 918 | /* |
919 | * Verify that we are in sync with input_device_id mod_devicetable.h #defines | ||
920 | */ | ||
921 | |||
922 | #if EV_MAX != INPUT_DEVICE_ID_EV_MAX | ||
923 | #error "EV_MAX and INPUT_DEVICE_ID_EV_MAX do not match" | ||
924 | #endif | ||
925 | |||
926 | #if KEY_MAX != INPUT_DEVICE_ID_KEY_MAX | ||
927 | #error "KEY_MAX and INPUT_DEVICE_ID_KEY_MAX do not match" | ||
928 | #endif | ||
929 | |||
930 | #if REL_MAX != INPUT_DEVICE_ID_REL_MAX | ||
931 | #error "REL_MAX and INPUT_DEVICE_ID_REL_MAX do not match" | ||
932 | #endif | ||
933 | |||
934 | #if ABS_MAX != INPUT_DEVICE_ID_ABS_MAX | ||
935 | #error "ABS_MAX and INPUT_DEVICE_ID_ABS_MAX do not match" | ||
936 | #endif | ||
937 | |||
938 | #if MSC_MAX != INPUT_DEVICE_ID_MSC_MAX | ||
939 | #error "MSC_MAX and INPUT_DEVICE_ID_MSC_MAX do not match" | ||
940 | #endif | ||
941 | |||
942 | #if LED_MAX != INPUT_DEVICE_ID_LED_MAX | ||
943 | #error "LED_MAX and INPUT_DEVICE_ID_LED_MAX do not match" | ||
944 | #endif | ||
945 | |||
946 | #if SND_MAX != INPUT_DEVICE_ID_SND_MAX | ||
947 | #error "SND_MAX and INPUT_DEVICE_ID_SND_MAX do not match" | ||
948 | #endif | ||
949 | |||
950 | #if FF_MAX != INPUT_DEVICE_ID_FF_MAX | ||
951 | #error "FF_MAX and INPUT_DEVICE_ID_FF_MAX do not match" | ||
952 | #endif | ||
953 | |||
954 | #if SW_MAX != INPUT_DEVICE_ID_SW_MAX | ||
955 | #error "SW_MAX and INPUT_DEVICE_ID_SW_MAX do not match" | ||
956 | #endif | ||
957 | |||
958 | #define INPUT_DEVICE_ID_MATCH_DEVICE \ | ||
955 | (INPUT_DEVICE_ID_MATCH_BUS | INPUT_DEVICE_ID_MATCH_VENDOR | INPUT_DEVICE_ID_MATCH_PRODUCT) | 959 | (INPUT_DEVICE_ID_MATCH_BUS | INPUT_DEVICE_ID_MATCH_VENDOR | INPUT_DEVICE_ID_MATCH_PRODUCT) |
956 | #define INPUT_DEVICE_ID_MATCH_DEVICE_AND_VERSION\ | 960 | #define INPUT_DEVICE_ID_MATCH_DEVICE_AND_VERSION \ |
957 | (INPUT_DEVICE_ID_MATCH_DEVICE | INPUT_DEVICE_ID_MATCH_VERSION) | 961 | (INPUT_DEVICE_ID_MATCH_DEVICE | INPUT_DEVICE_ID_MATCH_VERSION) |
958 | 962 | ||
959 | struct input_handle; | 963 | struct input_handle; |
@@ -1016,7 +1020,8 @@ static inline void input_put_device(struct input_dev *dev) | |||
1016 | 1020 | ||
1017 | static inline void input_free_device(struct input_dev *dev) | 1021 | static inline void input_free_device(struct input_dev *dev) |
1018 | { | 1022 | { |
1019 | input_put_device(dev); | 1023 | if (dev) |
1024 | input_put_device(dev); | ||
1020 | } | 1025 | } |
1021 | 1026 | ||
1022 | int input_register_device(struct input_dev *); | 1027 | int input_register_device(struct input_dev *); |