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>
This commit is contained in:
parent
b9973954c5
commit
534565f254
|
@ -1046,6 +1046,62 @@ void input_free_device(struct input_dev *dev)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(input_free_device);
|
EXPORT_SYMBOL(input_free_device);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* input_set_capability - mark device as capable of a certain event
|
||||||
|
* @dev: device that is capable of emitting or accepting event
|
||||||
|
* @type: type of the event (EV_KEY, EV_REL, etc...)
|
||||||
|
* @code: event code
|
||||||
|
*
|
||||||
|
* In addition to setting up corresponding bit in appropriate capability
|
||||||
|
* bitmap the function also adjusts dev->evbit.
|
||||||
|
*/
|
||||||
|
void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code)
|
||||||
|
{
|
||||||
|
switch (type) {
|
||||||
|
case EV_KEY:
|
||||||
|
__set_bit(code, dev->keybit);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EV_REL:
|
||||||
|
__set_bit(code, dev->relbit);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EV_ABS:
|
||||||
|
__set_bit(code, dev->absbit);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EV_MSC:
|
||||||
|
__set_bit(code, dev->mscbit);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EV_SW:
|
||||||
|
__set_bit(code, dev->swbit);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EV_LED:
|
||||||
|
__set_bit(code, dev->ledbit);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EV_SND:
|
||||||
|
__set_bit(code, dev->sndbit);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EV_FF:
|
||||||
|
__set_bit(code, dev->ffbit);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
printk(KERN_ERR
|
||||||
|
"input_set_capability: unknown type %u (code %u)\n",
|
||||||
|
type, code);
|
||||||
|
dump_stack();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
__set_bit(type, dev->evbit);
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(input_set_capability);
|
||||||
|
|
||||||
int input_register_device(struct input_dev *dev)
|
int input_register_device(struct input_dev *dev)
|
||||||
{
|
{
|
||||||
static atomic_t input_no = ATOMIC_INIT(0);
|
static atomic_t input_no = ATOMIC_INIT(0);
|
||||||
|
|
|
@ -1160,6 +1160,8 @@ static inline void input_sync(struct input_dev *dev)
|
||||||
input_event(dev, EV_SYN, SYN_REPORT, 0);
|
input_event(dev, EV_SYN, SYN_REPORT, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code);
|
||||||
|
|
||||||
static inline void input_set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat)
|
static inline void input_set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat)
|
||||||
{
|
{
|
||||||
dev->absmin[axis] = min;
|
dev->absmin[axis] = min;
|
||||||
|
|
Loading…
Reference in New Issue