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

[Issue]: Bluetooth and USB mouse axis rotated on some Android 13 devices #1240

Open
Chacal1988 opened this issue Aug 23, 2023 · 14 comments
Open
Labels

Comments

@Chacal1988
Copy link

Describe the bug

Just updated to Android 13 and mouse has changed axis. Now up is left and down is right.
On Android 12 USB and Bluetooth mouses work just fine.

Steps to reproduce

Update to Android 13 and try to use any mouse.

Affected games

All, and desktop.

Other Moonlight clients

PC

Moonlight adjusted settings

No

Moonlight adjusted settings (please complete the following information)

Moonlight default settings

Yes

Gamepad-related connection issue

No

Gamepad-related input issue

No

Gamepad-related streaming issue

No

Android version

13

Device model

Lenovo Tab 13

Server PC OS version

Win 10

Server PC GeForce Experience version

Last

Server PC Nvidia GPU driver version

Last

Server PC antivirus and firewall software

Windows

Screenshots

No

Relevant log output

Non

Additional context

Non

@Chacal1988 Chacal1988 added the bug label Aug 23, 2023
@cgutman
Copy link
Member

cgutman commented Aug 27, 2023

Do you know if your tablet has a "native" orientation of portrait? I wonder if the coordinates are now normalized to the natural orientation of the display.

When it boots does the logo show up in the portrait or landscape orientation?

@Chacal1988
Copy link
Author

The native orientation of my tablet is Landscape.
The "Lenovo" logo starts in landscape mode when i turn it on.
I just try disabling "screen rotaion" and "smart rotation", reestarted the device and the result is the same, mouse axis still rotated...

@Chacal1988
Copy link
Author

Maybe adding an option to rotate the Axis in the configuration menu sounds like a good idea!

@cgutman cgutman changed the title [Issue]: Bluetooth and USB mouse axis rotated [Issue]: Bluetooth and USB mouse axis rotated on some Android 13 devices Sep 2, 2023
@cgutman cgutman pinned this issue Sep 2, 2023
@cgutman
Copy link
Member

cgutman commented Sep 2, 2023

I looked through the Android AOSP source code to see if I could figure out what changed in Android 13 and it looks like there was a bug that shipped in the original Android 13 release that caused this issue. The bug was resolved by this commit: https://cs.android.com/android/_/android/platform/frameworks/native/+/258e2b909a91e893bf8cdd5b46ac7a9446de2549

I looked through the various Android 13 branches in AOSP and confirmed that fix was not present in the original Android 13 release (TP1A), but it was present starting in the December update for Pixel devices (TQ1A). Depending on when manufacturers branched from the AOSP code for Android 13 and if they merged in fixes from upstream AOSP code, some Android 13 devices may or may not be affected.

I will test and see if this behavior can somehow be detected and corrected automatically, but it may not be possible if there's no other reference available in the input events to determine how to undo the incorrect rotation performed by Android.

@Chacal1988
Copy link
Author

Cgutman, you are a god level human, and i hope your friends and family love you as much as you deserve.
Thank you for your time!

@Chacal1988
Copy link
Author

I just discover that if i split the screen in half, and use Moonlight in one side and at the same time another app in the other half of the screen, then the mouse moves just fine.
It is useless because the screen is so small, but at least i hope that helps you in some way finding a solution.
Thank you again!

@cgutman
Copy link
Member

cgutman commented Sep 3, 2023

Unfortunately, it does not seem possible to detect the swapped axis values reliably. Unlike SOURCE_TRACKPAD which does provide X and Y values in both relative deltas and absolute position, SOURCE_MOUSE_RELATIVE does not. It populates the same relative deltas in both AXIS_X/Y and AXIS_RELATIVE_X/Y, therefore it's not possible to determine if the relative deltas are rotated (and more importantly, which direction they are rotated).

There is probably no real solution other than asking your device manufacturer to incorporate the patch I linked or wait until Android 14 is released for your device. I have a build of Moonlight that just swaps the X and Y axes for all SOURCE_MOUSE_RELATIVE devices all the time, but it's definitely not something that I can include in an official release (since it will break all devices without this bug). Here is the build you can try: https://drive.google.com/file/d/19YHru1ZXMH6f1WSigsmypsPwunRkc4BH/view?usp=sharing

@Chacal1988
Copy link
Author

@cgutman Thank u very much for your time, but im sorry to say that the X axis is inverted...
When i move the mouse left the cursor moves right, and when i move right the cursor moves left.
Y Axis is working perfect now! Up and down works just fine!

@cgutman
Copy link
Member

cgutman commented Sep 3, 2023

Ok, this build inverts the X axis too - https://drive.google.com/file/d/1956ffbPYfCEOexGUmsHQg2WYKVBCl8eK/view?usp=sharing

@Chacal1988
Copy link
Author

It works perfect!!! You are, from now on, a god like human to me.
Dont u think Moonlight team should add an option in the config menu to change mouse axis movement?
Android 13 will live forever on some tablets and phones...
Thanks again! Your help was beyond my expectations.

@Trilyan
Copy link

Trilyan commented Sep 4, 2023

+1 to add the optional "Invert X" and "Invert Y" setting.

Thanks so much @cgutman for finding the root cause and providing the modified builds!

@1399702039
Copy link

好的,这个构建也反转了 X 轴 - https://drive.google.com/file/d/1956ffbPYfCEOexGUmsHQg2WYKVBCl8eK/view?usp=sharing

Can you send a latest version, I also encountered this problem, the same Lenovo Android tablet, the model is Pad Pro 12.7, thank you very much

@Jim29er
Copy link

Jim29er commented Dec 29, 2023

+1 for the option of inverting the mouse axes in the Moonlight settings!

@hg1217
Copy link

hg1217 commented Jan 17, 2024

Knowing Lenovo we cant expect any support from their absolute bots aka customer support. Anyone know a workaround for this ?

I recall I got it fixed temporarily by running my games etc in borderless mode via parsec but the problem still persists on Android games and any fullscreen app.

I regret buying this shit tab every day

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants