linux: Pass evdev properties when guessing device type

In newer kernels, devices that can be positively identified as a
particular device type (for example accelerometers) get a property
bit set. Plumb this information through into the function, but don't
use it for anything just yet.

Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie 2023-06-16 15:14:33 +01:00 committed by Sam Lantinga
parent a4ce721d7a
commit 0d5aa70e62
5 changed files with 26 additions and 6 deletions

View file

@ -1794,6 +1794,7 @@ run_test(void)
int actual;
struct
{
unsigned long props[NBITS(INPUT_PROP_MAX)];
unsigned long ev[NBITS(EV_MAX)];
unsigned long abs[NBITS(ABS_MAX)];
unsigned long keys[NBITS(KEY_MAX)];
@ -1803,11 +1804,16 @@ run_test(void)
printf("%s...\n", t->name);
memset(&caps, '\0', sizeof(caps));
memcpy(caps.props, t->props, sizeof(t->props));
memcpy(caps.ev, t->ev, sizeof(t->ev));
memcpy(caps.keys, t->keys, sizeof(t->keys));
memcpy(caps.abs, t->abs, sizeof(t->abs));
memcpy(caps.rel, t->rel, sizeof(t->rel));
for (j = 0; j < SDL_arraysize(caps.props); j++) {
caps.props[j] = SwapLongLE(caps.props[j]);
}
for (j = 0; j < SDL_arraysize(caps.ev); j++) {
caps.ev[j] = SwapLongLE(caps.ev[j]);
}
@ -1824,8 +1830,8 @@ run_test(void)
caps.rel[j] = SwapLongLE(caps.rel[j]);
}
actual = SDL_EVDEV_GuessDeviceClass(caps.ev, caps.abs, caps.keys,
caps.rel);
actual = SDL_EVDEV_GuessDeviceClass(caps.props, caps.ev, caps.abs,
caps.keys, caps.rel);
if (actual == t->expected) {
printf("\tOK\n");