Sunshine icon indicating copy to clipboard operation
Sunshine copied to clipboard

[Linux] Keyboard not working in several games

Open Sidefix opened this issue 1 year ago • 23 comments
trafficstars

Is there an existing issue for this?

  • [X] I have searched the existing issues

Is your issue described in the documentation?

  • [X] I have read the documentation

Is your issue present in the latest beta/pre-release?

  • [X] This issue is present in the latest pre-release

Describe the Bug

I have configured Sunshine on a Linux Ubuntu 2310 installation, working perfectly as intended in most games.

For example, Cyberpunk 2077, Armello, Rimworld, Deep Rock Galactic, Dying Light 2, all work fine.

However there is an issue in a very small handful of games that I have not been able to identify a link for. In Against the Storm, Death Must Die and Songs of Conquest, the keyboard input simply does not work.

The keyboard is fine and interacts outside of Sunshine with no issues, or in other games as stated above. It does not matter if I start game X first or last or any combination. In some games the keyboard input simply refuses to work.

Expected Behavior

The keyboard should work as intended with any application.

Additional Context

Ubuntu 23.10 Sunshine 0.23.1 (issue occurred with older versions as well) Proton-GE 9-5 (issue occurred with older versions as well) X11 capture Nvidia driver 555.42.02 (issue occurred with older versions as well)

Host Operating System

Linux

Operating System Version

23.10

Architecture

64 bit

Sunshine commit or version

0.23.1

Package

Linux - deb

GPU Type

Nvidia

GPU Model

RTXA2000

GPU Driver/Mesa Version

555.42.02

Capture Method (Linux Only)

X11

Config

log_path = /home/u/sunshine/configs/sunshine.log
nv_preset = p1
sunshine_name = ReVision
channels = 2
nvenc_preset = 7
fps = [60]
file_apps = /home/u/sunshine/configs/apps.json
resolutions = [
    1440x900
]
file_state = /home/u/sunshine/configs/sunshine_state.json
nv_rc = vbr
ping_timeout = 30000
min_log_level = 5
output_name = 0
global_prep_cmd = [{"do":"","undo":""}]
origin_web_ui_allowed = pc
credentials_file = /home/u/sunshine/configs/sunshine_state.json
nvenc_twopass = full_res
nvenc_spatial_aq = enabled

Apps

No response

Relevant log output

n/a

Sidefix avatar May 31 '24 08:05 Sidefix

I should add that only the keyboard is affected, and so far only the games mentioned above have been identified to be affected.

Mouse works perfectly fine in everything.

Sidefix avatar May 31 '24 08:05 Sidefix

Please post the regular logs (at level info) nonetheless.

At loglevel "debug" sunshine logs every mouse movement and every keypress. Please inspect those logs too and post an excerpt. (Annotated with what you pressed and if it worked or not.)

If I remember correctly there are some X-specific codepaths, so you could also try changing the capture method to KMS. As a second test you could also switch (temporarily) to Wayland instead of X (again with KMS).

gschintgen avatar Jun 02 '24 13:06 gschintgen

There is a new input library that we're getting ready to migrate to. It might be worth testing that PR.

ReenigneArcher avatar Jun 02 '24 18:06 ReenigneArcher

@gschintgen

[2024:06:03:12:30:27]: Debug: --begin keyboard packet-- keyAction [00000003] keyCode [804A] modifiers [00] flags [00] --end keyboard packet-- [2024:06:03:12:30:27]: Debug: --begin keyboard packet-- keyAction [00000004] keyCode [8048] modifiers [00] flags [00] --end keyboard packet-- [2024:06:03:12:30:27]: Debug: --begin keyboard packet-- keyAction [00000004] keyCode [8043] modifiers [00] flags [00] --end keyboard packet-- [2024:06:03:12:30:27]: Debug: --begin keyboard packet-- keyAction [00000004] keyCode [8045] modifiers [00] flags [00] --end keyboard packet-- [2024:06:03:12:30:27]: Debug: --begin keyboard packet-- keyAction [00000004] keyCode [8049] modifiers [00] flags [00] --end keyboard packet-- [2024:06:03:12:30:27]: Debug: --begin keyboard packet-- keyAction [00000004] keyCode [804E] modifiers [00] flags [00] --end keyboard packet--

Looks like the keyboard packets are sent... hmm.

@ReenigneArcher do you mean the latest nightly/dev build?

Sidefix avatar Jun 03 '24 09:06 Sidefix

@gschintgen

[2024:06:03:12:30:27]: Debug: --begin keyboard packet-- keyAction [00000003] keyCode [804A] modifiers [00] flags [00] --end keyboard packet-- [2024:06:03:12:30:27]: Debug: --begin keyboard packet-- keyAction [00000004] keyCode [8048] modifiers [00] flags [00] --end keyboard packet-- [2024:06:03:12:30:27]: Debug: --begin keyboard packet-- keyAction [00000004] keyCode [8043] modifiers [00] flags [00] --end keyboard packet-- [2024:06:03:12:30:27]: Debug: --begin keyboard packet-- keyAction [00000004] keyCode [8045] modifiers [00] flags [00] --end keyboard packet-- [2024:06:03:12:30:27]: Debug: --begin keyboard packet-- keyAction [00000004] keyCode [8049] modifiers [00] flags [00] --end keyboard packet-- [2024:06:03:12:30:27]: Debug: --begin keyboard packet-- keyAction [00000004] keyCode [804E] modifiers [00] flags [00] --end keyboard packet--

So the issue is on the receiving end, which is not really surprising. Did you check with a different display server or capture method? (BTW are there any free games that are affected?)

Looks like the keyboard packets are sent... hmm.

@ReenigneArcher do you mean the latest nightly/dev build?

The new input library should be the one from #2606 . Test builds can be retrieved from github actions. Here's the appimage for example: https://github.com/LizardByte/Sunshine/actions/runs/9378855742/artifacts/1569733361 (AppImages should work fine on Ubuntu.)

gschintgen avatar Jun 06 '24 20:06 gschintgen

Reaching back here, I was not able to get it to work with newer builds (including latest Dev v2024.730.191523).

I'll try to change capture methods, although I'm not sure if I can switch the display server. I'm currently using an X headless setup, and I have zero experience with wayland.

I'll post updated results soon.

Edit with results:

Absolutely all capture methods, including Automatic, have the same issue with the same games. My current display server is X on ubuntu 24.04, all packages up to date and upgraded.

I've also tried playing around with ibus (uninstalling/stopping) and with PROTON XIM (enabling/disabling) with no changes in behavior.

Any additional help would be greatly appreciated.

Sidefix avatar Aug 01 '24 18:08 Sidefix

Maybe this? https://steamcommunity.com/discussions/forum/1/1843566500527286941/

In particular if you have Moonlight set to always connect a virtual controller.

If it's working with most games it seems unlikely to be an issue with Sunshine itself.

On August 1, 2024 8:51:20 PM GMT+02:00, Sidefix @.***> wrote:

Reaching back here, I was not able to get it to work with newer builds (including latest Dev v2024.730.191523).

I'll try to change capture methods, although I'm not sure if I can switch the display server. I'm currently using an X headless setup, and I have zero experience with wayland.

I'll post updated results soon.

-- Reply to this email directly or view it on GitHub: https://github.com/LizardByte/Sunshine/issues/2614#issuecomment-2263745146 You are receiving this because you were mentioned.

Message ID: @.***>

gschintgen avatar Aug 01 '24 19:08 gschintgen

Thanks for the thought.

I have a laptop and tried to unplug everything, and the machine running sunshine has nothing plugged in either other than power. Same issue.

I also tried toggling various input settings from sunshine, still nothing.

I agree that it's more likely something and sunshine is just stuck in the middle. I'll try to reach out to the proton community, maybe they have more ideas. Thanks for the help so far.

Sidefix avatar Aug 01 '24 19:08 Sidefix

Further investigations:

The issue does not occur when playing the games locally. The issue only occurs when streaming through Sunshine.

So the issue is somewhere in the flow.

My flow is: Sunshine (which we've confirmed is registering the keyboard events) >>> X server display on :2 >>> Proton-GE >>> game.exe

No further conclusions. Will report back here with additional findings.

Sidefix avatar Aug 02 '24 12:08 Sidefix

Did you connect a controller during those local tests?

On August 2, 2024 2:31:55 PM GMT+02:00, Sidefix @.***> wrote:

Further investigations:

The issue does not occur when playing the games locally. The issue only occurs when streaming through Sunshine.

So the issue is somewhere in the flow.

My flow is: Sunshine (which we've confirmed is registering the keyboard events) >>> X server display on :2 >>> Proton-GE >>> game.exe

No further conclusions. Will report back here with additional findings.

-- Reply to this email directly or view it on GitHub: https://github.com/LizardByte/Sunshine/issues/2614#issuecomment-2265255878 You are receiving this because you were mentioned.

Message ID: @.***>

gschintgen avatar Aug 02 '24 12:08 gschintgen

No, no accessories were connected during the tests.

Edit: obviously the mouse + keyboard were connected to the device during the local test; but no other accessories were.

Sidefix avatar Aug 02 '24 12:08 Sidefix

It would be nice to know though, in light of the comment on Reddit that some games seem to ignore keyboard input if a controller is connected. In that case it could be sufficient to ensure that Sunshine is not adding an unwanted virtual controller.

On August 2, 2024 2:49:45 PM GMT+02:00, Sidefix @.***> wrote:

No, no accessories were connected during the tests.

-- Reply to this email directly or view it on GitHub: https://github.com/LizardByte/Sunshine/issues/2614#issuecomment-2265321708 You are receiving this because you were mentioned.

Message ID: @.***>

gschintgen avatar Aug 02 '24 17:08 gschintgen

@gschintgen I'm not sure I understand your suggestion; are you saying I should try with a controller connected on the host machine or

Sidefix avatar Aug 07 '24 07:08 Sidefix

Yes. According to the reddit thread I linked having a controller connected apparently breaks/disables keyboard support in some games. No streaming involved. It could help isolate the cause of your issue.

On August 7, 2024 9:09:44 AM GMT+02:00, Sidefix @.***> wrote:

@gschintgen I'm not sure I understand your suggestion; are you saying I should try with a controller connected on the host machine or

-- Reply to this email directly or view it on GitHub: https://github.com/LizardByte/Sunshine/issues/2614#issuecomment-2272775622 You are receiving this because you were mentioned.

Message ID: @.***>

gschintgen avatar Aug 07 '24 07:08 gschintgen

There is a new input library that we're getting ready to migrate to. It might be worth testing that PR.

Valorant will also happen,A few games have keyboards that don't work,SHIELD is normal.

zycbaby2008 avatar Sep 08 '24 11:09 zycbaby2008

same problem in win11 and windows On-screen Keyboard also don't work in that game.

sh4233177 avatar Nov 30 '24 16:11 sh4233177

Interesting observation:

I had been playing Infection Free Zone earlier in the year using Sunshine/Moonlight from a PC, with no issues. After playing for a while, I took a break.

Recently I started it up after a bunch of recent updates to the game. Lo and behold, the keyboard not working issue is now (((partially))) occurring in the game. I say partially because I can still utilize the keyboard to input searches or names for example, which is very odd, but no other interactions work.

I started to look at the updates to see what could have contributed to this. And I found this: https://store.steampowered.com/news/app/1465460/view/6493722191780118656

Engine update to Unity 6 - large improvement in stability and performance expected.

It seems as though however my setup interacts with the game, older versions of Unity work fine, and only newer versions are affected. I hope this helps someone narrow down this issue.

Sidefix avatar Dec 05 '24 17:12 Sidefix

This problem persists in the new version

zycbaby2008 avatar Jan 22 '25 12:01 zycbaby2008

MarkusFarfall avatar Feb 01 '25 16:02 MarkusFarfall

It seems this issue hasn't had any activity in the past 90 days. If it's still something you'd like addressed, please let us know by leaving a comment. Otherwise, to help keep our backlog tidy, we'll be closing this issue in 10 days. Thanks!

LizardByte-bot avatar May 11 '25 10:05 LizardByte-bot

It seems this issue hasn't had any activity in the past 90 days. If it's still something you'd like addressed, please let us know by leaving a comment. Otherwise, to help keep our backlog tidy, we'll be closing this issue in 10 days. Thanks!

This problem still exists, such as when playing VALORANT

zycbaby2008 avatar May 11 '25 11:05 zycbaby2008

Please try the beta version, there were recent changes to input on Linux.

If that doesn't work there is likely nothing we can do.

ReenigneArcher avatar May 11 '25 12:05 ReenigneArcher

Currently, the only stable way to bypass security checks through streaming is by using USB/IP, where the keyboard and mouse are treated as USB mappings to the remote host. However, many game manufacturers are increasing their efforts against cheating, such as Delta Force, so there is no good solution.

ambitiousCC avatar May 14 '25 01:05 ambitiousCC

As a very pleasant update, I have managed to get working keyboard results in games that previously didn't work at all, or just eventually stopped working.

I cannot confirm without a shadow of a doubt which of the following is/was the culprit, but let me set the stage with my full setup once more:

Ubuntu 24.04 up to date Sunshine v2025.514.173708 (latest at the time of writing) Headless ProtonGE-10.3 Nvidia graphics, 575 driver

With the above params, everything now works.

As a point of reference, ~2 months ago:

Ubuntu 24.04 up to date (at that time) Sunshine v(unknown exact version, but ~v2025.4xx.xxxxx) Headless ProtonGE-9-27 Nvidia graphics, 570 driver

With the above parameters, the symptomology was as initially described for a handful of games (Infection Free Zone most recently referenced).

In short, it could have been Proton, it could have been the new input libs in Sunshine, it could have even been an unidentified OS update in the interim, but everything now works. I still suspect some component from Sunshine to have been the cause, since the issue could never be reproduced when playing locally on the same machine.

Sidefix avatar May 20 '25 09:05 Sidefix

I suspect it was ultimately resolved by https://github.com/LizardByte/Sunshine/pull/3857

ReenigneArcher avatar May 20 '25 15:05 ReenigneArcher