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: Some attempts at making macOS joystick input more reliable. #7760

wants to merge 1 commit into
base: master


3 participants
Copy link

jordan-woyak commented Jan 31, 2019

Apparently some devices like to return elements with duplicate usages. This has caused axes to malfunction in the past and was fixed by ignoring all except the last element for each usage.
That has seemed to cause some users to have have missing axes.

I've hopefully found a middle ground where duplicate axes are used but named differently.

There are reports of missing buttons.

The button enumeration code is pretty straightforward so I can only assume that they are being named inappropriately.
I've now named buttons according to their enumeration order rather than their usage.
This matches the behavior of most of our other input backends.

Only one "hatswitch" was supported.
Now any number of enumerated hats should function.

GetState calls no longer invoke IOHIDElementGetLogicalMin/Max.
Hopefully this reduces input related slowdowns experienced by some users.

I've renamed "Input" to "IOKit".

Code is untested as I lack macOS.

Relevant issues:

@jordan-woyak jordan-woyak force-pushed the jordan-woyak:macos-input-fixes branch 3 times, most recently from 7d52fbd to c97188c Jan 31, 2019

@jordan-woyak jordan-woyak force-pushed the jordan-woyak:macos-input-fixes branch from c97188c to fa72c0e Feb 3, 2019

Copy link

chargeflux left a comment

I added a few comments, if you don't mind.

Joystick::Hat::Hat(IOHIDElementRef element, IOHIDDeviceRef device, Direction dir,
unsigned int index)
: m_element(element), m_device(device), m_direction(dir),
m_index(index) m_min(IOHIDElementGetLogicalMin(m_element)),

This comment has been minimized.


chargeflux Feb 4, 2019

Suggested change Beta
m_index(index) m_min(IOHIDElementGetLogicalMin(m_element)),
m_index(index), m_min(IOHIDElementGetLogicalMin(m_element)),
return 1;
case 6:
if (m_direction == m_direction == Direction::Left)

This comment has been minimized.


chargeflux Feb 4, 2019

Suggested change Beta
if (m_direction == m_direction == Direction::Left)
if (m_direction == Direction::Left)

Also I get this error: invalid operands to binary expression ('int' and 'ciface::OSX::Joystick::Hat::Direction')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment