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

WIP - ControllerInterface. Combine evdev devices with the same "uniq" name. #8356

Open
wants to merge 2 commits into
base: master
from

Conversation

@jordan-woyak
Copy link
Member

commented Sep 9, 2019

Unfortunately newer Linux drivers for DS4 (Playstation 4) controllers split the device into three separate event nodes.

On my system I get:
"Sony Interactive Entertainment Wireless Controller"
"Sony Interactive Entertainment Wireless Controller Touchpad"
"Sony Interactive Entertainment Wireless Controller Motion Sensors"

Apparently this is due to some evdev policy: "A device must not mix regular directional axes and accelerometer axes on the same event node."

Our input system does allow use of multiple devices via "All Devices" or so-called "absolute path" control expressions, but this is less than desirable especially when making use of multiple DS4s.

This PR combines evdev devices that return the same non-null unique ID (via libevdev_get_uniq).

Mapping of raw acceleration/gyroscope inputs in PR #8352 is less horrible this way.

I'm not entirely happy with this implementation. It gets pretty ugly, especially the parts that keep the button/axis names in the same deterministic order, but there doesn't seem to be a clean way to do it as evdev enumerates devices in a seemingly random order.

AddOutput(new RumbleEffect(m_fd, RumbleEffect::Motor::Strong));
AddOutput(new RumbleEffect(m_fd, RumbleEffect::Motor::Weak));
AddOutput(new RumbleEffect(fd, RumbleEffect::Motor::Strong));
AddOutput(new RumbleEffect(fd, RumbleEffect::Motor::Weak));
}

// TODO: Add leds as output devices

// Was there some reasoning behind these numbers?

This comment has been minimized.

Copy link
@riking

riking Sep 10, 2019

Contributor

Highly probable that the reasoning is: You need two axes for a joystick, and eight buttons for a NES controller.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can’t perform that action at this time.