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

Configuration of Deck's orientation #12

Open
kmicki opened this issue May 19, 2022 · 14 comments
Open

Configuration of Deck's orientation #12

kmicki opened this issue May 19, 2022 · 14 comments
Labels
enhancement New feature or request

Comments

@kmicki
Copy link
Owner

kmicki commented May 19, 2022

For some purposes it might be useful to transform the orientation (acceleration vector) of the Deck.
A few predefined orientation options would be fine (like in MotionSource Android app).

Requires #5.

@kmicki kmicki added the enhancement New feature or request label May 19, 2022
@kmicki kmicki mentioned this issue May 19, 2022
11 tasks
@WuTianming
Copy link

Hi! How is the progress of this enhancement proposal?

When playing racing games (Mario Kart 8; on emulator) I found that the gyro doesn't really work as it should. It steers the vehicle when I push one side of the Deck down, instead of when I rotate the Deck like a steering wheel. I am not sure if my Deck is defective (wrong installation of Gyro module?), but it would certainly be helpful if I can just tweak the settings in software. Is there anything I can do to contribute to the repo?

I understand that Gyro data manipulation is quite complicated as I used to work with an MPU6050 and couldn't wrap my head around it. Thank you for your great work!

@kmicki
Copy link
Owner Author

kmicki commented Feb 7, 2023

Not started yet. My progress on enhancements has been really slow for some time so I can't promise it will be done soon.

But about your issue - I guess you'd like to use Deck as a steering wheel when the screen is horizontal? That wouldn't be possible as Mario Kart is looking at the acceleration sensors (that detect direction of gravity). When rotating the Deck (or WiiU Gamepad) when it's horizontal, the direction of gravitational pull on it doesn't change.
The only way then would be to look at gyro (rotational speed) sensors but I guess in WiiU Gamepad they weren't so reliable so the game doesn't use them for steering.

The only way to steer the way you want (both using Deck and a real WiiU) is to hold the Deck/Gamepad vertically.

This enhancement is only for swapping directions of acceleration/gyro sensors but to do what you'd need would require generation of new, fake acceleration vectors by solving set of differential equations. That would be sensitive to errors and would need some way to reset to default acceleration vector.

@UntriexTv
Copy link

UntriexTv commented Feb 8, 2023

Hello i also have one really interesting problem with this. If i play BOTW the deck needs to be sideways to work properly, otherwise it just gets weird inputs. Gyro works with steam input tho.
Edit: needs to be turned left 90° and it works wonderfully. If played normally it gives just diagonal inputs if moved up/down and if turned 90° right, left and right are swapped.
Edit2: this was in desktop mode, if used on gaming mode to turn left/right deck needs to be turned like steering wheel. To work properly i need to lay down and hold the deck above me.

@kmicki
Copy link
Owner Author

kmicki commented Feb 8, 2023

This is a strange, known problem with BOTW on Cemu. I guess it might have been the same with an actual WiiU but I don't know. Might be a Cemu problem.

Anyway, to alleviate the issue, make sure that when you start Cemu and start the game, the Deck is placed on a flat surface. With its back plate facing the ground.

@WuTianming
Copy link

@kmicki Thanks for your quick response! I am running Mario Kart 8 Deluxe on yuzu the switch emulator. By "push down" I mean push one side of the Deck forward, away from my body.

Anyway I found a new perspective to this problem: open Settings in game mode, head over to Controller -> Calibration -> Gyro Calibration. The values of the three axes will be shown on the screen. From the icons you can deduce what direction these axes are supposed to be in:

截屏2023-02-09 下午12 35 25

On my device, the second axis and the third axis seems swapped. When I moved the Deck like a steering wheel (like the second icon), the icons suggest that it should be the second axis responding; but actually the third axis responded. When I moved the Deck like the third icon, it was the second axis that had a reading. Checkout the GIF file:

gyro

Can anyone check this to see if it's an issue with all Deck devices, or is it just me who have a malfunctioning machine?

@kmicki
Copy link
Owner Author

kmicki commented Feb 9, 2023

I checked on my Deck and you're right - your unit is defective. I guess the entire gyro+acceleration unit is rotated.

@WuTianming
Copy link

Too bad that I bought my unit from a scalper and RMA is kind of a pain. Thank you anyway for helping me out!

For my specific device, still I might look into the low level drivers when I have free time to see if it is possible to fix it easily. It appears quite doable; just flip the axes, right? xD

@kmicki
Copy link
Owner Author

kmicki commented Feb 9, 2023

Looking at the gif, I think when you're holding it upright it, the 6-axis IMU module is in a position like it would be normally when you hold Deck with the screen facing up. So yeah it's flipping 2 gyro access but also flipping direction of both axes.

Also, your acceleration vector will not be right, acceleration axes would also have to be flipped.

Values are send from USB device (Deck controller) using HID report. Unless you could somehow modify the report on the fly, I'm afraid it's not possible to fix it globally.

For sdgyrodsu, you can play with the mapping: acceleration and gyro. When I have some time I'll try to prepare some test verson for your issue specifically.

@WuTianming
Copy link

Thanks a ton for your help! I looked into the code and it seems like a quick fix for sdgyrodsu.

Surely the hiddev thing seems obscure. I guess in order to fix the systemwide hiddev readings, I would have to either poke into some kernel modules or discover some private API to reset the hardware. Or, somehow changing Steam's handling of the values would also help, since most games in Game Mode receive gyro values from Steam.

At least I now know that it should theoretically be easy to fix the wrong values (without differential equations). Thank you again!

@kmicki
Copy link
Owner Author

kmicki commented Feb 9, 2023

I checked again and I think the axes are swapped a little differently. I attached a binary with axes swapped in a way they should be for your case. Check if that's all right - maybe it's not.

sdgyrodsu.zip

  1. First, stop the sdgyrodsu service:
    systemctl --user stop sdgyrodsu
  2. Then unpack attached zip file and copy sdgyrodsu file to /home/deck/sdgyrodsu/. Overwrite the file.
  3. Then start the sdgyrodsu service:
    systemctl --user start sdgyrodsu

The best would be if you could check with PadTest (run it on a separate PC or on Steam Deck from Steam using Proton-GE).

@WuTianming
Copy link

WuTianming commented Feb 9, 2023

I tried out PadTest for the graphical view, and surprisingly the original sdgyrodsu executable did produce correct motion data 🤔. I then tried the updated version, which showed up in PadTest as if I was holding the Deck upside-down. Assuming that the original sdgyrodsu program is correctly set up, this means at least the HIDDEV device is functioning properly, and my hardware is fine.

I tried Mario Kart 8 Deluxe, but this time doing either of the two following motions gave me correct steering, and the game appears functional. I played a round and got the first place.
image
image

I then checked the settings page in SteamOS, and it's still showing wrong axes 😨. This is becoming confusing!

I believe it shouldn't be so easy to solder the IMU module in a wrong direction in the first place; when assembling the module, one has to match the pins for the module to function at all, which locks the module down in the one only correct direction. I am inclined to think that my unit is fine, but there is something weird going on with the SteamOS settings interface.

I think that my problem is going beyond what we discuss here in GitHub issues for SteamDeckGyroDSU. Maybe it's a generic problem about SteamOS. Thank you a lot for your work on this project, and it's so kind of you to spend time tweaking the software for me! 😁

Edit: for future viewers who want to try out the binary file above, you may want to run chmod +x sdgyrodsu as well.

@HilariousCow
Copy link

HilariousCow commented Feb 15, 2023

Hi WuTianming.
I'm working on a software fix for this issue (as well as a general solution for any other gyros with... idiosyncratic orientations). It will probably have to be a user facing rotation value. It would be good to know the serial number of your device so that I if it's an entire batch that is this way, we can fix it all at once.

As mentioned elsewhere in the thread, it could simply be an incorrect mounting/defect. However, I thought I'd try to gather as much info as possible so that other people's experience isn't disrupted.

Your serial number can be found in Settings-> System-> (Scroll down to) Steam Deck Serial Number.

If you're not comfortable posting it here, let's figure out a way you can DM me.

Thank you for posting this, by the way. It's really helpful toward getting Gyros to be a more streamline experience across devices.

@WuTianming
Copy link

Hi @HilariousCow ,

In the meantime I have installed some Steam software updates, and this time I checked my Deck, everything was working fine, including the calibration page in settings, which showed correct correspondence for the axes. The problem is no longer there.

Anyway, my serial number is FXAA2500B217. I'm glad that I can help Valve in perfecting their product 😁

@HilariousCow
Copy link

Glad to hear the software updates fixed it! And thanks for looking up the number!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
4 participants