Skip to content

Add Linux support for PS4 Move controllers#361

Merged
thp merged 14 commits into
thp:cech-zcm2jfrom
nitsch:cech-zcm2j
Jul 27, 2018
Merged

Add Linux support for PS4 Move controllers#361
thp merged 14 commits into
thp:cech-zcm2jfrom
nitsch:cech-zcm2j

Conversation

@nitsch
Copy link
Copy Markdown
Collaborator

@nitsch nitsch commented Jul 8, 2018

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.

nitsch added 7 commits July 8, 2018 20:37
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.
Comment thread src/psmove.c Outdated

// free HID device enumerations
for (i = 0; i < NUM_PSMOVE_PIDS; i++) {
devs = hid_enumerate(PSMOVE_VID, PSMOVE_PIDS[i]);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This shouldn't do a hid_enumerate() again, but just a hid_free_enumeration(move_hid_devices[i]);, right?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This was only a silly copy & paste error. Fixed.

Comment thread include/psmove.h Outdated
**/
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);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fair enough. Fixed.

Comment thread src/psmove.c Outdated
if (gz != NULL) {
*gz = (int16_t) (move->input.gZlow + (move->input.gZhigh << 8));
}
} else {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Something is wrong with the indentation here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Converted tabs to spaces. Fixed.

Comment thread src/psmove.c
move->input.mXlow);
}
if (move->model == Model_ZCM2) {
// NOTE: This model does not have magnetometers
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Should we disable/disallow magnetometer calibration in that case then?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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).

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

ok

Comment thread src/utils/psmoveregister.c Outdated
#include "../psmove_private.h"
#include "../psmove_port.h"

#define OPT_PS4 "--ps4"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

static const char *OPT_PS4 = "--ps4";

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed.

Copy link
Copy Markdown
Owner

@thp thp left a comment

Choose a reason for hiding this comment

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

Added some comments. For a first version, it's already quite good.

@s1xx1s
Copy link
Copy Markdown

s1xx1s commented Jul 21, 2018

First of all,
Thank You for the 'Ps-Move API'.
Great work!!!
I would also very much appreciate the addition of the PS4 Six-Axis Touchpad Contrthe oller API being added!
Many beneficial applications will be introduced!

nitsch added 5 commits July 22, 2018 23:32
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.
@thp thp merged commit b58c98d into thp:cech-zcm2j Jul 27, 2018
@nitsch nitsch deleted the cech-zcm2j branch July 30, 2018 22:02
@nitsch nitsch mentioned this pull request May 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants