Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Gyroscope/accelerometer display #8

Open
ShaneTRS opened this issue May 5, 2023 · 6 comments
Open

[Feature request] Gyroscope/accelerometer display #8

ShaneTRS opened this issue May 5, 2023 · 6 comments
Labels
help wanted Extra attention is needed

Comments

@ShaneTRS
Copy link

ShaneTRS commented May 5, 2023

I thought I saw an issue for this somewhere before, but I couldn't find it so here we go.

Gyroscope could be done by rotating the controller itself, but adding another object below the main controller that rotates would also work. Accelerometer is in a similar situation, no visual display.

@hdansin
Copy link
Collaborator

hdansin commented May 16, 2023

I would like to add this. The easiest way would probably be an icon. Unfortunately I have very little free time and I haven't been able to figure out how to read the gyro in the backend (hid.js). If someone more familiar with HID can help, I could probably get something working on the front end.

@hdansin hdansin closed this as completed May 16, 2023
@hdansin hdansin reopened this May 16, 2023
@hdansin hdansin added the help wanted Extra attention is needed label May 18, 2023
@thorsb
Copy link

thorsb commented May 18, 2023

The gyro isn't being parsed in hid.js, but the data should be in the event array.
I don't have access to a controller ATM, but I managed to find this explanation of the array in the linux kernel.

@jtkellys
Copy link

Sorry to resurrect an old thread, but did the gyro ever get figured out? I know there is an app called 3D Controller Overlay, that maybe this project could merge with. I don't know the specifics on how the data is being transferred (my programming knowledge is limited to DevSecOps), but I'm willing to help bring this back to life. I even made a 3D model of the controller and tried to import it into the 3D Controller Overlay app... but the gyro doesn't get registered.

3D_Overlay
Steam_Controller

@FliiFe
Copy link
Owner

FliiFe commented Feb 12, 2024

Hi there! Happy to see some attention here. As mentioned by hdansin, the gyro data isn't yet parsed but it shouldn't be too hard to implement (see the file from the linux kernel linked by thorsb). When I initially made this (long enough ago that I barely remember it), I think I didn't parse gyro data because it's trickier than the rest. If I remember correctly, the controller doesn't send any gyro data unless the gyro is explicitly enabled (by a game / steam input / etc), which makes debugging somewhat hard.

This might also be what you're facing with 3D Controller Overlay, have you tried it in-game (with a controller config that uses gyro) ?

@jtkellys
Copy link

Thanks for the response! I did try with a game open, but I'm running into more issues than just the gyro.

  1. The stand-alone app doesn't support Linux, and the dev has been working on it for some time. That's not a slight against the dev, I understand that this is a hobby so it takes time. I tried running it with wine, but even setting DLL overrides... it's still registering the controllers as "SDL Controllers" and I assume is not using the SDL2 dll packaged with the executable.

  2. There is a Steam version of the application that does pick up the gyro of the DualSense and Switch Pro controller. I assume this is because Proton is working in the background to ensure the right dependencies are being used. The problem with this method is that Steam Input is telling the app that the Steam Controller is an Xbox 360 Controller. I've gotten every input to work with the exception of the gyro functionality.

I was speaking with Mennenth and he explained that Steam gives the Steam Controller raw-hid inputs that need to be translated/converted to allow the overlay to understand what the controller is doing. He recommended I reach out to Nielk1 for more info... but I ended up finding this repository and figured you might be able to assist. Rather than re-inventing the wheel we could use the work you've already done and find a way either mirror it for the overlay, or use the code as is to do the translation needed. Let me know your thoughts and if you are willing to assist or let me hijack your code.

Thank you very much, and I look forward to your response :)

@Ryochan7
Copy link

If I remember correctly, the controller doesn't send any gyro data unless the gyro is explicitly enabled (by a game / steam input / etc), which makes debugging somewhat hard.

A piece of software can send an HID feature report to the Steam Controller to enable gyro data output so it is not dependent on anything specific within Steam Input. Besides the example from the Linux kernel driver, here are a couple of examples of configuring the Steam Controller to send gyro data in the HID input report. One is a Python example and the other is written in C#. The C# version is probably a bit easier to read.

https://github.com/Ryochan7/sc-controller/blob/python3/scc/drivers/sc_dongle.py#L314

https://github.com/Ryochan7/DS4MapperTest/blob/master/DS4MapperTest/SteamControllerLibrary/SteamControllerDevice.cs#L290

Example of how the data is parsed in C#

https://github.com/Ryochan7/DS4MapperTest/blob/master/DS4MapperTest/SteamControllerLibrary/SteamControllerReader.cs#L96

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

6 participants