Skip to content

Commit 7b3351a

Browse files
committed
ensure gyro/accel is enabled on controller
1 parent db93685 commit 7b3351a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

rpi/ui/ui_sdl.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ SDL_GameController *find_valid_controller()
120120
for (int i = 0; i < SDL_NumJoysticks(); i++) {
121121
SDL_GameController *c = SDL_GameControllerOpen(i);
122122
if (c) {
123+
// Enable gyro/accelerometer
124+
SDL_GameControllerSetSensorEnabled(c, SDL_SENSOR_ACCEL, 1);
125+
SDL_GameControllerSetSensorEnabled(c, SDL_SENSOR_GYRO, 1);
126+
123127
return c;
124128
}
125129
}

0 commit comments

Comments
 (0)