mirror of
https://gitlab.freedesktop.org/libevdev/libevdev.git
synced 2025-12-20 06:50:06 +01:00
A non-installed tool to make it easy to check if newly added codes are indeed supported correctly. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
47 lines
859 B
C
47 lines
859 B
C
// SPDX-License-Identifier: MIT
|
|
/*
|
|
* Copyright © 2021 Red Hat, Inc.
|
|
*/
|
|
|
|
/* Lists all event types and codes currently known by libevdev. */
|
|
|
|
#include "config.h"
|
|
|
|
#include <stdio.h>
|
|
#include <linux/input.h>
|
|
#include "libevdev/libevdev.h"
|
|
|
|
static void
|
|
list_event_codes(unsigned int type, unsigned int max)
|
|
{
|
|
const char *typestr = libevdev_event_type_get_name(type);
|
|
|
|
if (!typestr)
|
|
return;
|
|
|
|
printf("- %s:\n", typestr);
|
|
|
|
for (unsigned int code = 0; code <= max; code++) {
|
|
const char *str = libevdev_event_code_get_name(type, code);
|
|
|
|
if (!str)
|
|
continue;
|
|
|
|
printf(" %d: %s\n", code, str);
|
|
}
|
|
}
|
|
|
|
int
|
|
main (int argc, char **argv)
|
|
{
|
|
printf("codes:\n");
|
|
for (unsigned int type = 0; type <= EV_MAX; type++) {
|
|
int max = libevdev_event_type_get_max(type);
|
|
if (max == -1)
|
|
continue;
|
|
|
|
list_event_codes(type, (unsigned int)max);
|
|
}
|
|
|
|
return 0;
|
|
}
|