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

Add Sixaxis init for Monterey #10

Merged
merged 1 commit into from
Jan 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions hidapi/hidapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,14 @@ extern "C" {
*/
int HID_API_EXPORT HID_API_CALL hid_write_control(hid_device *device, const unsigned char *data, size_t length);

#ifdef __APPLE__
/** RPCS3 EDIT: Initializes a USB Sixaxis/DualShock 3 controller,
* which requires report_id to be separate from the data packet.
* Required on macOS Monterey.
*/
int HID_API_EXPORT hid_init_sixaxis_usb(hid_device *dev);
#endif

#ifdef __cplusplus
}
#endif
Expand Down
12 changes: 12 additions & 0 deletions mac/hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -1203,6 +1203,18 @@ HID_API_EXPORT const wchar_t * HID_API_CALL hid_error(hid_device *dev)
return L"hid_error is not implemented yet";
}

int HID_API_EXPORT hid_init_sixaxis_usb(hid_device *dev)
{
const char data[] = { 0x42, 0x0C, 0x00, 0x00 };
size_t length = sizeof(data);
const unsigned char report_id = 0xF4;

if (IOHIDDeviceSetReport(dev->device_handle, kIOHIDReportTypeFeature, report_id, data, length) == kIOReturnSuccess) {
return length;
}

return -1;
}



Expand Down