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 Xbox One Elite 2 Controller #59

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rotilho
Copy link

@rotilho rotilho commented Jul 19, 2024

No description provided.

@dm-zharov
Copy link

dm-zharov commented Jul 21, 2024

I can confirm that this rule resolves detection of "Xbox Elite Series 2 Controller" (on latest "BLE" firmware).

@dm-zharov
Copy link

dm-zharov commented Jul 21, 2024

If useful, there is the output of udevadm info --query=all --attribute-walk --name=/dev/hidraw7:

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/virtual/misc/uhid/0005:045E:0B22.0008/hidraw/hidraw7':
    KERNEL=="hidraw7"
    SUBSYSTEM=="hidraw"
    DRIVER==""
    ATTR{power/control}=="auto"
    ATTR{power/runtime_active_time}=="0"
    ATTR{power/runtime_status}=="unsupported"
    ATTR{power/runtime_suspended_time}=="0"

  looking at parent device '/devices/virtual/misc/uhid/0005:045E:0B22.0008':
    KERNELS=="0005:045E:0B22.0008"
    SUBSYSTEMS=="hid"
    DRIVERS=="microsoft"
    ATTRS{country}=="00"
    ATTRS{power/control}=="auto"
    ATTRS{power/runtime_active_time}=="0"
    ATTRS{power/runtime_status}=="unsupported"
    ATTRS{power/runtime_suspended_time}=="0"

  looking at parent device '/devices/virtual/misc/uhid':
    KERNELS=="uhid"
    SUBSYSTEMS=="misc"
    DRIVERS==""
    ATTRS{power/control}=="auto"
    ATTRS{power/runtime_active_time}=="0"
    ATTRS{power/runtime_status}=="unsupported"
    ATTRS{power/runtime_suspended_time}=="0"

@everettperiman
Copy link

Can confirm this fixes the issues I currently have using my Elite 2 controller under Debian 12 w/Plasma.

@everettperiman
Copy link

Another note, 60-steam-input.rules seems to be missing on my Steam Deck and I have had no issues there so that makes sense. I wonder how it is implemented on the deck and why that is not rolled into the regular Steam install.

@mhalano
Copy link

mhalano commented Oct 28, 2024

I think I'm the opener of the original issue (ValveSoftware/steam-for-linux#7852). After I added the line in the file and restarted udev it was recognized correctly. Now it has the wrong name under USB (Elite instead of Elite 2). Maybe it would be fruitful to add the fix to this PR to create full cover of both cases, Bluetooth and USB, but I don't know if this is possible.

AdrianVovk added a commit to AdrianVovk/systemd that referenced this pull request Nov 5, 2024
The Xbox Elite Controller Series 2 has a feature where you can map the
gamepad buttons into keyboard keys, and then save those mappings onto
the device's on-board memory [1].

To implement this, the controller's HID report descriptor has two
separate collections: one is a gamepad, and the other is a full PC
keyboard. This way, the gamepad can press keyboard buttons if configured
to do so.

As far as `builtin-input_id` can tell, this device is a keyboard. So,
it's not tagged with uaccess, and so Steam cannot use the device. The
solution is to special-case this device in hwdb

Note that this issue is likely affecting the Xbox Adaptive Controller as
well. I don't have one that I can test with to verify.

Fixes: ValveSoftware/steam-for-linux#7852

Alternative: ValveSoftware/steam-devices#59

[1]: https://news.xbox.com/en-us/2023/08/03/keyboard-button-mapping-for-xbox-controllers/
@AdrianVovk
Copy link

Here's an alternative approach that doesn't require punching additional holes via steam-input: systemd/systemd#35023

The problem is that the Elite 2 is simultaneously a gamepad and a keyboard. The operating system (specifically: udev) generally doesn't let apps (in this case: Steam) have unrestricted access to keyboards. For reasons, udev prevents itself from marking a device as both a keyboard and a gamepad; such a device is always marked as just a keyboard. So the fix is to mark the device as a gamepad too, which makes it available to Steam

@AdrianVovk
Copy link

Whoops, scratch my previous comment. This is the right approach.

There's a subtle difference between the two: this PR gives Steam direct raw HID access to the controller, whereas my PR gives Steam access to the evdev event stream for the controller. Raw HID supports Elite-specific buttons like the back paddles, but evdev does not.

So, with this PR the controller shows up with all of its features, and with my PR the controller shows up in Steam like a basic Xbox controller.

@rotilho
Copy link
Author

rotilho commented Jan 9, 2025

Hello @Plagman, when you have a moment, could you please take a look at this PR? Thank you!

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

Successfully merging this pull request may close these issues.

5 participants