mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-24 13:30:05 +01:00
tools: handle the EventCodeDisable quirk in the quirks tool
This caused an assertion Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
83c3a3c6c8
commit
48a7c507f8
1 changed files with 29 additions and 0 deletions
|
|
@ -588,6 +588,31 @@ tools_exec_command(const char *prefix, int real_argc, char **real_argv)
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
static void
|
||||
sprintf_event_codes(char *buf, size_t sz, struct quirks *quirks)
|
||||
{
|
||||
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);
|
||||
printed = snprintf(buf, sz, "%s=", name);
|
||||
assert(printed != -1);
|
||||
off += printed;
|
||||
|
||||
for (size_t i = 0; off < sz && i < t->ntuples; i++) {
|
||||
const char *name = libevdev_event_code_get_name(
|
||||
t->tuples[i].first,
|
||||
t->tuples[i].second);
|
||||
|
||||
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,
|
||||
|
|
@ -664,6 +689,10 @@ tools_list_device_quirks(struct quirks_context *ctx,
|
|||
snprintf(buf, sizeof(buf), "%s=1", name);
|
||||
callback(userdata, buf);
|
||||
break;
|
||||
case QUIRK_ATTR_EVENT_CODE_DISABLE:
|
||||
sprintf_event_codes(buf, sizeof(buf), quirks);
|
||||
callback(userdata, buf);
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue