ValveSoftware / steam-for-linux

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

Linux Kernel 4.18 + steam controller causes problems for various game (f.i.Rocket League) #5645

Closed fosspill closed 5 years ago

fosspill commented 6 years ago

Your system information

Please describe your issue in as much detail as possible:

Let's take Rocket League as a specific example as that's where I cannot find a workaround for it:

Expected result: Start Rocket League, start steam controller (in either order), play the game with the steam controller.

Actual result: Steam controller can only control secondary player, as it somehow seems to see the controller as multiple devices and gets confused. (I believe this can also be seen in Sega Megadrive as the steam controller had to be explicitly chosen, even with no other controllers plugged in.)

Steps for reproducing this issue:

  1. Upgrade to kernel 4.18
  2. Play Rocket League
  3. Be unable to control your car

Notes:

Other controllers works fine. Xbox 360 and PS4 controllers through steam is not causing any issues.

Workaround:

Downgrade to kernel 4.17

I realize this might not be the correct place to report this, but as it's very much related to the steam for linux product I couldn't think of a better place.

kisak-valve commented 6 years ago

Possibly hid-steam related.

fosspill commented 6 years ago

Indeed, other controllers works fine, including xbox 360 and the dualshock controllers :)

This is about the steam controller though

nstgc commented 6 years ago

I have not had this problem with the Steam Controller. I have others, but not this one. Are there other games for which this is a problem? I'd rather not install a game just to test a single bug.

I'm on Arch by the way.

fosspill commented 6 years ago

So far Rocket League is the game that we've had 100% reproduction on all systems tested on (4 so far). I have however seen other games (sega megadrive, for instance) show the steam controller as multiple controllers, where I had to manually pick the correct one for it to work.

Note: Downgrading to 4.17 fixes the issue. Using sc-controller also works around the issue.

aqxa1 commented 6 years ago

You can also just blacklist the hid_steam module (how you do this may vary from distro to distro) if you need 4.18.x.

fosspill commented 6 years ago

Hm, alright. But, if this is a hid_steam error, where do we properly report it to get it fixed?

aldrik commented 6 years ago

I've also been having this issue since performing a system update. Blacklisting hid_steam does indeed get the controller working correctly again in Rocket League.

jpotier commented 6 years ago

Blacklisting hid_steam does not fix the problem for me.

My problem is that the steam controller is considered to be a mouse/keyboard by Rocket League.

aldrik commented 6 years ago

Side note of blacklisting hid_steam, when also when connected using a cable you get some debug frame data displayed.

@jpotier that's a different issue. Sounds like it could be user permissions: https://steamcommunity.com/app/353370/discussions/0/490123197956024380/

jpotier commented 6 years ago

Unfortunately, those are properly set on my system :(

ghost commented 6 years ago

Same here on 4.18, I couldn't get my Steam controller to work unless I blacklisted the new driver in /etc/modprobe.d/steam_hid_blacklist.conf:

blacklist hid_steam

You can test if this worked with lsmod | grep steam -- if it's empty, the hid_steam driver is not loaded. Rocket league works just fine in steam-native on Arch, no debug data, no issues with invites or parties.

In addition, I also had to edit my /usr/lib/udev/rules.d/70-steam-input.rules to change all instances of MODE="0660" to MODE="0666", and add MODE="0666" to the first KERNEL=="uinput" line where it's missing. 70-steam-input.rules.patch.txt

Once the driver was blacklisted & these changes were made, my controller finally worked.

Jibodeah commented 6 years ago

Hollow Knight is also affected. The game crashes when a Steam Controller is connected. Works when the hid_steam module is removed from the kernel.

diegogangl commented 6 years ago

I'm having this issue with Hollow Knight too. Removing the module from the kernel and changing the udev rules haven't fixed it for me. I'm running 4.18.9. Setting /dev/uinput permissions to 666 doesn't work either.

zakora commented 6 years ago

Also had this problem for both Rocket League and Hollow Knight. Keeping my udev as is (see below), not changing the permissions, and just issuing sudo modprobe -r hid_steam before launching the games make them work with a Steam Controller for me.

System info:

/etc/udev/rules.d/99-steam-controller.rules content:

# This rule is needed for basic functionality of the controller in Steam and keyboard/mouse emulation
SUBSYSTEM=="usb", ATTRS{idVendor}=="28de", MODE="0666"
# This rule is necessary for gamepad emulation
KERNEL=="uinput", MODE="0660", GROUP="input", OPTIONS+="static_node=uinput"
# DualShock 4 wired
SUBSYSTEM=="usb", ATTRS{idVendor}=="054c", ATTRS{idProduct}=="05c4", MODE="0666"
# DualShock 4 wireless adapter
SUBSYSTEM=="usb", ATTRS{idVendor}=="054c", ATTRS{idProduct}=="0ba0", MODE="0666"
# DualShock 4 slim wired
SUBSYSTEM=="usb", ATTRS{idVendor}=="054c", ATTRS{idProduct}=="09cc", MODE="0666"
# Valve HID devices over USB hidraw
KERNEL=="hidraw*", ATTRS{idVendor}=="28de", MODE="0666"
# Valve HID devices over bluetooth hidraw
KERNEL=="hidraw*", KERNELS=="*28DE:*", MODE="0666"
# DualShock 4 over bluetooth hidraw
KERNEL=="hidraw*", KERNELS=="*054C:05C4*", MODE="0666"
# DualShock 4 Slim over bluetooth hidraw
KERNEL=="hidraw*", KERNELS=="*054C:09CC*", MODE="0666"
rodrigorc commented 5 years ago

Hi! I'm the original writer of the hid-steam Linux driver. I'm sorry you are having issues with it.

I have written a patch that should fix all your problems with this driver. You can get it here. It would be great if some of you can test it and give feedback.

If you want to try it but you don't know how to patch and compile a kernel driver, just drop me a few lines and I will gladly give you instructions.

zakora commented 5 years ago

Hi @rodrigorc , and thanks for your work on hid-steam!

I tried your patch but without success. This was the first time I tinkered with the linux kernel so I am by no mean an expert. Maybe I just didn't apply the patch correctly.

Here is a small write up of the steps I did, in case this helps.

System info:

Steps (mostly followed the Arch wiki):

Things I tried but failed:

rodrigorc commented 5 years ago

Hi, @zakora!

First of all, you should not use the stock kernel sources when compiling a module for your system, you should instead use the sources provided by your distribution. That may work with Arch, that uses a vanilla kernel, but not so much for Fedora, that has a lot of patches.

My advice is to do as follows:

  1. Download, extract and patch the kernel as you did, but do not enter that directory (no cd linux-4.18.13).
  2. Create a new directory in your HOME and enter it: $ mkdir steamdrv; cd steamdrv
  3. Copy the patched hid-steam.c from the patched kernel source, and hid-ids.h: $ cp .../linux-4.18.13/drivers/hid/{hid-steam.c,hid-ids.h} .
  4. Create a one line Makefile in this directory: $ echo 'obj-m += hid-steam.o' > Makefile
  5. Compile the module using the Fedora kernel headers: $ make -C /lib/modules/uname -r/build M=$(pwd)

Now, in order to test it easily without compromising your installation the easiest way is to unload the stock module and load your patched one, running these commands as root:

modprobe -r hid-steam

insmod hid-steam.ko

Note that insmod does not look for the module in the system directories but in the current one, so you'll load the one you just compiled.

It it work, great! let us know. If it fails or hangs your computer, can you attach a dmesg output?

Thanks!

zakora commented 5 years ago

Thanks for detailed instructions @rodrigorc , it works now!

Some changes that I did:

Confirmed to work for me on both Rocket League and Hollow Knight using a Steam Controller.

rodrigorc commented 5 years ago

You are right on both corrections, @zakora, I'll edit the above instructions, in case anybody else wants to test it.

Thank you so much for testing it! I will add this success test to the LKML thread.

saintdev commented 5 years ago

@rodrigorc Just wanted to say this fixed the issue I was having with hid-steam and Rocket League as well!

nanonyme commented 5 years ago

Has anyone created a ticket on hid-steam against kernel bugzilla?

rodrigorc commented 5 years ago

Has anyone created a ticket on hid-steam against kernel bugzilla?

@nanonyme Well, there is one ticket now.

rodrigorc commented 5 years ago

It looks like this patch has been back ported to Linux 4.19.

zakora commented 5 years ago

I can confirm.

It was not working with kernel up to 4.19.5. I upgraded to kernel 4.19.6 and it now works out of the box.

tvannahl commented 5 years ago

I have now more trouble with hid_steam after an upgrade to 4.19.9 on two independent machines, one running Arch Linux/Nvidia-Drivers/Ryzen and another running Fedora 29/Nvidia-Drivers/Ryzen.

To be able to use the Steam Controller it sometimes helps to rmmod hid_steam and modprobe hid_steam. Last time seemed to help only on my Fedora, so the Issue could be unrelated to the seemingly workaround.

nyanloutre commented 5 years ago

Still having issues in Rocket League with kernel 4.19.13

rodrigorc commented 5 years ago

@nyanloutre I'd like to look into it, but I'll need a bit more information... What are the issues, exactly? Does rmmod hid_steam change anything? Can you attach the some relevant piece of dmesg output?

nyanloutre commented 5 years ago

The issue I get is that the controller is detected as the 2nd player. I will try your suggestion and send a relevant dmesg log when I come back home.

rodrigorc commented 5 years ago

@nyanloutre: RocketLeague has weird heuristics to decide which one is "gamepad 1" and which one is "gamepad 2". Please, check if you have any other gadget that may look like a game controller. If you could get the output of lsinput or similar tool while the game is running, that would be really great.

Also, it would be helpful if you can do rmmod hid_steam with the Steam client closed and rerun the game, check whether it works now, and if you can, rerun lsinput to compare with the previous one.

daedalao commented 5 years ago

So, this is what happens when I use my steam controller in rocket league. It does not work at all unless I enable the beta steam input options, however it only works in the menus. It will not switch to the other modes. I just got this today, so please guide me in a solution. I could attempt to remove the xbox 360 pad portion from xpad.c ?

`/dev/input/event18 bustype : BUS_USB vendor : 0x28de product : 0x1102 version : 273 name : "Valve Software Wired Controller" phys : "usb-0000:0b:00.0-2/input0" uniq : "" bits ev : (null) (null) (null) (null) (null)

/dev/input/event19 bustype : BUS_USB vendor : 0x28de product : 0x1102 version : 273 name : "Valve Software Wired Controller" phys : "usb-0000:0b:00.0-2/input1" uniq : "" bits ev : (null) (null) (null) (null)

/dev/input/event20 bustype : BUS_USB vendor : 0x28de product : 0x11ff version : 1 name : "Microsoft X-Box 360 pad" bits ev : (null) (null) (null) `

Edit: Apparently, Ubuntu 18.10 is all around just not a distribution I should be using. I switched to Ubuntu 18.10 from Lubuntu 18.10, no change. Switched to 4.20 kernel using Ukuu, no change. Blacklisted steam_hid no change. I have no way to use my steam controller in rocket league right now. I am going to attempt Manjaro today.

nyanloutre commented 5 years ago

uname Linux paul-fixe 4.19.14 #1-NixOS SMP Wed Jan 9 16:38:50 UTC 2019 x86_64 GNU/Linux

@rodrigorc rmmod hid_steam doesn't help. Here is the lsinput I got:

with hid_steam

 0: 0000:0000 (null) ALSA             HDA NVidia HDMI/DP,pcm=3 SW              
 1: 0000:0001 HOST   PNP0C0C/button/i Power Button             KEY             
 2: 0000:0001 HOST   LNXPWRBN/button/ Power Button             KEY             
 3: 0000:0000 (null) ALSA             HDA Intel PCH Front Mic  SW              
 4: 0000:0000 (null) ALSA             HDA Intel PCH Rear Mic   SW              
 5: 0000:0000 (null) ALSA             HDA Intel PCH Line       SW              
 6: 0000:0000 (null) ALSA             HDA Intel PCH Line Out F SW              
 7: 0000:0000 (null) ALSA             HDA Intel PCH Line Out S SW              
 8: 0000:0000 (null) ALSA             HDA Intel PCH Line Out C SW              
 9: 0000:0000 (null) ALSA             HDA Intel PCH Line Out S SW              
10: 0000:0000 (null) ALSA             HDA Intel PCH Front Head SW              
11: 28de:1142 USB    usb-0000:00:1d.0 Valve Software Steam Con KEY REL MSC LED 
12: 1e7d:2d5a USB    usb-0000:00:1d.0 ROCCAT ROCCAT Savu       KEY REL ABS MSC 
13: 1e7d:2d5a USB    usb-0000:00:1d.0 ROCCAT ROCCAT Savu       KEY MSC LED     
14: 1b1c:1b09 USB    usb-0000:00:1d.0 Corsair Corsair K70R Gam KEY MSC LED     
15: 1b1c:1b09 USB    usb-0000:00:1d.0 Corsair Corsair K70R Gam KEY REL ABS MSC 
16: 0000:0000 (null) ALSA             HDA NVidia HDMI/DP,pcm=7 SW              
17: 0000:0000 HOST   eeepc-wmi/input0 Eee PC WMI hotkeys       KEY MSC         
18: 0000:0000 (null) ALSA             HDA NVidia HDMI/DP,pcm=8 SW              
19: 0000:0000 (null) ALSA             HDA NVidia HDMI/DP,pcm=9 SW              
20: 1b1c:1b09 USB    usb-0000:00:1d.0 Corsair Corsair K70R Gam KEY MSC         
21: 28de:11ff USB                     Microsoft X-Box 360 pad  KEY ABS 

without hid_steam:

 0: 0000:0000 (null) ALSA             HDA NVidia HDMI/DP,pcm=3 SW              
 1: 0000:0001 HOST   PNP0C0C/button/i Power Button             KEY             
 2: 0000:0001 HOST   LNXPWRBN/button/ Power Button             KEY             
 3: 0000:0000 (null) ALSA             HDA Intel PCH Front Mic  SW              
 4: 0000:0000 (null) ALSA             HDA Intel PCH Rear Mic   SW              
 5: 0000:0000 (null) ALSA             HDA Intel PCH Line       SW              
 6: 0000:0000 (null) ALSA             HDA Intel PCH Line Out F SW              
 7: 0000:0000 (null) ALSA             HDA Intel PCH Line Out S SW              
 8: 0000:0000 (null) ALSA             HDA Intel PCH Line Out C SW              
 9: 0000:0000 (null) ALSA             HDA Intel PCH Line Out S SW              
10: 0000:0000 (null) ALSA             HDA Intel PCH Front Head SW              
11: 28de:1142 USB    usb-0000:00:1d.0 Valve Software Steam Con KEY MSC LED     
12: 1e7d:2d5a USB    usb-0000:00:1d.0 ROCCAT ROCCAT Savu       KEY REL ABS MSC 
13: 1e7d:2d5a USB    usb-0000:00:1d.0 ROCCAT ROCCAT Savu       KEY MSC LED     
14: 1b1c:1b09 USB    usb-0000:00:1d.0 Corsair Corsair K70R Gam KEY MSC LED     
15: 1b1c:1b09 USB    usb-0000:00:1d.0 Corsair Corsair K70R Gam KEY REL ABS MSC 
16: 0000:0000 (null) ALSA             HDA NVidia HDMI/DP,pcm=7 SW              
17: 0000:0000 HOST   eeepc-wmi/input0 Eee PC WMI hotkeys       KEY MSC         
18: 0000:0000 (null) ALSA             HDA NVidia HDMI/DP,pcm=8 SW              
19: 0000:0000 (null) ALSA             HDA NVidia HDMI/DP,pcm=9 SW              
20: 1b1c:1b09 USB    usb-0000:00:1d.0 Corsair Corsair K70R Gam KEY MSC         
21: 28de:1142 USB    usb-0000:00:1d.0 Valve Software Steam Con KEY REL MSC     
22: 28de:11ff USB                     Microsoft X-Box 360 pad  KEY ABS

Both output are the same with the game started or not

rodrigorc commented 5 years ago

@nyanloutre Thanks for the info.

Both output are the same with the game started or not

I actually meant with the "Steam Client" running / not running (not even in background). The game itself is not so important.

But I don't think it matters too much, I don't think your issues are related to hid_steam at all. The fact that removing the driver does not change anything suggests it.

Maybe Santa brought you a new game keyboard and mouse? Linux has weird heuristics to determine if an input device is game-paddy enough to deserve a /dev/input/js* device. Something related to the number of absolute axes, I think. And when you have more than one game-pad, Rocket Leage goes nuts.

From your output above, these devices have absolute axes and might look like game-pads:

12: 1e7d:2d5a USB    usb-0000:00:1d.0 ROCCAT ROCCAT Savu       KEY REL ABS MSC 
15: 1b1c:1b09 USB    usb-0000:00:1d.0 Corsair Corsair K70R Gam KEY REL ABS MSC 
22: 28de:11ff USB                     Microsoft X-Box 360 pad  KEY ABS

The 22 is obviously the virtual input device created by the Steam Client. The other two are your mouse and keyboard. I'd bet that one of them is acting as a game-pad. You can see that by running:

ls /dev/input/js*

If you see more than one, there it is. You can try the jstest-gtk tool to discover the details.

If I'm right you can avoid creating the /dev/input/js* device with a but of udev magic, such as here.

HTH

nyanloutre commented 5 years ago

So you are right about the keyboard messing with the joysticks, Rocket League is working normaly if I remove it.

But it's not a new keyboard and it was working with previous kernels (maybe a new driver related to this keyboard ?)

rodrigorc commented 5 years ago

Maybe the Corsair driver learned new tricks and now it creates absolute axes, maybe you recorded some new macros, maybe the USB system enumerate the devices in a different order.

Or maybe you have some udev persistent.rules file somewhere that messes things. That is hard to know. The only sure fact is that RL handling of gamepads is quite buggy.

nyanloutre commented 5 years ago

@rodrigorc anyway thanks for the help, now that I know what to search I should be able to find a solution myself

EDIT Working udev rule:

SUBSYSTEM=="usb", ATTR{bInterfaceNumber}=="00", ATTRS{idVendor}=="1b1c", ATTRS{idProduct}=="1b09", RUN+="/bin/sh -c '/bin/echo -n %k > /sys${DEVPATH}/driver/unbind'"
kisak-valve commented 5 years ago

Friendly heads up that the fix landed in cosmic-proposed and when https://launchpad.net/ubuntu/+source/linux/4.18.0-14.15 goes mainline I'm going to consider this issue resolved as 4.18 is EOL'd and Ubuntu should be the only major distro that will be sticking with it for an extended time.

If you're having a steam controller issue and blacklisting hid-steam didn't have an effect, then it is highly unlikely to be related to the issue tracked here.

Thanks for triaging this issue @rodrigorc.

tatsujb commented 5 years ago

Hey all!

please help me understand how to blacklist hid-steam and what kernel version I'm supposed to have.

it isn't clear from all of the above.

I have ubuntu with

uname -r
4.18.0-13-generic
rodrigorc commented 5 years ago

Hi, @tatsujb.

Please take a look at this to know more about blacklisting.

TL;DR; just add a file /etc/modprobe.d/hidsteam.conf with the line:

blacklist hid_steam

and you are done. You may need to restart or unload the module manually if it is already loaded (modprobe -r hid_steam).

tatsujb commented 5 years ago

@rodrigorc I blacklisted successfully but I still get no input in rocket league, is my kernel (4.18.0-13-generic) really an issue?

rodrigorc commented 5 years ago

@tatsujb It is most likely an issue with RocketLeague, that gets confused when there is more than one device that look like a gamepad. Changing the kernel probably changes something in the device enumerator that changes the RL heuristics.

You can check your input devices with ls /dev/input/js*, lsinput or jstest-gtk, as commented previously in this thread.

As a last resort you can delete manually all devices with rm /dev/input/js*, then reconnect your gamepad to recreate its device node. This way there will be only one.

tatsujb commented 5 years ago

@rodrigorc I checked with lsinput and indeed there was an extra device named xbox controller.

I deleted that and tried again, it didn't work.

I unplugged everything except the keyboard, ran the delete everything command, then unplugged the keyboard too then plugged in the steam controller and launched the game using it, and is still didn't work.

it's really weird because as soon as rocket league is running the steam controller looses all input, even on the desktop.

the cursor just stays stuck on the "play" button in steam where it was.

and only regains mobility on desktop once the loader screen for RL disappears and the RL app goes into fullscreen. at that point you can alt-tab to the desktop where it works again.

but alt tab back into the game and any input is dead once again.

rodrigorc commented 5 years ago

@tatsujb Actually the "XBox Controller" is the real one that you want to keep. It is a virtual controller created by Steam and where your SteamController is actually mapped into. So you should delete all the js* devices but this one.

Anyway, this is going way offtopic, as it doesn't look related to hid_steam at all. If you wish you can send me a PM and we will dig deeper into your issue.

tatsujb commented 5 years ago

In new version of Rocket League you have to first navigate to input options via another means than the steam controller then turn on the beta steam controller option. then you can restart RL using the steam controller and with keyboard and mice unplugged and it will correctly be detected.

kisak-valve commented 5 years ago

Ubuntu's 4.18.0-14.15 kernel has gone out to users.

Closing as resolved.

DocMAX commented 4 months ago

Big problem here. Steam does not detect the internal steam controller anymore. On load somehow /dev/hidraw2 get's lost and i have to add with: echo "3-3:1.2" > /sys/bus/usb/drivers/usbhid/bind I have no clue why this is happening.. :-( I'm on vanilla Arch Linux here.