Add function to get max value for a given ev type

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2013-06-05 16:01:25 +10:00
parent 03fa066aec
commit 6019083a1a
2 changed files with 18 additions and 0 deletions

View file

@ -929,3 +929,12 @@ libevdev_get_input_prop_name(unsigned int prop)
return input_prop_map[prop];
}
int
libevdev_get_event_type_max(unsigned int type)
{
if (type > EV_MAX)
return -1;
return ev_max[type];
}

View file

@ -527,4 +527,13 @@ const char * libevdev_get_event_code_name(unsigned int type, unsigned int code);
*/
const char * libevdev_get_input_prop_name(unsigned int prop);
/**
* @return The max value defined for the given event type, e.g. ABS_MAX for a type of EV_ABS, or -1
* for an invalid type.
*
* @note The max value is compiled into libevdev. If the kernel changes the
* max value, libevdev will not automatically pick these up.
*/
int libevdev_get_event_type_max(unsigned int type);
#endif /* libevdev_H */