ValveSoftware / steam-for-linux

Issue tracking for the Steam for Linux beta client
4.22k stars 174 forks source link

Gamepad (Switch Pro) uses Desktop Configuration while in-game #7570

Open borring opened 3 years ago

borring commented 3 years ago

Your system information

My issue is nearly identical with 6758 except their solution did not work for me.

Please describe your issue in as much detail as possible:

Expected Switch Pro Controller to be usable as a gamepad in games. What actually happens is that it works in desktop mode as well as big picture mode. However, once in-game, the overlay needs to be disabled for the game to receive any input from the controller.

Overlay can't be disabled in Big Picture mode, so that means the game is completely unresponsive in BPM. After disabling overlay and the controller starts working, I notice that the controls are still mapped according to Steam's Desktop Configuration, and not to some game profile configuration.

For example, I am using FFXV Demo (full gamepad support + PS4 controller profile) to test. When I start the game, I see a notification from Steam saying that PS4 configuration will be loaded (with icon of Switch Pro Controller). I expected the PS4 controls to be mapped onto the Switch Pro Controller. Instead, I get the Desktop Configuration (right trigger is left-click, etc..). The game tutorials also show mouse buttons and keyboard letters instead of controller buttons.

# sudo udevadm info /dev/input/js0

P: /devices/pci0000:00/0000:00:08.1/0000:0d:00.3/usb3/3-4/3-4.4/3-4.4:1.0/0003:057E:2009.0009/input/input32/js0
N: input/js0
L: 0
S: input/by-path/pci-0000:0d:00.3-usb-0:4.4:1.0-joystick
S: input/by-id/usb-Nintendo_Co.__Ltd._Pro_Controller_000000000001-joystick
E: DEVPATH=/devices/pci0000:00/0000:00:08.1/0000:0d:00.3/usb3/3-4/3-4.4/3-4.4:1.0/0003:057E:2009.0009/input/input32/js0
E: DEVNAME=/dev/input/js0
E: MAJOR=13
E: MINOR=0
E: SUBSYSTEM=input
E: USEC_INITIALIZED=7126000615
E: ID_INPUT=1
E: ID_INPUT_JOYSTICK=1
E: ID_VENDOR=Nintendo_Co.__Ltd.
E: ID_VENDOR_ENC=Nintendo\x20Co.\x2c\x20Ltd.
E: ID_VENDOR_ID=057e
E: ID_MODEL=Pro_Controller
E: ID_MODEL_ENC=Pro\x20Controller
E: ID_MODEL_ID=2009
E: ID_REVISION=0210
E: ID_SERIAL=Nintendo_Co.__Ltd._Pro_Controller_000000000001
E: ID_SERIAL_SHORT=000000000001
E: ID_TYPE=hid
E: ID_BUS=usb
E: ID_USB_INTERFACES=:030000:
E: ID_USB_INTERFACE_NUM=00
E: ID_USB_DRIVER=usbhid
E: ID_PATH=pci-0000:0d:00.3-usb-0:4.4:1.0
E: ID_PATH_TAG=pci-0000_0d_00_3-usb-0_4_4_1_0
E: ID_FOR_SEAT=input-pci-0000_0d_00_3-usb-0_4_4_1_0
E: FOO=hwdb 'mouse:usb:v057ep2009:name:Nintendo Co., Ltd. Pro Controller:'
E: DEVLINKS=/dev/input/by-path/pci-0000:0d:00.3-usb-0:4.4:1.0-joystick /dev/input/by-id/usb-Nintendo_Co.__Ltd._Pro_Controller_000000000001-joystick
E: TAGS=:seat:uaccess:

-- I've gone so far as to chown the device at some point just to be sure
# ls -l /dev/input/js0
crw-rw-r--+ 1 root input 13, 0 Dec 27 03:54 /dev/input/js0

# groups
wheel input

# ls -l /dev/uinput
crwxrwxrwx. 1 root root 10, 223 Dec 27 02:47 /dev/uinput
-- chmod for testing

-- Then to give full access to flatpak for everything in /dev/
# flatpak run --device=all com.valvesoftware.Steam 

When I press the Home btn (guide btn for steam) I see this in the log

Dec 27 12:31:19 navi.localdomain com.valvesoftware.Steam.desktop[34306]: Controller 0 PS4 Controller Configuration uses xinput : true
Dec 27 12:31:19 navi.localdomain com.valvesoftware.Steam.desktop[34306]: Loaded Config for Local Selection Path for App ID 413080, Controller 0: /var/home/username/.local/share/Steam/steamapps/workshop/content/241100/2337173984/1645468685088285545_legacy.bin
Dec 27 12:31:19 navi.localdomain com.valvesoftware.Steam.desktop[34306]: Controller 0 PS4 Controller Configuration uses xinput : true
Dec 27 12:31:19 navi.localdomain com.valvesoftware.Steam.desktop[34306]: OnFocusWindowChanged to window type: k_nGameIDControllerConfigs_Desktop, AppID 413080
Dec 27 12:31:19 navi.localdomain com.valvesoftware.Steam.desktop[34306]: Controller 0 PS4 Controller Configuration uses xinput : true
Dec 27 12:31:19 navi.localdomain com.valvesoftware.Steam.desktop[34306]: Loaded Config for Local Selection Path for App ID 413080, Controller 0: /var/home/username/.local/share/Steam/steamapps/workshop/content/241100/2337173984/1645468685088285545_legacy.bin
Dec 27 12:31:19 navi.localdomain com.valvesoftware.Steam.desktop[34306]: Controller 0 PS4 Controller Configuration uses xinput : true

Steps for reproducing this issue:

  1. Start Steam
  2. Plug Pro Controller in through USB
  3. Open game with gamepad support
borring commented 3 years ago

Update. I've re-enabled the Steam overlay and it is somehow working for FFXV Demo now.

Overlay settings are as follows:

To be clear, I already had the first option checked. But the game only accepted input from controllers when I turned off overlay. I tried again this morning with the same result (controller uses Desktop configuration). Then I decided to re-enable overlay. Now the game is accepting controller input AND the game UI buttons now match the Switch Pro controller buttons instead of showing kbd and mouse btns.

Unfortunately, the same configuration doesn't work with Trine. Having the overlay enabled still cuts off all input from the controller.

I've just tried with another game besides Trine, FFVIII with the same result as Trine. Here's what I see in the logs in both cases

Dec 27 14:36:18 navi.localdomain com.valvesoftware.Steam.desktop[36552]: Could not load local selection (/var/home/username/.local/share/Steam//controller_base/templates/controller_switch_pro_gamepad_fps.vdf), local override (/var/home/username/.local/share/Steam//controller_config/app_39150.vdf), or user path (/var/home/username/.local/share/Steam/userdata/48492577/config/controller_configs/app_39150.vdf), checking last resort path: /var/home/username/.local/share/Steam//controller_base/templates/controller_switch_pro_gamepad_joystick.vdf
Dec 27 14:36:18 navi.localdomain com.valvesoftware.Steam.desktop[36552]: Loaded Config for Last Resort Path for App ID 39150, Controller 0: /var/home/username/.local/share/Steam//controller_base/templates/controller_switch_pro_gamepad_joystick.vdf
Dec 27 14:36:18 navi.localdomain com.valvesoftware.Steam.desktop[36552]: Controller 0 Gamepad uses xinput : true
Dec 27 14:37:50 navi.localdomain com.valvesoftware.Steam.desktop[36552]: OnFocusWindowChanged to window type: k_nGameIDControllerConfigs_Desktop, AppID 413080
Dec 27 14:37:50 navi.localdomain com.valvesoftware.Steam.desktop[36552]: Controller 0 Gamepad uses xinput : true
Dec 27 14:37:50 navi.localdomain com.valvesoftware.Steam.desktop[36552]: Loaded Config for Local Selection Path for App ID 413080, Controller 0: /var/home/username/.local/share/Steam/steamapps/workshop/content/241100/2337173984/1645468685088285545_legacy.bin
Dec 27 14:37:50 navi.localdomain com.valvesoftware.Steam.desktop[36552]: Controller 0 Gamepad uses xinput : true

It looks like it loads gamepad configs, but the game still thinks I will be using mouse and kbd.

borring commented 3 years ago

Update: For games like Trine with generic gamepad support, it seems like input is cut off when the overlay (BPM) is enabled. Actually this was because the the gamepad configuration was loaded and the game could not properly use those signals. Since the game already assumes that the input is keyboard and mouse, then going into controller config and mapping the controller to kbd and mouse works.

This is odd since the game is advertised as having full controller support.