diff options
author | Marvin Raaijmakers <marvin_raaijmakers@linux-box.nl> | 2007-03-14 22:50:42 -0400 |
---|---|---|
committer | Dmitry Torokhov <dtor@insightbb.com> | 2007-03-14 22:50:42 -0400 |
commit | c8e4c77277ca5db0c4ddbfb4bc628b8abad585b0 (patch) | |
tree | 07bebb34767c8c3bd0902d6c2be3f4819b30a7bf /include/linux/input.h | |
parent | 55e3d9224b60df0fd2dc36bff9b538ce40fd9586 (diff) |
Input: add getkeycode and setkeycode methods
Allow drivers to implement their own get and set keycode methods. This
will allow drivers to change their keymaps without allocating huge
tables covering entire range of possible scancodes.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'include/linux/input.h')
-rw-r--r-- | include/linux/input.h | 31 |
1 files changed, 3 insertions, 28 deletions
diff --git a/include/linux/input.h b/include/linux/input.h index bde65c8a3519..3a8b8c6f0ab5 100644 --- a/include/linux/input.h +++ b/include/linux/input.h | |||
@@ -913,33 +913,6 @@ struct ff_effect { | |||
913 | #define BIT(x) (1UL<<((x)%BITS_PER_LONG)) | 913 | #define BIT(x) (1UL<<((x)%BITS_PER_LONG)) |
914 | #define LONG(x) ((x)/BITS_PER_LONG) | 914 | #define LONG(x) ((x)/BITS_PER_LONG) |
915 | 915 | ||
916 | #define INPUT_KEYCODE(dev, scancode) ((dev->keycodesize == 1) ? ((u8*)dev->keycode)[scancode] : \ | ||
917 | ((dev->keycodesize == 2) ? ((u16*)dev->keycode)[scancode] : (((u32*)dev->keycode)[scancode]))) | ||
918 | |||
919 | #define SET_INPUT_KEYCODE(dev, scancode, val) \ | ||
920 | ({ unsigned __old; \ | ||
921 | switch (dev->keycodesize) { \ | ||
922 | case 1: { \ | ||
923 | u8 *k = (u8 *)dev->keycode; \ | ||
924 | __old = k[scancode]; \ | ||
925 | k[scancode] = val; \ | ||
926 | break; \ | ||
927 | } \ | ||
928 | case 2: { \ | ||
929 | u16 *k = (u16 *)dev->keycode; \ | ||
930 | __old = k[scancode]; \ | ||
931 | k[scancode] = val; \ | ||
932 | break; \ | ||
933 | } \ | ||
934 | default: { \ | ||
935 | u32 *k = (u32 *)dev->keycode; \ | ||
936 | __old = k[scancode]; \ | ||
937 | k[scancode] = val; \ | ||
938 | break; \ | ||
939 | } \ | ||
940 | } \ | ||
941 | __old; }) | ||
942 | |||
943 | struct input_dev { | 916 | struct input_dev { |
944 | 917 | ||
945 | void *private; | 918 | void *private; |
@@ -962,6 +935,8 @@ struct input_dev { | |||
962 | unsigned int keycodemax; | 935 | unsigned int keycodemax; |
963 | unsigned int keycodesize; | 936 | unsigned int keycodesize; |
964 | void *keycode; | 937 | void *keycode; |
938 | int (*setkeycode)(struct input_dev *dev, int scancode, int keycode); | ||
939 | int (*getkeycode)(struct input_dev *dev, int scancode, int *keycode); | ||
965 | 940 | ||
966 | struct ff_device *ff; | 941 | struct ff_device *ff; |
967 | 942 | ||
@@ -1104,7 +1079,7 @@ struct input_handle { | |||
1104 | }; | 1079 | }; |
1105 | 1080 | ||
1106 | #define to_dev(n) container_of(n,struct input_dev,node) | 1081 | #define to_dev(n) container_of(n,struct input_dev,node) |
1107 | #define to_handler(n) container_of(n,struct input_handler,node); | 1082 | #define to_handler(n) container_of(n,struct input_handler,node) |
1108 | #define to_handle(n) container_of(n,struct input_handle,d_node) | 1083 | #define to_handle(n) container_of(n,struct input_handle,d_node) |
1109 | #define to_handle_h(n) container_of(n,struct input_handle,h_node) | 1084 | #define to_handle_h(n) container_of(n,struct input_handle,h_node) |
1110 | 1085 | ||