summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2016-06-09 08:44:30 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2016-06-10 06:57:35 +1000
commitc781ef2eb366154d651f00e9a6107eff609b2afb (patch)
tree6e2b91154f1386510409981b1044164d00ec2dbe /src
parenta914e253fc0ea706a06867a70c2259b341b35d4a (diff)
evdev: check model flags for actual booleans
The hwdb doesn't allow unsetting a property so once we start nesting model flags it'll become important to be able to be able to unset one as well (by assigning it to 0). So rather than checking for existence, check whether the property is actually set to something resembling a boolean. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Tested-by: Vasily Khoruzhick <anarsoul@gmail.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/evdev.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/evdev.c b/src/evdev.c
index 0227f515..e0923cd9 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1813,10 +1813,12 @@ evdev_read_model_flags(struct evdev_device *device)
};
const struct model_map *m = model_map;
uint32_t model_flags = 0;
+ const char *val;
while (m->property) {
- if (!!udev_device_get_property_value(device->udev_device,
- m->property)) {
+ val = udev_device_get_property_value(device->udev_device,
+ m->property);
+ if (val && !streq(val, "0")) {
log_debug(device->base.seat->libinput,
"%s: tagged as %s\n",
evdev_device_get_sysname(device),