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 - Patch for Switch Pro Controller Gyro and Accel support
Summary: Patch for Switch Pro Controller Gyro and Accel support
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: joystick (show other bugs)
Version: 2.0.15
Hardware: x86_64 Windows 10
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-11 07:41 UTC by jibb
Modified: 2021-01-11 22:20 UTC (History)
1 user (show)

See Also:


Attachments
Patch for Gyro and Accel sensors on Switch Pro Controllers (127.34 KB, text/plain)
2021-01-11 07:41 UTC, jibb
Details
Patch for Gyro and Accel sensors on Switch Pro Controllers - v2 (5.29 KB, patch)
2021-01-11 11:22 UTC, Ozkan Sezer
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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