We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5460

Summary: Patch for Switch Pro Controller Gyro and Accel support
Product: SDL Reporter: jibb
Component: joystickAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: sezeroz
Version: 2.0.15   
Hardware: x86_64   
OS: Windows 10   
Attachments: Patch for Gyro and Accel sensors on Switch Pro Controllers
Patch for Gyro and Accel sensors on Switch Pro Controllers - v2

Description jibb 2021-01-11 07:41:36 UTC
Created attachment 4656 [details]
Patch for Gyro and Accel sensors on Switch Pro Controllers

I've attached a patch that adds support for the Switch Pro Controller's gyro and accelerometer via the Sensor functions that are used by PlayStation controllers.

Note that axes have been changed to behave the same as the PlayStation controllers -- They're the only controllers already supported, so I figure they've determined our "de facto" universal sensor coordinate system so that all supported controllers behave the same.

I've tested this with my Switch Pro Controller, wired and wireless, and compared with results from my DualShock 4 and DualSense.
Comment 1 Ozkan Sezer 2021-01-11 11:22:50 UTC
Created attachment 4657 [details]
Patch for Gyro and Accel sensors on Switch Pro Controllers - v2

Patch with irrelevant VS project file changes removed.
Comment 2 jibb 2021-01-11 12:41:17 UTC
(In reply to Ozkan Sezer from comment #1)
> Created attachment 4657 [details]
> Patch for Gyro and Accel sensors on Switch Pro Controllers - v2
> 
> Patch with irrelevant VS project file changes removed.

Sorry about that. My first time using mercurial, I didn't see that other files were being committed
Comment 3 Sam Lantinga 2021-01-11 22:20:33 UTC
Patch added, thanks!
https://hg.libsdl.org/SDL/rev/a121e8b405e0