Add an API to get the repeat values

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2013-06-09 19:48:19 +10:00
parent 965e2250a0
commit eda87cdf91
2 changed files with 24 additions and 0 deletions

View file

@ -963,3 +963,17 @@ libevdev_get_event_type_max(unsigned int type)
return ev_max[type];
}
int
libevdev_get_repeat(struct libevdev *dev, int *delay, int *period)
{
if (!libevdev_has_event_type(dev, EV_REP))
return -1;
if (delay != NULL)
*delay = dev->rep_values[REP_DELAY];
if (period != NULL)
*period = dev->rep_values[REP_PERIOD];
return 0;
}

View file

@ -536,4 +536,14 @@ const char * libevdev_get_input_prop_name(unsigned int prop);
*/
int libevdev_get_event_type_max(unsigned int type);
/**
* Get the repeat delay and repeat period values for this device.
*
* @param delay If not null, set to the repeat delay value
* @param period If not null, set to the repeat period value
*
* @return 0 on success, -1 if this device does not have repeat settings.
*/
int libevdev_get_repeat(struct libevdev *dev, int *delay, int *period);
#endif /* libevdev_H */