Blacklist REP_MAX so it doesn't shadow REP_PERIOD

They have the same value, so the _MAX code would shadow the real code, causing
issues in any client that needs to get all event names from libevdev.
Specifically, the loop of:
  for each code in 0 to max-for-type:
      print(name)
would not show up the code (but the _MAX) code instead. This causes issues
with clients that rely on name resolution that works. And the _MAX values are
special values anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
This commit is contained in:
Peter Hutterer 2018-02-26 16:59:58 +10:00
parent 3799acd49e
commit a67d1964ff
2 changed files with 12 additions and 1 deletions

View file

@ -35,7 +35,8 @@ blacklist = [
"BTN_GAMEPAD",
"BTN_DIGI",
"BTN_WHEEL",
"BTN_TRIGGER_HAPPY"
"BTN_TRIGGER_HAPPY",
"REP_MAX",
]
btn_additional = [

View file

@ -143,6 +143,15 @@ START_TEST(test_code_snd_name)
}
END_TEST
START_TEST(test_code_rep_name)
{
ck_assert_str_eq(libevdev_event_code_get_name(EV_REP, REP_DELAY), "REP_DELAY");
ck_assert_str_eq(libevdev_event_code_get_name(EV_REP, REP_PERIOD), "REP_PERIOD");
ck_assert_str_eq(libevdev_event_code_get_name(EV_REP, REP_MAX), "REP_PERIOD");
}
END_TEST
START_TEST(test_code_msc_name)
{
/* pick out a few only */
@ -281,6 +290,7 @@ event_name_suite(void)
tcase_add_test(tc, test_code_key_name);
tcase_add_test(tc, test_code_led_name);
tcase_add_test(tc, test_code_snd_name);
tcase_add_test(tc, test_code_rep_name);
tcase_add_test(tc, test_code_msc_name);
tcase_add_test(tc, test_code_sw_name);
tcase_add_test(tc, test_code_ff_name);