Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add detection of upcoming hid-nintendo joy-con/pro controller kernel driver #6651

Open
DanielOgorchock opened this issue Nov 6, 2019 · 51 comments

Comments

@DanielOgorchock
Copy link

DanielOgorchock commented Nov 6, 2019

Your system information

  • Steam client version (build number or date): Nov. 5, 2019
  • Distribution (e.g. Ubuntu): Arch
  • Opted into Steam client beta?: Yes
  • Have you checked for system updates?: Yes

Please describe your issue in as much detail as possible:

The hid-nintendo kernel driver (for nintendo switch pro controllers and joy-cons) is currently in review in the linux-input mailing list with the possibility of being merged in the 5.8 merge window. Right now, steam uses hidraw to implement its own userspace driver (which I believe currently actually has a bit more functionality than the kernel driver, since it has gyro support). This leads to Steam fighting with the kernel over control of the device, and it leads to spastic behavior.

The kernel driver sets the most significant bit of the evdev's version number to allow userspace applications (e.g. sdl2, steam, etc.) to discern hid-nintendo from the default hid device. It would be nice if Steam could choose not to use hidraw when it sees that hid-nintendo is in use to avoid the conflict. As a work around I've been running steam with firejail to restrict its access to hidraw.

I am open to other suggestions for what I can do in the kernel driver to facilitate it and Steam playing nicely.

Thanks!

Steps for reproducing this issue:

  1. Load the hid-nintendo kernel module
  2. Plug in nintendo switch pro controller
  3. Watch steam and the kernel fight each other over the controller
@ZLima12
Copy link

ZLima12 commented Jan 27, 2020

Anyone know the status of this kernel driver? I haven't been able to find any activity on it since last October.

@DanielOgorchock
Copy link
Author

@ZLima12 Here is my latest submission to the mailing list: https://www.spinics.net/lists/linux-input/msg65088.html

There are some changes to the driver I still need to make (mostly involving the accel/gyro support).

@clarfonthey
Copy link

Hi, the driver has been accepted for Linux 5.10 and it would be nice to at least make sure that the Steam implementation doesn't conflict with the hid-nintendo module.

@clarfonthey
Copy link

Linux 5.10 is coming out very soon and this is still an issue.

@nin-tin
Copy link

nin-tin commented Dec 14, 2020

Linux kernel 5.10 (just now installed it on my system) is out and this is still not fixed. Please please please, valve, can you get steam to detect the switch pro controller without conflicts with the kernel driver. I don't know that much about programming but considering all other fantastic things you've achieved for linux gaming, surely this little tiny issue can not be that complicated? Many thanks.

@ZLima12
Copy link

ZLima12 commented Dec 15, 2020

Perhaps the steam client can run modinfo hid-nintendo. This command will produce a non-zero exit status if the module can't be found. If it does this, the steam client may use it's own driver. Otherwise, the kernel driver should be loaded automatically when a controller is connected.

@clarfonthey
Copy link

Whatever is implemented will ultimately be temporary since 5.10 is the new LTS kernel.

@ZLima12
Copy link

ZLima12 commented Dec 17, 2020

@clarfonthey unfortunately, hid-nintendo didn't make it into 5.10. So anyone on LTS is not going to have it.

@clarfonthey
Copy link

Oh. :(

Well, either way, I do think that this would be appropriate to implement. If anything, Steam should be compatible with the module.

@ZLima12
Copy link

ZLima12 commented Dec 20, 2020

Absolutely. I've been using hid-nintendo for a month or two now and it works great. Plug and play for a lot of (most?) games, particularly those that use SDL. Don't have any complaints about it. Having the Steam client use it when available would by far be the preferred behavior.

@clarfonthey
Copy link

Does Valve have any plan to prioritise this?

@bernharl
Copy link

Would be nice to get a response from Valve.

@FichteFoll
Copy link

I have problems getting a pro controller to work and I am not sure where I should report my problem. What's the current status of hid-nintendo? Is it in the kernel by now? Is what I experience a result of the conflict?

I am on Arch Linux, generally latest versions of everything and running Steam in the "native" version.

The following is what jstest-gtk shows me for the controller with Steam's "Switch Pro Configuration Support" option unselected.

2021-04-19_02-45-54.mp4

The only thing that is responsive here is axis two, although that should have been axis 1.

After enabling Switch pro con support in the settings, jstest-gtk shows me an additional fake(?) xbox 360 controller shows no inputs in "Properties". However, the right analog stick is translated to mouse movement and the left stick is translated to arrow keys.

2021-04-19_02-53-26

Ori and the Blind Forest just works, but Trine 2 seemingly picks up the erratic garbage inputs and automatically selects items on the menu, after which it eventually cycles the "escape" menu in-game until I unplug it.

The launcher itself is also quite irritated by it.

2021-04-19_02-52-35.mp4

@kisak-valve
Copy link
Member

Steam Input implementation interfering with native Switch Pro Controller driver

Issue transferred from #7786.
@clarfonthey posted on 2021-05-07T02:43:21:

Your system information

  • Steam client version (build number or date): Apr 27, 2021 at 23:10:40 (package version 1619570428)
  • Distribution (e.g. Ubuntu): Arch Linux
  • Opted into Steam client beta?: Yes
  • Have you checked for system updates?: Yes

Please describe your issue in as much detail as possible:

I use the native hid-nintendo driver to get my Switch Pro controller working outside of steam. (see: #6651)

Right now, the built-in Steam Input driver interferes with the native driver in frustrating ways. In order to get things to work with the native driver, I have to use the suggested workaround of running Steam in firejail (usr/bin/firejail --noprofile --blacklist=/sys/class/hidraw/ /usr/bin/steam-runtime) which completely overrides any Steam Input settings, but lets me use my controller in games with minimal issues. If I open steam without firejail, Steam Input works, but the controller is interpreted as a mouse and keyboard in other apps while Steam is open, and I can't natively use the controller outside of steam.

I'm making a new issue because despite several requests in the other ticket (#6651) this is still an issue affecting users, and I would prefer to be able to launch steam without having to look up a firejail command just to make things work with my controller.

At minimum, Steam for Linux should detect if the hid-nintendo driver is present and use that instead of its own driver if available, so that Steam Input can still work as expected. Otherwise, the default implementation is fine.

@ricpelo
Copy link

ricpelo commented May 8, 2021

I would like to say that the Nintendo Switch Pro Controller via Bluetooth doesn't work in some games with the hid-nintendo driver, but they work using Steam driver.

For example, No Man's Sky (using Proton) doesn't detects my controller if I use the firejail ... --blacklist=/sys/class/hidraw/ ... trick, so I need to use the Steam driver.

(However, I need to disable rumble in order to use the controller more than several minutes into the game before disconnecting.)

@clarfonthey
Copy link

FWIW I also have the same problem with Blue Fire -- I had to use the Steam Input version of the driver when the hid-nintendo one usually works. I haven't ever encountered this issue in a native game, though, and it is likely an issue in Proton that affects a few games. Properly supporting hid-nintendo would be the proper fix for this IMHO, and not a reason to continue the existing behaviour.

@ricpelo
Copy link

ricpelo commented May 9, 2021

The best fix, I think, should be to let the user choose the driver he/she wants to use in every case.

@clarfonthey
Copy link

Uh, no… drivers aren't supposed to work that way. You use the proper driver for hardware, end of story; the only reason why steam should make up its own driver for Switch Pro controllers is if the system doesn't support it. There's still the option to enable or disable Steam Play for a controller, but that doesn't actually change the drivers, just how their inputs are processed in the game.

@jason-oliveira
Copy link

jason-oliveira commented Jul 7, 2021

There's a reason we're not seeing action on this. Because of the fact that hid-nintendo has not been accepted into the mainline kernel yet, we shouldn't be expecting any updates in this issue from Valve.

Yes, dkms-hid-nintendo is wondeful, quite stable, and it works really really well. But it's not included by default in any distro kernels, and is a userspace-breaking change, which should not be taken lightly by Valve.

@DanielOgorchock
Copy link
Author

For now I've added a workaround for this problem to the joycond daemon.
See the arch wiki for an explanation.

timokau pushed a commit to NixOS/nixpkgs that referenced this issue Oct 7, 2021
This version adds support for "virtual controller" pairing, which lets
us use a Pro Controller with Steam and non-steam without collisions.

See also:
- https://wiki.archlinux.org/title/Gamepad#Using_hid-nintendo_pro_controller_with_Steam_Games_(with_joycond)
- ValveSoftware/steam-for-linux#6651 (comment)
@SuperSamus
Copy link

hid-nintendo is coming to Linux 5.16.

@sigzegv
Copy link

sigzegv commented Jun 27, 2022

Something new about fixing conflict between kernel driver and steam driver ?

@jason-oliveira
Copy link

We're in a transtionary period between distros using the old hidraw method to access switch controllers, and the new method inside the kernel that happened with 5.16's hid-nintendo.

Valve, being on kernel 5.13 right now, will need roughly six to twelve months before this situation is really resolved. This is not a small change, and has multiple points of pain right now in regards to useability. For instance, all third-party switch controllers seem to have problems with hid-nintendo.

This one will take patience, though I'm sure patches are welcome.

@SuperSamus
Copy link

I don't know if Valve intends to support kernel modules.
hid-playstation (introduced in Linux 5.12) for example should be enabled on SteamOS, but it's not.
ValveSoftware/SteamOS#746

@SuperSamus
Copy link

This is still not fixed by the latest Steam Beta (which claims to add support for other Switch related controllers).
It's not a good thing that the option Switch Pro Configuration Support still has a lie in its description: "Note: This setting must be disabled for Switch Pro Controllers to work in games not launched through Steam while Steam is running".

@SuperSamus
Copy link

SuperSamus commented Dec 14, 2022

It seems that the issue has been fixed: I played the entirety of Aperture Desk Job with no issue, and I can use the controller outside Steam even when Switch Pro Configuration Support is active.
Tested through USB. Didn't use joycond. My user is in the input group.
EDIT: Nevermind about working outside Steam, it depends on the game.

@LuckyTurtleDev
Copy link

LuckyTurtleDev commented Jan 10, 2023

I have test it using the lasted steam beta on manjaro running kernel 6.1.1 and the pro controller is not detected by steam.
But evtest and jstest has detect the controller and it seems to work.

$ evtest
No device specified, trying to scan all of /dev/input/event*
Not running as root, no devices may be available.
Available devices:
....
/dev/input/event24:	Nintendo Switch Pro Controller
/dev/input/event25:	Nintendo Switch Pro Controller IMU
$ jstest /dev/input/js0
Driver version is 2.1.0.
Joystick (Nintendo Switch Pro Controller) has 6 axes (X, Y, Rx, Ry, Hat0X, Hat0Y)
and 14 buttons (BtnA, BtnB, BtnX, BtnY, BtnZ, BtnTL, BtnTR, BtnTL2, BtnTR2, BtnSelect, BtnStart, BtnMode, BtnThumbL, BtnThumbR).
Testing ... (interrupt to exit)
Axes:  0:  -145  1:     0  2:     0  3:     0  4:     0  5:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off  9:off 10:off 11:off 12:off 13:off

Have testing both steam-runtime and steam-native.

@DanielOgorchock
Copy link
Author

DanielOgorchock commented Jan 10, 2023

Replying to #6651 (comment)

You don't have joycond installed do you? If so, it has udev rules to prevent steam from seeing the hidraw devices for the controller.

@LuckyTurtleDev
Copy link

I do not have joycond installed.
I also have test the firejail command from the arch wiki.

firejail --noprofile --blacklist=/sys/class/hidraw/ steam

But this has also not fix the issue.

I am running steam from a second gaming user, using the wayland session from my main user. Could this be the issue?
The gaming user is member of the input group.
The test above were executed with this gaming user.

@banaanihillo
Copy link

#6651 (comment)

@DanielOgorchock could you elaborate? I have tried removing joycond but then my controller would no longer be detected by any means, with or without Steam, wireless or wired.

I have also tried running Steam via firejail --noprofile --blacklist=/sys/class/hidraw/ steam -oldbigpicture with and without the latest beta client, on a Switch pro controller (wireless and wired) and Joy cons, combined or separate.

My issue is the same as the one reported on #8862 and #8273 but that issue seems to be going nowhere, so I figured I'd ask here instead.

Steam does not detect my Switch Pro Controller if I try to connect it with L + R. If I connect it by pressing minus and plus, it detects it alright, but thinks it's a Joy-Con. I am unsure whether this has anything to do with the gyro not working.

Joy-Cons can be connected to Steam alright by holding L + R but, again, the gyro appears not to work.

I can see the gyro working via jstest-gtk and I can use the Switch Pro Controller for Retroarch perfectly, however, I do not really know what else to test the gyro with other than a Steam game in which I'm trying to emulate mouse movement with the gyro.

@endrift
Copy link

endrift commented Mar 31, 2023

I'm trying to reproduce this on 6.1.11 and while there are definitely some issues (mostly hid-nintendo just kind of gives up after Steam exists, producing no further reports afaict), I'm not seeing this "spastic" behavior described. Are the original symptoms still accurate?

@SuperSamus
Copy link

SuperSamus commented Apr 26, 2023

I have been using the Pro Controller via USB for a while now, both inside and outside Steam, and I noticed no conflict problems.
I think that this should be closed, other minor problems deserve their own issues now.
(Not using joycond, kernel 6.2.12-xanmod1)

@Octelly
Copy link

Octelly commented Apr 27, 2023

I have been using the Pro Controller via USB for a while now, both inside and outside Steam, and I noticed no conflict problems. I think that this should be closed, other minor problems deserve their own issues now. (Not using joycond)

How did you get it working? For me it's super inconsistent across different devices and sometimes even across different connection methods (USB/BT).

I definitely don't think this issue should be closed as some people are still experiencing this problem.

@sigzegv
Copy link

sigzegv commented Apr 27, 2023

actually I'm also using the pro controller (on debian 12, kernel 6.1) without joycond and I'm not getting any conflict issues since a some months. I don't know if anything as been done but it's very stable for me too.

@nfp0
Copy link

nfp0 commented Apr 27, 2023

@SuperSamus @sigzegv @Octelly What kernel are you on?
Don't forget hid-nintendo is only on Linux 5.16 and later.

@jason-oliveira
Copy link

@SuperSamus @sigzegv @Octelly

It's important to remember that hid-nintendo also applies to 3rd-party controllers, many of which are still not working correctly in the 6.2 series. As such, this is an ongoing issue with the driver functionality, despite the good news that 1st-party controllers work well.

@SuperSamus
Copy link

SuperSamus commented Apr 27, 2023

hid-nintendo
driver functionality

@jason-oliveira Are talking about hid-nintendo or Steam? If it's the former, then you should go to https://github.com/DanielOgorchock/linux/issues.

@nfp0
Copy link

nfp0 commented Apr 27, 2023

@SuperSamus I mentioned hid-nintendo because I believe it's addition to Linux is related to the recent problems of Steam detecting the controller.

@Octelly
Copy link

Octelly commented Apr 30, 2023

@nfp0
I'm on Arch, so I'm on 6.something.

@Octelly
Copy link

Octelly commented Apr 30, 2023

@jason-oliveira
don't worry, I only have first party controllers, I generally avoid 3rd party ones

@nfp0
Copy link

nfp0 commented Apr 30, 2023

@Octelly Then you definitely have hid-nintendo on your kernel.

@Octelly
Copy link

Octelly commented Apr 30, 2023

@SuperSamus
the problems stem from the combination of the 2...
idk, non-Steam games work great with my Pro Controller, Steam games are a lost cause though... and I don't really enjoy using my old beat up X360 controller for those

@Octelly
Copy link

Octelly commented Apr 30, 2023

@nfp0 correct

@nfp0
Copy link

nfp0 commented Apr 30, 2023

@Octelly Try blacklisting hid-nintendo and see if you get the same behavior on Steam.

@Octelly
Copy link

Octelly commented Apr 30, 2023

@nfp0 I need hid-nintendo for joycond, which I use for Dolphin... it handles gyro stuff and all that really well... I don't know anything about Steam input being able to pass raw gyro data onto applications...

@nfp0
Copy link

nfp0 commented Apr 30, 2023

@Octelly You don't need to do it permanently. My suggestion was to check if that is the source of the problem on Steam or not.

@Octelly
Copy link

Octelly commented Apr 30, 2023

@nfp0 I might look into that later, can't reboot rn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests