mirror of
https://gitlab.freedesktop.org/libevdev/libevdev.git
synced 2025-12-24 19:20:06 +01:00
test: provide uinput convenience function for varargs
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
a30f4cfa8a
commit
f9532700bc
2 changed files with 14 additions and 4 deletions
|
|
@ -66,10 +66,9 @@ uinput_device_new(const char *name)
|
|||
}
|
||||
|
||||
int
|
||||
uinput_device_new_with_events(struct uinput_device **d, const char *name, const struct input_id *id, ...)
|
||||
uinput_device_new_with_events_v(struct uinput_device **d, const char *name, const struct input_id *id, va_list args)
|
||||
{
|
||||
int rc;
|
||||
va_list args;
|
||||
struct uinput_device *dev;
|
||||
|
||||
dev = uinput_device_new(name);
|
||||
|
|
@ -78,9 +77,7 @@ uinput_device_new_with_events(struct uinput_device **d, const char *name, const
|
|||
if (id != DEFAULT_IDS)
|
||||
uinput_device_set_ids(dev, id);
|
||||
|
||||
va_start(args, id);
|
||||
rc = uinput_device_set_event_bits_v(dev, args);
|
||||
va_end(args);
|
||||
|
||||
if (rc == 0)
|
||||
rc = uinput_device_create(dev);
|
||||
|
|
@ -94,6 +91,18 @@ uinput_device_new_with_events(struct uinput_device **d, const char *name, const
|
|||
return rc;
|
||||
}
|
||||
|
||||
int
|
||||
uinput_device_new_with_events(struct uinput_device **d, const char *name, const struct input_id *id, ...)
|
||||
{
|
||||
int rc;
|
||||
va_list args;
|
||||
|
||||
va_start(args, id);
|
||||
rc = uinput_device_new_with_events_v(d, name, id, args);
|
||||
va_end(args);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
void
|
||||
uinput_device_free(struct uinput_device *dev)
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
struct uinput_device* uinput_device_new(const char *name);
|
||||
int uinput_device_new_with_events(struct uinput_device **dev, const char *name, const struct input_id *ids, ...);
|
||||
int uinput_device_new_with_events_v(struct uinput_device **dev, const char *name, const struct input_id *ids, va_list args);
|
||||
void uinput_device_free(struct uinput_device *dev);
|
||||
|
||||
int uinput_device_create(struct uinput_device* dev);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue