Add Linux support for PS4 Move controllers#361
Conversation
Both seem to do the same thing (setting LED color and rumble), but 0x06 also works with the CECH-ZCM2 models.
This agent simply answers any HCI PIN Code Request with the PIN code '0000'.
Those values are stored in the HID report as two's complement. Also, there are no longer values from two different half-frames.
This model does not have any magnetometers.
There are no half-frames in the HID input report anymore. Instead, the second value reported for the trigger button seems to be a heavily low-pass filtered version of the first one. We simply return the first value for this new controller model.
Weird, GCC on Linux did not even issue a warning ...
|
|
||
| // free HID device enumerations | ||
| for (i = 0; i < NUM_PSMOVE_PIDS; i++) { | ||
| devs = hid_enumerate(PSMOVE_VID, PSMOVE_PIDS[i]); |
There was a problem hiding this comment.
This shouldn't do a hid_enumerate() again, but just a hid_free_enumeration(move_hid_devices[i]);, right?
There was a problem hiding this comment.
This was only a silly copy & paste error. Fixed.
| **/ | ||
| ADDAPI enum PSMove_Bool | ||
| ADDCALL psmove_host_pair_custom(const char *addr); | ||
| ADDCALL psmove_host_pair_custom(const char *addr, enum PSMove_Model_Type model); |
There was a problem hiding this comment.
Hmm, this changes kind of the public API. Should we add a new method psmove_host_pair_custom_model(); and have the old function just call that with Model_ZCM1 as the first parameter? This way, existing library users can still use the old function psmove_host_pair_custom() without breakage, while new code can take advantage of the model selection.
There was a problem hiding this comment.
Fair enough. Fixed.
| if (gz != NULL) { | ||
| *gz = (int16_t) (move->input.gZlow + (move->input.gZhigh << 8)); | ||
| } | ||
| } else { |
There was a problem hiding this comment.
Something is wrong with the indentation here?
There was a problem hiding this comment.
Converted tabs to spaces. Fixed.
| move->input.mXlow); | ||
| } | ||
| if (move->model == Model_ZCM2) { | ||
| // NOTE: This model does not have magnetometers |
There was a problem hiding this comment.
Should we disable/disallow magnetometer calibration in that case then?
There was a problem hiding this comment.
Yes, probably. But this touches on the whole calibration data topic that I did not (yet) want to get into since there are also changes in the associated HID report for the new PS4 Move controller (and probably in the actual calibration data itself).
| #include "../psmove_private.h" | ||
| #include "../psmove_port.h" | ||
|
|
||
| #define OPT_PS4 "--ps4" |
There was a problem hiding this comment.
static const char *OPT_PS4 = "--ps4";
thp
left a comment
There was a problem hiding this comment.
Added some comments. For a first version, it's already quite good.
|
First of all, |
Instead, introduce a new function psmove_host_pair_custom_model() that accepts the controller hardware model as additional argument. This keeps the public API stable.
There are a couple of things left to clean up (especially moved-related). But this should get us started with proper PS4 Move support.
Bluetooth setup was only implemented for Linux. Mac and Windows still need to be done.