[PR #2532] [MERGED] Fix SDL gyro and acceleration sensor handling #2808

Closed
opened 2026-02-27 22:01:20 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/2532
Author: @kalaposfos13
Created: 2/24/2025
Status: Merged
Merged: 2/24/2025
Merged by: @georgemoralis

Base: mainHead: orientation-fix


📝 Commits (2)

  • b884ae6 Fix sensor handling if they are enabled but an error was thrown regardless
  • f46cc9b Initialise orientation to a default value + clang

📊 Changes

4 files changed (+17 additions, -11 deletions)

View changed files

📝 src/core/libraries/pad/pad.cpp (+8 -6)
📝 src/input/controller.cpp (+1 -1)
📝 src/sdl_window.cpp (+6 -2)
📝 src/sdl_window.h (+2 -2)

📄 Description

Fixes the blackscreen in GRR upon trying to float
The issue comes from the fact that for some reason enabling the gyro both works and throws an operation not permitted error, so the emulator assumes that the function is unavailable, so it logs the error, but it's still enabled nevertheless, and it gets read anyway, but when it's time to convert it to orientation values, the deltatime is still an uninitialized zero, which messes up the calculations and outputs garbage orientation data that's so out of expected ranges (the quaternion should be normalized to length 1, and this makes some coordinates to be in the thousands), that the camera position calculation in the game just gives up, and that's why the game turns black apart from the HUD

This has the side effect of orientation not being available to users who had this issue, but for Arch users, I found this "fix" (might work for other distros too):

sudo nano /etc/udev/rules.d/99-gamepad-motion.rules

Add the following text:

KERNEL=="event*", SUBSYSTEM=="input", MODE="0666"

Reload this config:

sudo udevadm control --reload-rules
sudo udevadm trigger

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/shadps4-emu/shadPS4/pull/2532 **Author:** [@kalaposfos13](https://github.com/kalaposfos13) **Created:** 2/24/2025 **Status:** ✅ Merged **Merged:** 2/24/2025 **Merged by:** [@georgemoralis](https://github.com/georgemoralis) **Base:** `main` ← **Head:** `orientation-fix` --- ### 📝 Commits (2) - [`b884ae6`](https://github.com/shadps4-emu/shadPS4/commit/b884ae62d53c31a7e7f416a33b66e8e64909cd65) Fix sensor handling if they are enabled but an error was thrown regardless - [`f46cc9b`](https://github.com/shadps4-emu/shadPS4/commit/f46cc9bc794f98dfdd6b10592e693268c1c0f992) Initialise orientation to a default value + clang ### 📊 Changes **4 files changed** (+17 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `src/core/libraries/pad/pad.cpp` (+8 -6) 📝 `src/input/controller.cpp` (+1 -1) 📝 `src/sdl_window.cpp` (+6 -2) 📝 `src/sdl_window.h` (+2 -2) </details> ### 📄 Description Fixes the blackscreen in GRR upon trying to float The issue comes from the fact that for some reason enabling the gyro both works and throws an operation not permitted error, so the emulator assumes that the function is unavailable, so it logs the error, but it's still enabled nevertheless, and it gets read anyway, but when it's time to convert it to orientation values, the deltatime is still an uninitialized zero, which messes up the calculations and outputs garbage orientation data that's so out of expected ranges (the quaternion should be normalized to length 1, and this makes some coordinates to be in the thousands), that the camera position calculation in the game just gives up, and that's why the game turns black apart from the HUD This has the side effect of orientation not being available to users who had this issue, but for Arch users, I found this "fix" (might work for other distros too): ```bash sudo nano /etc/udev/rules.d/99-gamepad-motion.rules ``` Add the following text: ```ini KERNEL=="event*", SUBSYSTEM=="input", MODE="0666" ``` Reload this config: ```bash sudo udevadm control --reload-rules sudo udevadm trigger ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 22:01:20 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/shadPS4#2808
No description provided.