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

steam-support: add udev rules from steam-devices #12657

Merged
merged 5 commits into from
Mar 28, 2023

Conversation

ZoopOTheGoop
Copy link
Contributor

@ZoopOTheGoop ZoopOTheGoop commented Mar 16, 2023

This allows the Steam snap to add the udev rules from the steam-devices apt package. We're currently at an impasse on potentially allowing broader changes to the udev ecosystem in snapd so this works as a good enough fix for our current purposes.

The issue is that currently for a lot of controllers to work (in Steam), users need to apt install steam-devices, which, if installing recommends is enabled (as it is for most people) will also install the deb version of Steam. This bypasses this and installs the udev rules along with the snap on the connection of the steam-support plug. The addition is structured such that if steam-devices changes it's easy to copy+paste the new file (at least until/unless the game controller rules end up in systemd which will likely happen eventually).

@kenvandine kenvandine requested a review from jhenstridge March 16, 2023 21:49
Copy link
Contributor

@jhenstridge jhenstridge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good (I have given feedback on earlier versions of this branch). The uaccess rules need to run before 73-seat-late.rules, which is achieved since snapd writes out the rules as a file named 70-snap.*.rules.

We're not doing any device tagging here, but we should get that when the interface is paired with joystick and hidraw.

It's a shame we can't rely on Go 1.16 features: the embed package: that would let us keep the udev rules in separate files identical to the ones from https://github.com/ValveSoftware/steam-devices/.

@mvo5 mvo5 added the Needs security review Can only be merged once security gave a :+1: label Mar 17, 2023
@ZoopOTheGoop
Copy link
Contributor Author

Okay so a misspelling test failed, is there a way to ignore that specific lint? This is a spelling dumped directly from the .rules file we're trying to embed, and it causes some level of maintenance burden to have to scan and fix basic misspellings etc from external code. I can change it if not, it's not a huge deal, but it's just we'll have to remember to redo this for a file we don't control every time we update this to contain new rules to sync up with steam-devices.

@pedronis pedronis self-requested a review March 20, 2023 09:27
@mvo5 mvo5 added this to the 2.59 milestone Mar 20, 2023
Copy link
Contributor

@alexmurray alexmurray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - I really like the simplicity of this approach, keeping the udev rules within the steam-support interface itself.

One minor comment about the direct use of spec.AddSnippet() - but this is more cosmetic thing IMO and probably would be worth ignoring unless @mvo5 or @pedronis agree.

}

func (iface *steamSupportInterface) UDevConnectedPlug(spec *udev.Specification, plug *interfaces.ConnectedPlug, slot *interfaces.ConnectedSlot) error {
spec.AddSnippet(steamSupportSteamInputUDevRules)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realise this would make maintenance for these rules harder, but I wonder if instead of using spec.AddSnippet() whether it would be worthwhile to expand spec.TagDevice() to instead take an optional tag argument?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would imagine these rules are copied quasi-verbatim from some other source so it would be annoying to restructure them that way?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are actually just copy+pasted from the .rules files, yes.

@alexmurray alexmurray removed Security-High Needs security review Can only be merged once security gave a :+1: labels Mar 24, 2023
Copy link
Collaborator

@pedronis pedronis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mvo5 mvo5 added the Squash-merge Please squash this PR when merging. label Mar 28, 2023
@mvo5 mvo5 merged commit 55fcf0d into canonical:master Mar 28, 2023
mvo5 added a commit that referenced this pull request Mar 28, 2023
* Add steam-devices udev rules to steam-support

* Make udev changes easier to add

* Add Udev spec test for steam-support

* run-checks: ignore mispell of "becuase"

* run-checks: fix misspelled misspell (the irony)

---------

Co-authored-by: Michael Vogt <mvo@ubuntu.com>
@ZoopOTheGoop ZoopOTheGoop deleted the steam-devices-udev-rules branch March 28, 2023 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-picked Squash-merge Please squash this PR when merging.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants