From dec7875a6e23212021e4d9080330a42832dfe02a Mon Sep 17 00:00:00 2001
From: Edward Rudd <urkle@outoforder.cc>
Date: Tue, 15 Jun 2021 01:40:19 +0000
Subject: [PATCH] update SDL soruce to 2.0.14
---
source/src/sensor/android/SDL_androidsensor.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/source/src/sensor/android/SDL_androidsensor.c b/source/src/sensor/android/SDL_androidsensor.c
index d7c0a7e..778fc26 100644
--- a/source/src/sensor/android/SDL_androidsensor.c
+++ b/source/src/sensor/android/SDL_androidsensor.c
@@ -18,6 +18,7 @@
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
+#include "../../SDL_internal.h"
#include "SDL_config.h"
@@ -130,6 +131,7 @@
SDL_ANDROID_SensorOpen(SDL_Sensor *sensor, int device_index)
{
struct sensor_hwdata *hwdata;
+ int delay_us, min_delay_us;
hwdata = (struct sensor_hwdata *)SDL_calloc(1, sizeof(*hwdata));
if (hwdata == NULL) {
@@ -149,7 +151,14 @@
return SDL_SetError("Couldn't enable sensor");
}
- /* FIXME: What rate should we set for this sensor? 60 FPS? Let's try the default rate for now... */
+ /* Use 60 Hz update rate if possible */
+ /* FIXME: Maybe add a hint for this? */
+ delay_us = 1000000 / 60;
+ min_delay_us = ASensor_getMinDelay(hwdata->asensor);
+ if (delay_us < min_delay_us) {
+ delay_us = min_delay_us;
+ }
+ ASensorEventQueue_setEventRate(hwdata->eventqueue, hwdata->asensor, delay_us);
sensor->hwdata = hwdata;
return 0;
--
Gitblit v1.9.3