mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-05 21:44:40 +00:00
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:
committed by
Sam Lantinga
parent
a4ce721d7a
commit
0d5aa70e62
@@ -204,6 +204,7 @@ static SDL_bool IsVirtualJoystick(Uint16 vendor, Uint16 product, Uint16 version,
|
||||
|
||||
static int GuessIsJoystick(int fd)
|
||||
{
|
||||
unsigned long propbit[NBITS(INPUT_PROP_MAX)] = { 0 };
|
||||
unsigned long evbit[NBITS(EV_MAX)] = { 0 };
|
||||
unsigned long keybit[NBITS(KEY_MAX)] = { 0 };
|
||||
unsigned long absbit[NBITS(ABS_MAX)] = { 0 };
|
||||
@@ -217,7 +218,11 @@ static int GuessIsJoystick(int fd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
devclass = SDL_EVDEV_GuessDeviceClass(evbit, absbit, keybit, relbit);
|
||||
/* This is a newer feature, so it's allowed to fail - if so, then the
|
||||
* device just doesn't have any properties. */
|
||||
(void) ioctl(fd, EVIOCGPROP(sizeof(propbit)), propbit);
|
||||
|
||||
devclass = SDL_EVDEV_GuessDeviceClass(propbit, evbit, absbit, keybit, relbit);
|
||||
|
||||
if (devclass & SDL_UDEV_DEVICE_JOYSTICK) {
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user