Skip to content

Commit

Permalink
I think it's working now but there's a bug in the light sensor code t…
Browse files Browse the repository at this point in the history
…hat prevents it from working.
  • Loading branch information
oshaboy committed Jan 11, 2025
1 parent 191f9a1 commit 09a6afa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 5 additions & 4 deletions input/drivers/sdl_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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",
Expand All @@ -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
}


Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions input/drivers/udev_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 09a6afa

Please sign in to comment.