Skip to content

Commit a07cf3e

Browse files
Kaldaienslouken
authored andcommitted
Allow 1 kHz sample rate for DualSense Edge over USB
DualSense Edge natively reports at 1 kHz for all connection types, but gyro sample rate was limited to 250 Hz for USB.
1 parent 0a50b79 commit a07cf3e

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/joystick/hidapi/SDL_hidapi_ps5.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -812,14 +812,19 @@ static void HIDAPI_DriverPS5_SetEnhancedModeAvailable(SDL_DriverPS5_Context *ctx
812812
}
813813

814814
if (ctx->sensors_supported) {
815+
// Standard DualSense sensor update rate is 250 Hz over USB
816+
float update_rate = 250.0f;
817+
815818
if (ctx->device->is_bluetooth) {
816819
// Bluetooth sensor update rate appears to be 1000 Hz
817-
SDL_PrivateJoystickAddSensor(ctx->joystick, SDL_SENSOR_GYRO, 1000.0f);
818-
SDL_PrivateJoystickAddSensor(ctx->joystick, SDL_SENSOR_ACCEL, 1000.0f);
819-
} else {
820-
SDL_PrivateJoystickAddSensor(ctx->joystick, SDL_SENSOR_GYRO, 250.0f);
821-
SDL_PrivateJoystickAddSensor(ctx->joystick, SDL_SENSOR_ACCEL, 250.0f);
820+
update_rate = 1000.0f;
821+
} else if (SDL_IsJoystickDualSenseEdge(ctx->device->vendor_id, ctx->device->product_id)) {
822+
// DualSense Edge sensor update rate is 1000 Hz over USB
823+
update_rate = 1000.0f;
822824
}
825+
826+
SDL_PrivateJoystickAddSensor(ctx->joystick, SDL_SENSOR_GYRO, update_rate);
827+
SDL_PrivateJoystickAddSensor(ctx->joystick, SDL_SENSOR_ACCEL, update_rate);
823828
}
824829

825830
ctx->report_battery = true;

0 commit comments

Comments
 (0)