From a07cf3ecdce32b7e8fb8aa906aa3e097b06e2b31 Mon Sep 17 00:00:00 2001
From: "Andon M. Coleman" <[EMAIL REDACTED]>
Date: Mon, 7 Jul 2025 16:14:47 -0400
Subject: [PATCH] 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.
---
src/joystick/hidapi/SDL_hidapi_ps5.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/joystick/hidapi/SDL_hidapi_ps5.c b/src/joystick/hidapi/SDL_hidapi_ps5.c
index e40170086e0d9..4249578e80c63 100644
--- a/src/joystick/hidapi/SDL_hidapi_ps5.c
+++ b/src/joystick/hidapi/SDL_hidapi_ps5.c
@@ -812,14 +812,19 @@ static void HIDAPI_DriverPS5_SetEnhancedModeAvailable(SDL_DriverPS5_Context *ctx
}
if (ctx->sensors_supported) {
+ // Standard DualSense sensor update rate is 250 Hz over USB
+ float update_rate = 250.0f;
+
if (ctx->device->is_bluetooth) {
// Bluetooth sensor update rate appears to be 1000 Hz
- SDL_PrivateJoystickAddSensor(ctx->joystick, SDL_SENSOR_GYRO, 1000.0f);
- SDL_PrivateJoystickAddSensor(ctx->joystick, SDL_SENSOR_ACCEL, 1000.0f);
- } else {
- SDL_PrivateJoystickAddSensor(ctx->joystick, SDL_SENSOR_GYRO, 250.0f);
- SDL_PrivateJoystickAddSensor(ctx->joystick, SDL_SENSOR_ACCEL, 250.0f);
+ update_rate = 1000.0f;
+ } else if (SDL_IsJoystickDualSenseEdge(ctx->device->vendor_id, ctx->device->product_id)) {
+ // DualSense Edge sensor update rate is 1000 Hz over USB
+ update_rate = 1000.0f;
}
+
+ SDL_PrivateJoystickAddSensor(ctx->joystick, SDL_SENSOR_GYRO, update_rate);
+ SDL_PrivateJoystickAddSensor(ctx->joystick, SDL_SENSOR_ACCEL, update_rate);
}
ctx->report_battery = true;