mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-25 03:30:05 +01:00
tools: print the AttrEventCodeEnable and AttrInputPropEnable/Disable quirks
Introduced ine3c4ff3ande882bd02Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
cfd8e6c76c
commit
2c50ffab24
1 changed files with 33 additions and 4 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue