[OSX][Gamepad] DualShock 4 does not work in OSX
Pair DualShock 4 as per instruction on imore.com
Device comes through with "Unknown" manufacturer to UnityEngine.Experimental.Input.InputManager.OnNativeDeviceDiscovered.
Device is listed as "Unknown Wireless Controller" in Input Debug Window.
Manufacturer is listed as "Qualcomm Atheros (0x5, 0x00)" in OSX System Report.
There is also a "NotImplementedException: Cannot yet convert multi-bit fields to floats" thrown from UnityEngine.Experimental.Input.LowLevel.InputStateBlock.ReadFloat, when attempting to launch the button input debugger from the Input Device Debugger Window.
I expect this issue relates to https://github.com/Unity-Technologies/InputSystem/issues/131
We have issues with HIDs connected via Bluetooth that need to be looked at. My guess is this comes down to the same problem. Does the controller work for you when you go wired?
Bluetooth has a weird relation to USB HID and my guess is that both on Windows and OSX, we're not doing things right yet to properly support the same HIDs on BT as compared to USB.
Thanks for the tip. The DualShock 4 does work when wired, as per MacWorld instructions, although I'm not sure if the acceleration and angular velocity values are accurate. The manufacturer is displayed as "Sony Computer Entertainment". I have a wired XBox 360 controller which works fine too.
Looking forward to Bluetooth support :D
not sure if the acceleration and angular velocity values are accurate
Yup, ATM we only support the gyro on PS4. There's some wiring for the HID version as well but it's not correct (i.e. it's indeed junk you get) and needs to be removed. Seems that unlike for the PS3 controller, the PS4 controller gyro hasn't successfully been reverse-engineered :/
Should be fixed by https://github.com/Unity-Technologies/InputSystem/commit/b1597755e74c93bbe39a82005285f30ba5f60888.
Turns out that when connected via Bluetooth, the OSX HID API will no longer return product and manufacturer strings. Changed the code to always match by PID and VID by default and use product and manufacturer strings only as fallbacks.
However, also uncovered another bug in the recent changes to the OSX native code which incidentally makes PIDs and VIDs go missing. In fact, the entire capabilities string gets dropped. Have a fix and will route that to 2019.1, 2018.3, and 2018.2. May take a bit to land, though.
Looks good! Although when discovered as a HID, it is not added to the Gamepad.all list. I expect this is by design, as a HID is not always a Gamepad?
I still had to patch the InputStateBlock.ReadFloat method to allow me to view the device in the Input Debugger.
Thanks again for the quick fix!
It probably won't work properly until the native fixes have landed publicly, too. From what you describe, it sounds like it still comes out as a generic HID. Once the native stuff is in, it should correctly appear as a DualShockGamepad and also appear in Gamepad.all.
I still had to patch the InputStateBlock.ReadFloat method to allow me to view the device in the Input Debugger.
This should be fixed on latest head I think. We recently implemented the part that used to throw a NotImplementException.
I just saw the fix on the develop branch. Thanks for the update!
Just to ask, is it (or will there be) support for accelerometer/gyro from dualshock on platforms other than PS4?
Also to confirm, I'm assuming the public parts that you talk about @Rene-Damm haven't been released yet? I'm using 2018.3.4f1 and I'm getting the same problem (PS4 controller working wired, but not on Bluetooth)
Even worse, the generic support I still get on bluetooth seems to be a bit broken, the left stick gets recognized as a stick, but the up & down directions are reversed...
@oszust002 Sorry about dropping the ball here. Thought I had responded.
Just to ask, is it (or will there be) support for accelerometer/gyro from dualshock on platforms other than PS4?
Likely not. We haven't figured out the format that the controller sends this data in and it doesn't seem like anyone out there has. Steam supports it but not sure whether they are using Sony's libs under license or have figured out the format. If/when the format becomes clear, we'll hook up the data but unfortunately, for now the sensors on the DualShock controller are only supported on PS4.
Also to confirm, I'm assuming the public parts that you talk about @Rene-Damm haven't been released yet? I'm using 2018.3.4f1 and I'm getting the same problem (PS4 controller working wired, but not on Bluetooth)
The native changes have landed in 2019.1 but uncertain ATM whether they will end up getting into 2018.3. Chances not looking great ATM :(
Even worse, the generic support I still get on bluetooth seems to be a bit broken, the left stick gets recognized as a stick, but the up & down directions are reversed...
Yeah, the fallback HID support is limited in what it can do. The way a HID describes itself provides very little information as to how to correctly read the data. A trigger and a stick axis may come out looking absolutely identical and it's impossible to tell where the rest point is or which direction the axis is going. At least from all I know.
So the fallback is really little more than a best effort that usually manages to at least surface the data but in many cases will not result in a correctly working controller.
PS4 controller works for OSX when plugged. Bluetooth controller still needs work but it is known. Closing.