diff options
Diffstat (limited to 'drivers/input/input.c')
-rw-r--r-- | drivers/input/input.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c index 173c2861ec58..915e9ab7cab0 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
@@ -1046,6 +1046,62 @@ void input_free_device(struct input_dev *dev) | |||
1046 | } | 1046 | } |
1047 | EXPORT_SYMBOL(input_free_device); | 1047 | EXPORT_SYMBOL(input_free_device); |
1048 | 1048 | ||
1049 | /** | ||
1050 | * input_set_capability - mark device as capable of a certain event | ||
1051 | * @dev: device that is capable of emitting or accepting event | ||
1052 | * @type: type of the event (EV_KEY, EV_REL, etc...) | ||
1053 | * @code: event code | ||
1054 | * | ||
1055 | * In addition to setting up corresponding bit in appropriate capability | ||
1056 | * bitmap the function also adjusts dev->evbit. | ||
1057 | */ | ||
1058 | void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code) | ||
1059 | { | ||
1060 | switch (type) { | ||
1061 | case EV_KEY: | ||
1062 | __set_bit(code, dev->keybit); | ||
1063 | break; | ||
1064 | |||
1065 | case EV_REL: | ||
1066 | __set_bit(code, dev->relbit); | ||
1067 | break; | ||
1068 | |||
1069 | case EV_ABS: | ||
1070 | __set_bit(code, dev->absbit); | ||
1071 | break; | ||
1072 | |||
1073 | case EV_MSC: | ||
1074 | __set_bit(code, dev->mscbit); | ||
1075 | break; | ||
1076 | |||
1077 | case EV_SW: | ||
1078 | __set_bit(code, dev->swbit); | ||
1079 | break; | ||
1080 | |||
1081 | case EV_LED: | ||
1082 | __set_bit(code, dev->ledbit); | ||
1083 | break; | ||
1084 | |||
1085 | case EV_SND: | ||
1086 | __set_bit(code, dev->sndbit); | ||
1087 | break; | ||
1088 | |||
1089 | case EV_FF: | ||
1090 | __set_bit(code, dev->ffbit); | ||
1091 | break; | ||
1092 | |||
1093 | default: | ||
1094 | printk(KERN_ERR | ||
1095 | "input_set_capability: unknown type %u (code %u)\n", | ||
1096 | type, code); | ||
1097 | dump_stack(); | ||
1098 | return; | ||
1099 | } | ||
1100 | |||
1101 | __set_bit(type, dev->evbit); | ||
1102 | } | ||
1103 | EXPORT_SYMBOL(input_set_capability); | ||
1104 | |||
1049 | int input_register_device(struct input_dev *dev) | 1105 | int input_register_device(struct input_dev *dev) |
1050 | { | 1106 | { |
1051 | static atomic_t input_no = ATOMIC_INIT(0); | 1107 | static atomic_t input_no = ATOMIC_INIT(0); |