anyc / steam-overlay

Gentoo overlay for Valve's Steam client and Steam-based games
GNU General Public License v2.0
202 stars 44 forks source link

Elden Ring Controller Support Does Not Work #326

Closed gekret005 closed 1 year ago

gekret005 commented 1 year ago

I cannot get Elden Ring to work with a controller in Gentoo, while other games like death stranding seem to work fine. I can even boot into Opensuse Tumbleweed with the same home directory and then elden ring seems to work fine with controller. What exactly could my Suse system be doing differently that my Gentoo install doesn't seem to cover? EDIT: both systems have STEAM_RUNTIME=0

chewi commented 1 year ago

Did you install steam-launcher with USE=joystick? If you did, this would have pulled in games-util/game-device-udev-rules. This really needs to have USE=acl to work well.

What controller do you have?

gekret005 commented 1 year ago

Both ebuilds have those use flags applied, I'm trying to use a dualshock 4. I also tried adding my user to the input and usb groups which didn't change anything.

$ equery u steam-launcher game-device-udev-rules
[ Legend : U - final flag setting for installation]
[        : I - package is installed with flag     ]
[ Colors : set, unset                             ]
 * Found these USE flags for games-util/steam-launcher-1.0.0.74-r1:
 U I
 + + joystick     : Add support for joysticks in all packages
 - - steamruntime : Use the official steam runtime libraries
 + + udev         : Enable virtual/udev integration (device discovery, power and storage device support, etc)

 * Found these USE flags for games-util/game-device-udev-rules-20220311:
 U I
 + + acl     : Add support for Access Control Lists
 + + elogind : Enable session tracking via sys-auth/elogind
 - - systemd : Enable use of systemd-specific libraries and features like socket activation or session tracking
chewi commented 1 year ago

You need certain kernel options enabled like CONFIG_INPUT_UINPUT and CONFIG_HID_SONY. From Linux 6.2, you'll be able to use CONFIG_HID_PLAYSTATION instead of CONFIG_HID_SONY.

I'm assuming you're using USB rather than Bluetooth here, but either should be fine.

Watch for output in dmesg -w when you plug the device in. Paste that here.

"event" and "js" nodes should appear in /dev/input after you plug it in. You should be able to use evtest (from app-misc/evtest) with the event node and jstest (from games-util/joystick) with the js node.

gekret005 commented 1 year ago

Those 3 options are enabled as modules in my kernel using zen-sources 6.1.3

CONFIG_INPUT_UINPUT=m
CONFIG_HID_SONY=m
CONFIG_HID_PLAYSTATION=m

and yes I am using USB as I can't find a reliable bluetooth dongle to save my life, here's the dmesg output after plugging in the controller

[ 3300.295173] usb 3-5: new full-speed USB device number 4 using xhci_hcd
[ 3300.666937] usb 3-5: New USB device found, idVendor=054c, idProduct=09cc, bcdDevice= 1.00
[ 3300.666941] usb 3-5: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 3300.666942] usb 3-5: Product: Wireless Controller
[ 3300.666943] usb 3-5: Manufacturer: Sony Interactive Entertainment
[ 3300.797039] input: Sony Interactive Entertainment Wireless Controller Touchpad as /devices/pci0000:00/0000:00:02.1/0000:05:00.0/0000:06:0c.0/0000:0b:00.0/usb3/3-5/3-5:1.3/0003:054C:09CC.0024/input/input73
[ 3300.797121] input: Sony Interactive Entertainment Wireless Controller Motion Sensors as /devices/pci0000:00/0000:00:02.1/0000:05:00.0/0000:06:0c.0/0000:0b:00.0/usb3/3-5/3-5:1.3/0003:054C:09CC.0024/input/input74
[ 3300.849387] input: Sony Interactive Entertainment Wireless Controller as /devices/pci0000:00/0000:00:02.1/0000:05:00.0/0000:06:0c.0/0000:0b:00.0/usb3/3-5/3-5:1.3/0003:054C:09CC.0024/input/input72
[ 3300.849461] sony 0003:054C:09CC.0024: input,hidraw5: USB HID v81.11 Gamepad [Sony Interactive Entertainment Wireless Controller] on usb-0000:0b:00.0-5/input3

I was able to use both evtest and jstest successfully as I am able to play other games that are not elden ring with the controller just fine.

chewi commented 1 year ago

It all looks fine to me. My only remaining idea is that openSUSE doesn't have the hid-playstation driver yet. You could try disabling or blacklisting that.

chewi commented 1 year ago

By the way, the ASUS USB-BT500 works very well for me, although I've only used it with the Steam controller and Nintendo controllers. I've found it works best on the end of a USB extension cable rather than plugged directly into my desktop.

gekret005 commented 1 year ago

I just checked the config of the kernel my openSUSE was using and it had the 3 options enabled as modules aswell.... from what I can tell Elden Ring caused a lot of people headaches due to EAC getting the focus of steam input but I tried disabling EAC and it still wasn't working so I'm lost as to why this is the case still.

I'll see about ordering one of those bluetooth modules. I've just always tried 5-6 dollar ones which have issues with just remembering what I've paired to it. I guess you gotta pay a bit more for something that works.

chewi commented 1 year ago

EAC is a headache in general. No ideas left, sorry. I'll leave this open.

gekret005 commented 1 year ago

Ok I figured it out I had to mark /dev/uinput as readable by the user. Is there something that should be doing this automatically? Because I also had to mark /dev/fuse as rw by the user for appimages to work.

chewi commented 1 year ago

Aha. That shouldn't be necessary.

$ ls -l /dev/uinput 
crw-rw----+ 1 root root 10, 223 Jan  9 19:27 /dev/uinput

$ getfacl -p /dev/uinput
# file: /dev/uinput
# owner: root
# group: root
user::rw-
user:chewi:rw-
group::---
mask::rw-
other::---

I'm not sure, but you may need CONFIG_TMPFS_POSIX_ACL enabled in the kernel. If it's not that, what desktop do you use, and how do you log into it? Have you disabled PAM?

gekret005 commented 1 year ago

yeah I have CONFIG_TMPFS_POSIX_ACL=y in my kernel, I'm using a mix of i3 and sway. I start sway with dbus-run-session sway and i3 with startx with exec dbus-launch --exit-with-session i3 in .xinitrc. PAM should be at the defaults.

chewi commented 1 year ago

Do you have elogind enabled at boot?

sudo rc-update add elogind boot

What does loginctl show?

$ loginctl
SESSION  UID USER  SEAT  TTY 
     c3  126 sddm  seat0     
     c4 1000 chewi seat0 tty8

2 sessions listed.
gekret005 commented 1 year ago

elogind is at boot

# rc-update
               binfmt | boot                                   
             bootmisc | boot                                   
              cgroups |                                 sysinit
              chronyd |      default                           
               cronie |      default                           
                 dbus |      default                           
                devfs |                                 sysinit
               dhcpcd |      default                           
                dmesg |                                 sysinit
              elogind | boot                                   
                 fsck | boot                                   
          grub-btrfsd |                                 sysinit
             hostname | boot                                   
              hwclock | boot                                   
              keymaps | boot                                   
            killprocs |                        shutdown        
    kmod-static-nodes |                                 sysinit
                local |      default nonetwork                 
           localmount | boot                                   
             loopback | boot                                   
              modules | boot                                   
             mount-ro |                        shutdown        
                 mtab | boot                                   
             netmount |      default                           
               procfs | boot                                   
                 root | boot                                   
         save-keymaps | boot                                   
    save-termencoding | boot                                   
            savecache |                        shutdown        
              seedrng | boot                                   
                 sshd |      default                           
                 swap | boot                                   
               sysctl | boot                                   
                sysfs |                                 sysinit
             sysklogd |      default                           
 systemd-tmpfiles-setup | boot                                   
 systemd-tmpfiles-setup-dev |                                 sysinit
         termencoding | boot                                   
                 udev |                                 sysinit
         udev-trigger |                                 sysinit

here's loginctl from ssh

SESSION  UID USER  SEAT  TTY  
      6 1000 loser seat0 tty1 
      8 1000 loser       pts/1

2 sessions listed.
chewi commented 1 year ago

Damn, talk about an elusive issue. Can you run ls -l and getfacl -p on /dev/uinput like I did? That will show if ACLs are working at all.

gekret005 commented 1 year ago
ls -l /dev/uinput /dev/fuse && getfacl -p /dev/uinput /dev/fuse
crw------- 1 root root 10, 229 Jan 14 13:18 /dev/fuse
crw------- 1 root root 10, 223 Jan 14 13:18 /dev/uinput
# file: /dev/uinput
# owner: root
# group: root
user::rw-
group::---
other::---

# file: /dev/fuse
# owner: root
# group: root
user::rw-
group::---
other::---

They don't appear to be. I'm using btrfs and I have't specified -acl as a flag anywhere this should be working automatically since I have those udev rules right? Unless udev itself isn't working.

chewi commented 1 year ago

btrfs won't matter here, as /dev should be a devtmpfs. Double check that with mount.

udev doesn't appear to be working. You should have /lib/udev/rules.d/99-fuse.rules installed by sys-fs/fuse-common:

KERNEL=="fuse", MODE="0666"

The uinput rule needs ACLs, but this one doesn't, so we can rule out anything ACL-related. Are you using udev or eudev? Either should work anyhow. I can't think how it could be broken, normally it just works. I have seen you have the udev and udev-trigger services in sysinit as you should. Do you use an initramfs?

gekret005 commented 1 year ago

devtmpfs is mounted

$ mount|grep -i devtmpfs
devtmpfs on /dev type devtmpfs (rw,nosuid,noexec,size=10240k,nr_inodes=3962182,mode=755,inode64)

sys-fs/fuse-common is installed

$ cat  /lib/udev/rules.d/99-fuse.rules
KERNEL=="fuse", MODE="0666"

I have sys-apps/systemd-utils, as was pulled in by default, and I do indeed use an initramfs generated with dracut.

$ ls -a /boot/
.  ..  .keep  System.map-6.1.4-zen2  amd-uc.img  config-6.1.4-zen2  efi  grub  initramfs-6.1.4-zen2.img  vmlinuz-6.1.4-zen2

I have included my kernel .config but it's just taken from what arch uses for their linux-zen package ran throught make olddefconfig then with -march=native turned on.
config.txt

gekret005 commented 1 year ago

I may have gotten a hint that can lead us to figuring out the udev mystery I need to restart it TWICE to apply the uinput rules. first boot:

# ls -l /dev/uinput /dev/fuse && getfacl -p /dev/uinput /dev/fuse
crw------- 1 root root 10, 229 Jan 17 14:48 /dev/fuse
crw------- 1 root root 10, 223 Jan 17 14:48 /dev/uinput
# file: /dev/uinput
# owner: root
# group: root
user::rw-
group::---
other::---

# file: /dev/fuse
# owner: root
# group: root
user::rw-
group::---
other::---

first udev restart the fuse rule is applied:

# ls -l /dev/uinput /dev/fuse && getfacl -p /dev/uinput /dev/fuse
crw-rw-rw- 1 root root 10, 229 Jan 17 14:50 /dev/fuse
crw------- 1 root root 10, 223 Jan 17 14:50 /dev/uinput
# file: /dev/uinput
# owner: root
# group: root
user::rw-
group::---
other::---

# file: /dev/fuse
# owner: root
# group: root
user::rw-
group::rw-
other::rw-

second udev restart this restart kills x11 and the uinput rule is now applied:

#ls -l /dev/uinput /dev/fuse && getfacl -p /dev/uinput /dev/fuse
crw-rw-rw-  1 root root 10, 229 Jan 17 14:50 /dev/fuse
crw-rw----+ 1 root root 10, 223 Jan 17 14:50 /dev/uinput
# file: /dev/uinput
# owner: root
# group: root
user::rw-
user:loser:rw-
group::---
mask::rw-
other::---

# file: /dev/fuse
# owner: root
# group: root
user::rw-
group::rw-
other::rw-

I don't have any custom udev rules written all of my rules come from installed ebuilds.

# ls -a /lib/udev/rules.d/
.                                 70-joystick.rules                  77-mm-simtech-port-types.rules
..                                70-memory.rules                    77-mm-telit-port-types.rules
10-dm.rules                       70-mouse.rules                     77-mm-tplink-port-types.rules
13-dm-disk.rules                  70-power-switch.rules              77-mm-ublox-port-types.rules
40-gentoo.rules                   70-touchpad.rules                  77-mm-x22x-port-types.rules
50-udev-default.rules             70-uaccess.rules                   77-mm-zte-port-types.rules
60-autosuspend.rules              71-seat.rules                      78-sound-card.rules
60-block.rules                    73-seat-late.rules                 80-drivers.rules
60-cdrom_id.rules                 75-net-description.rules           80-libinput-device-groups.rules
60-drm.rules                      75-probe_mtd.rules                 80-mm-candidate.rules
60-evdev.rules                    77-mm-broadmobi-port-types.rules   80-net-setup-link.rules
60-fido-id.rules                  77-mm-cinterion-port-types.rules   80-stelladaptor-joystick.rules
60-game-input.rules               77-mm-dell-port-types.rules        80-udisks2.rules
60-game-vr.rules                  77-mm-dlink-port-types.rules       81-net-dhcp.rules
60-input-id.rules                 77-mm-ericsson-mbm.rules           84-nm-drivers.rules
60-persistent-alsa.rules          77-mm-fibocom-port-types.rules     85-nm-unmanaged.rules
60-persistent-input.rules         77-mm-foxconn-port-types.rules     85-regulatory.rules
60-persistent-storage-tape.rules  77-mm-gosuncn-port-types.rules     90-libinput-fuzz-override.rules
60-persistent-storage.rules       77-mm-haier-port-types.rules       90-network.rules
60-persistent-v4l.rules           77-mm-huawei-net-port-types.rules  90-nm-thunderbolt.rules
60-sensor.rules                   77-mm-linktop-port-types.rules     90-pipewire-alsa.rules
60-serial.rules                   77-mm-longcheer-port-types.rules   95-dm-notify.rules
61-kde-bluetooth-rfkill.rules     77-mm-mtk-port-types.rules         96-e2scrub.rules
64-btrfs-dm.rules                 77-mm-nokia-port-types.rules       97-hid2hci.rules
64-btrfs-zoned.rules              77-mm-qcom-soc.rules               99-fuse.rules
64-btrfs.rules                    77-mm-quectel-port-types.rules
70-camera.rules                   77-mm-sierra.rules
# ls -a /etc/udev/rules.d/
.  ..  .keep_sys-apps_systemd-utils-0

EDIT: Since this is a system issue I have made a posting to the mailing list https://archives.gentoo.org/gentoo-user/message/99ecdb99f4b22b337475344174427f27 EDIT2: udev doctors are in short supply https://forums.gentoo.org/viewtopic-p-8772221.html

gekret005 commented 1 year ago

I figured it out thanks to help from the forums, having uinput and fuse as modules leads to the rules not getting triggered till the module is manually loaded. I suppose most people on gentoo build CONFIG_FUSE_FS and CONFIG_INPUT_UINPUT as y instead of m. https://forums.gentoo.org/viewtopic-p-8772411.html#8772411

chewi commented 1 year ago

Ah, nice work! That did cross my mind but I thought that the udev trigger would happen after the modules were loaded. Glad you got there in the end.

gekret005 commented 1 year ago

Yeah, I was going crazy, but now I understand more about how these triggers work. Thanks for your help earlier.