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

Closed

Conversation

jordan-woyak
Copy link
Member

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?
Copy link
Contributor

Choose a reason for hiding this comment

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

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

@mbc07
Copy link
Contributor

mbc07 commented Nov 12, 2019

Any news on this PR? Seems to be the last missing piece to have DualShock 4 motion sensors working natively on Linux...

@jordan-woyak
Copy link
Member Author

jordan-woyak commented Nov 12, 2019

@mbc07 I have some ideas on how to do it more cleanly. Hopefully I'll do it soonish.

@jordan-woyak
Copy link
Member Author

New PR #8473 .

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