summaryrefslogtreecommitdiff
path: root/src/evdev.c
diff options
context:
space:
mode:
authorJosé Expósito <jose.exposito89@gmail.com>2021-09-12 17:09:20 +0200
committerPeter Hutterer <peter.hutterer@who-t.net>2021-09-12 21:16:32 +0000
commitdbcb003c5e579a8dcbcb622f230be4f3672ea3c8 (patch)
tree06751c238a5c69c991bab03fb6dd18bd3c5893a6 /src/evdev.c
parentd8088176149a6086927eb765a6e617cf0041ec10 (diff)
downloadlibinput-dbcb003c5e579a8dcbcb622f230be4f3672ea3c8.tar.gz
util: add a function to parse bool properties
Move the logic used to parse boolean quirks and udev flags to a common function in utils. Refactor, no functional changes. Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Diffstat (limited to 'src/evdev.c')
-rw-r--r--src/evdev.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/evdev.c b/src/evdev.c
index e8b37674..f332bc1b 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -94,19 +94,21 @@ parse_udev_flag(struct evdev_device *device,
const char *property)
{
const char *val;
+ bool b;
val = udev_device_get_property_value(udev_device, property);
if (!val)
return false;
- if (streq(val, "1"))
- return true;
- if (!streq(val, "0"))
+ if (!parse_boolean_property(val, &b)) {
evdev_log_error(device,
"property %s has invalid value '%s'\n",
property,
val);
- return false;
+ return false;
+ }
+
+ return b;
}
int