From 4ffd8ab5448d60639198f6da1033055727728496 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 3 Nov 2025 14:48:11 +1000 Subject: [PATCH] lua: fix the event type/code loops - EV_MAX/ABS_MAX is inclusive Part-of: --- src/libinput-plugin-lua.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libinput-plugin-lua.c b/src/libinput-plugin-lua.c index 4dc6b285..6f4eb72a 100644 --- a/src/libinput-plugin-lua.c +++ b/src/libinput-plugin-lua.c @@ -727,7 +727,7 @@ evdevdevice_usages(lua_State *L) if (device->evdev == NULL) return 1; - for (unsigned int t = 0; t < EV_MAX; t++) { + for (unsigned int t = 0; t <= EV_MAX; t++) { if (!libevdev_has_event_type(device->evdev, t)) continue; @@ -756,7 +756,7 @@ evdevdevice_absinfos(lua_State *L) if (device->evdev == NULL) return 1; - for (unsigned int code = 0; code < ABS_MAX; code++) { + for (unsigned int code = 0; code <= ABS_MAX; code++) { const struct input_absinfo *abs = libevdev_get_abs_info(device->evdev, code); if (!abs) @@ -1133,7 +1133,7 @@ static void libinput_lua_init_evdev_global(lua_State *L, int sandbox_table_idx) { lua_newtable(L); - for (unsigned int t = 0; t < EV_MAX; t++) { + for (unsigned int t = 0; t <= EV_MAX; t++) { const char *typename = libevdev_event_type_get_name(t); if (!typename) continue;