FliiFe / schud

A HUD for Steam Controller on Linux (inspired by VSCView on Windows)
ISC License
18 stars 1 forks source link

[Feature request] Gyroscope/accelerometer display #8

Open ShaneTRS opened 1 year ago

ShaneTRS commented 1 year ago

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 commented 1 year ago

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.

thorsb commented 1 year ago

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 commented 6 months ago

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 commented 6 months ago

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 commented 6 months ago

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 commented 4 months ago

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