LizardByte / Sunshine

Self-hosted game stream host for Moonlight.
http://app.lizardbyte.dev/Sunshine/
GNU General Public License v3.0
16.09k stars 777 forks source link

[Linux] Keyboard not working in several games #2614

Open Sidefix opened 1 month ago

Sidefix commented 1 month ago

Is there an existing issue for this?

Is your issue described in the documentation?

Is your issue present in the latest beta/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":"/home/u/sunshine/configs/killSunshine.sh"}]
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 commented 1 month ago

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.

gschintgen commented 1 month ago

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).

ReenigneArcher commented 1 month ago

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

Sidefix commented 1 month ago

@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?

gschintgen commented 1 month ago

@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.)