From 09a6afa0a99c95eed96b46cc26a9baf981916fd6 Mon Sep 17 00:00:00 2001 From: oshaboy Date: Sat, 11 Jan 2025 19:43:10 +0200 Subject: [PATCH] I think it's working now but there's a bug in the light sensor code that prevents it from working. --- input/drivers/sdl_input.c | 9 +++++---- input/drivers/udev_input.c | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/input/drivers/sdl_input.c b/input/drivers/sdl_input.c index b091a8a5de2..778c62ef81a 100644 --- a/input/drivers/sdl_input.c +++ b/input/drivers/sdl_input.c @@ -747,7 +747,7 @@ static float sdl_input_get_sensor_input (void *data, unsigned port, unsigned id) return linux_get_illuminance_reading(sdl->illuminance_sensor); #endif #if SDL_SUPPORT_SENSORS - else if ((id == RETRO_SENSOR_ACCELEROMETER_X) | + if ((id == RETRO_SENSOR_ACCELEROMETER_X) | (id == RETRO_SENSOR_ACCELEROMETER_Y) | (id == RETRO_SENSOR_ACCELEROMETER_Z) ) sensor_type=SDL_SENSOR_ACCEL; @@ -800,7 +800,7 @@ static float sdl_input_get_sensor_input (void *data, unsigned port, unsigned id) return 0.f; /*UNIMPLEMENTED*/ } RARCH_DBG( - "[udev] sensor:\n" + "[sdl] sensor:\n" "\t%f\n" "\t%d\n" "\t%d\n", @@ -810,8 +810,9 @@ static float sdl_input_get_sensor_input (void *data, unsigned port, unsigned id) ); return sensor_value; -#endif +#else return 0.f; +#endif } @@ -820,7 +821,7 @@ input_driver_t input_sdl = { sdl_input_poll, sdl_input_state, sdl_input_free, - sdl_input_set_sensor_state, + sdl_set_sensor_state, sdl_input_get_sensor_input, sdl_get_capabilities, #ifdef HAVE_SDL2 diff --git a/input/drivers/udev_input.c b/input/drivers/udev_input.c index ce3aa6a6b9e..2ebcf838367 100644 --- a/input/drivers/udev_input.c +++ b/input/drivers/udev_input.c @@ -4101,6 +4101,8 @@ static bool udev_set_sensor_state(void *data, unsigned port, enum retro_sensor_a /* If already disabled, then do nothing */ linux_close_illuminance_sensor(udev->illuminance_sensor); /* noop if NULL */ udev->illuminance_sensor = NULL; + case RETRO_SENSOR_GYROSCOPE_ENABLE: + case RETRO_SENSOR_ACCELEROMETER_ENABLE: case RETRO_SENSOR_GYROSCOPE_DISABLE: case RETRO_SENSOR_ACCELEROMETER_DISABLE: /** Unimplemented sensor actions that probably shouldn't fail */