aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@insightbb.com>2007-04-25 00:53:18 -0400
committerDmitry Torokhov <dtor@insightbb.com>2007-04-25 00:53:18 -0400
commit534565f254490227e3bec20d50f387800960acd9 (patch)
tree7e4a8ec054f21e9d709e5dd25fb8a4a0673cc1bb /drivers
parentb9973954c5f3264a2afa6ec357adb542f4b76e06 (diff)
Input: add input_set_capability() helper
Add input_set_capability() helper used to indicate that an input device supports a certain event without need to manipulate bitmaps directly. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/input/input.c56
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}
1047EXPORT_SYMBOL(input_free_device); 1047EXPORT_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 */
1058void 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}
1103EXPORT_SYMBOL(input_set_capability);
1104
1049int input_register_device(struct input_dev *dev) 1105int 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);