#define NAME "All event codes keyboard"
-static void all_codes_create(struct litest_device *d);
+static bool all_codes_create(struct litest_device *d);
static struct input_id input_id = {
.bustype = 0x11,
.absinfo = NULL,
)
-static void
+static bool
all_codes_create(struct litest_device *d)
{
int events[KEY_MAX * 2 + 2];
&input_id,
NULL,
events);
+ return false;
}
* For such devices, no overrides are possible. If create is NULL,
* the information in name, id, events, absinfo is used to
* create the device instead.
+ *
+ * @return true if the device needs to be created by litest, false if
+ * the device creates itself
*/
- void (*create)(struct litest_device *d);
+ bool (*create)(struct litest_device *d);
/**
* The device name. Only used when create is NULL.
const char *path;
int fd, rc;
bool found = false;
+ bool create_device = true;
list_for_each(dev, &devices, node) {
if (dev->type == which) {
/* device has custom create method */
if (dev->create) {
- dev->create(d);
+ create_device = dev->create(d);
if (abs_override || events_override) {
litest_abort_msg("Custom create cannot be overridden");
}
- } else {
- abs = merge_absinfo(dev->absinfo, abs_override);
- events = merge_events(dev->events, events_override);
- name = name_override ? name_override : dev->name;
- id = id_override ? id_override : dev->id;
+ }
+
+ abs = merge_absinfo(dev->absinfo, abs_override);
+ events = merge_events(dev->events, events_override);
+ name = name_override ? name_override : dev->name;
+ id = id_override ? id_override : dev->id;
+ if (create_device) {
d->uinput = litest_create_uinput_device_from_description(name,
id,
abs,