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

linux/gamepad: Do not fail on EPERM return values. #2308

Merged
merged 1 commit into from Sep 6, 2022

Conversation

divVerent
Copy link
Contributor

This appears to happen inside the Snap sandbox when accessing a non-gamepad /dev/input device.

@@ -105,7 +105,7 @@ func (*nativeGamepadsImpl) openGamepad(gamepads *gamepads, path string) (err err

fd, err := unix.Open(path, unix.O_RDONLY|unix.O_NONBLOCK, 0)
if err != nil {
if err == unix.EACCES {
if err == unix.EACCES || err == unix.EPERM {
return nil
}
// This happens just after a disconnection.
Copy link
Owner

Choose a reason for hiding this comment

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

Let's add a comment like this

		if err == unix.EACCES {
			return nil
		}
		// This happens with the Snap sandbox (#2307)
		if err == unix.EPERM {
			return nil
		}

This seems required for the snap sandbox when probing a non-gamepad device node.

Fixes hajimehoshi#2307.
Copy link
Owner

@hajimehoshi hajimehoshi left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@hajimehoshi hajimehoshi merged commit 34a500c into hajimehoshi:main Sep 6, 2022
hajimehoshi pushed a commit that referenced this pull request Sep 6, 2022
This seems required for the Snap sandbox when probing a non-gamepad device node.

Closes #2307
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.

None yet

2 participants