diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2020-11-10 13:32:26 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2020-11-10 14:27:22 +1000 |
commit | 2c50ffab249f21f6dece2fdd0f45a6f2427f44bb (patch) | |
tree | 56f4f43e73ebd0d1936eb18530a72f4f9abe34a2 /tools | |
parent | cfd8e6c76c9be6c4ebdbc4e822762be4a30142e6 (diff) |
tools: print the AttrEventCodeEnable and AttrInputPropEnable/Disable quirks
Diffstat (limited to 'tools')
-rw-r--r-- | tools/shared.c | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/tools/shared.c b/tools/shared.c index c967e11e..8ba5f6a8 100644 --- a/tools/shared.c +++ b/tools/shared.c @@ -609,15 +609,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; @@ -633,6 +633,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, @@ -713,7 +736,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: |