86 lines
2.6 KiB
Diff
86 lines
2.6 KiB
Diff
From ab7b8fb32294d0923af4132e85c00d7b6c51e1d3 Mon Sep 17 00:00:00 2001
|
|
From: Peter Hutterer <peter.hutterer@who-t.net>
|
|
Date: Tue, 10 Nov 2020 13:32:26 +1000
|
|
Subject: [PATCH libinput 5/5] tools: print the AttrEventCodeEnable and
|
|
AttrInputPropEnable/Disable quirks
|
|
|
|
Introduced in e3c4ff3 and e882bd02
|
|
|
|
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
(cherry picked from commit 2c50ffab249f21f6dece2fdd0f45a6f2427f44bb)
|
|
---
|
|
tools/shared.c | 37 +++++++++++++++++++++++++++++++++----
|
|
1 file changed, 33 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/tools/shared.c b/tools/shared.c
|
|
index af791274..55c48ea1 100644
|
|
--- a/tools/shared.c
|
|
+++ b/tools/shared.c
|
|
@@ -576,15 +576,15 @@ tools_exec_command(const char *prefix, int real_argc, char **real_argv)
|
|
}
|
|
|
|
static void
|
|
-sprintf_event_codes(char *buf, size_t sz, struct quirks *quirks)
|
|
+sprintf_event_codes(char *buf, size_t sz, struct quirks *quirks, enum quirk q)
|
|
{
|
|
const struct quirk_tuples *t;
|
|
size_t off = 0;
|
|
int printed;
|
|
const char *name;
|
|
|
|
- quirks_get_tuples(quirks, QUIRK_ATTR_EVENT_CODE_DISABLE, &t);
|
|
- name = quirk_get_name(QUIRK_ATTR_EVENT_CODE_DISABLE);
|
|
+ quirks_get_tuples(quirks, q, &t);
|
|
+ name = quirk_get_name(q);
|
|
printed = snprintf(buf, sz, "%s=", name);
|
|
assert(printed != -1);
|
|
off += printed;
|
|
@@ -600,6 +600,29 @@ sprintf_event_codes(char *buf, size_t sz, struct quirks *quirks)
|
|
}
|
|
}
|
|
|
|
+static void
|
|
+sprintf_input_props(char *buf, size_t sz, struct quirks *quirks, enum quirk q)
|
|
+{
|
|
+ const uint32_t *properties;
|
|
+ size_t nprops = 0;
|
|
+ size_t off = 0;
|
|
+ int printed;
|
|
+ const char *name;
|
|
+
|
|
+ quirks_get_uint32_array(quirks, q, &properties, &nprops);
|
|
+ name = quirk_get_name(q);
|
|
+ printed = snprintf(buf, sz, "%s=", name);
|
|
+ assert(printed != -1);
|
|
+ off += printed;
|
|
+
|
|
+ for (size_t i = 0; off < sz && i < nprops; i++) {
|
|
+ const char *name = libevdev_property_get_name(properties[i]);
|
|
+ printed = snprintf(buf + off, sz - off, "%s;", name);
|
|
+ assert(printed != -1);
|
|
+ off += printed;
|
|
+ }
|
|
+}
|
|
+
|
|
void
|
|
tools_list_device_quirks(struct quirks_context *ctx,
|
|
struct udev_device *device,
|
|
@@ -680,7 +703,13 @@ tools_list_device_quirks(struct quirks_context *ctx,
|
|
callback(userdata, buf);
|
|
break;
|
|
case QUIRK_ATTR_EVENT_CODE_DISABLE:
|
|
- sprintf_event_codes(buf, sizeof(buf), quirks);
|
|
+ case QUIRK_ATTR_EVENT_CODE_ENABLE:
|
|
+ sprintf_event_codes(buf, sizeof(buf), quirks, q);
|
|
+ callback(userdata, buf);
|
|
+ break;
|
|
+ case QUIRK_ATTR_INPUT_PROP_DISABLE:
|
|
+ case QUIRK_ATTR_INPUT_PROP_ENABLE:
|
|
+ sprintf_input_props(buf, sizeof(buf), quirks, q);
|
|
callback(userdata, buf);
|
|
break;
|
|
default:
|
|
--
|
|
2.31.1
|
|
|