Set udev class for accelerometer

This commit is contained in:
meyraud705 authored and Sam Lantinga committed 2024-03-03 08:40:24 -08:00
1 parent e524e545f2
commit c6ec999869
2 files changed
+6 -1

No files matched your search

+5
View File
@@ -428,6 +428,11 @@ static int device_class(struct udev_device *dev)
devclass |= SDL_UDEV_DEVICE_JOYSTICK;
}
val = _this->syms.udev_device_get_property_value(dev, "ID_INPUT_ACCELEROMETER");
if (val && SDL_strcmp(val, "1") == 0) {
devclass |= SDL_UDEV_DEVICE_ACCELEROMETER;
}
val = _this->syms.udev_device_get_property_value(dev, "ID_INPUT_MOUSE");
if (val && SDL_strcmp(val, "1") == 0) {
devclass |= SDL_UDEV_DEVICE_MOUSE;
+1 -1
View File
@@ -360,7 +360,7 @@ static void joystick_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_clas
switch (udev_type) {
case SDL_UDEV_DEVICEADDED:
if (!(udev_class & SDL_UDEV_DEVICE_JOYSTICK)) {
if (!(udev_class & (SDL_UDEV_DEVICE_JOYSTICK | SDL_UDEV_DEVICE_ACCELEROMETER))) {
return;
}
if (SDL_classic_joysticks) {