evdev: add a run-time check to avoid re-using model flags

Only runs on the LIBINPUT_MODEL_* flags, the ID_INPUT_TRACKBALL flag is an
exception.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2018-04-13 09:05:02 +10:00
parent f37c1dc66a
commit b0a0627ae2

View file

@ -1291,8 +1291,15 @@ evdev_read_model_flags(struct evdev_device *device)
};
const struct model_map *m = model_map;
uint32_t model_flags = 0;
uint32_t all_model_flags = 0;
while (m->property) {
/* Check for flag re-use */
if (strneq("LIBINPUT_MODEL_", m->property, 15)) {
assert((all_model_flags & m->model) == 0);
all_model_flags |= m->model;
}
if (parse_udev_flag(device,
device->udev_device,
m->property)) {